Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Activity for luserâ€
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Question | — |
Is it possible to get the current function in a trace function? I'm trying to subclass `pdb` to have a debugger that, in case of a call to a decorated function, can "step in" the decorated function directly and skip the decorator content altogether. A well-behaved decorator using `@functools.wraps` sets `wrapped` attribute on the wrapper to point to the decorated... (more) |
— | about 1 year ago |
Answer | — |
A: A class to access dicts using attribute syntax 1. It is useful sometimes, for example consider a program accepting input in the form of templates. An input of `"Value: {obj.field}"` is more readable than `"Value: {obj['field']}"`. - Such an example is an app processing JSON and evaluating expressions on it, like `jq` or a similar Python app,... (more) |
— | about 2 years ago |
Question | — |
How to override default string formatter? It is possible to create a new formatter class by subclassing `string.Formatter` class and then to use it like `myformatter.format("{foo:customformat}", foo=foo)`. It's not super-convenient though, and above all, it fails miserably with f-strings, i.e. `f"{foo:customformat}"` won't use my custom form... (more) |
— | over 3 years ago |