RE: Question regarding unexpected behavior in using __enter__ method

2023-04-25 Thread avi.e.gross
I think you got that right, Rob. A method created in a class is normally expected to care about the class in the sense that it often wants to access internal aspects and is given a "this" or "self" or whatever name you choose as a first argument. As noted, it is sometimes possible to create a

Re: Question regarding unexpected behavior in using __enter__ method

2023-04-25 Thread Rob Cliffe via Python-list
This puzzled me at first, but I think others have nailed it.  It is not to do with the 'with' statement, but with the way functions are defined. When a class is instantiated, as in x=X():     the instance object gets (at least in effect), as attributes, copies of functions defined *in the

[Python-announce] [Python announce] dictf 1.0.0 released!

2023-04-25 Thread Eric Mendes
Hi, everyone! I'm not sure if this is useful to anyone, nor original. It's a problem you can easily solve with a dict comprehension, but I love a pretty syntax, so I made this: https://github.com/Eric-Mendes/dictf It can be especially useful for filtering huge dicts before turning into a