[Python-Dev] Proposed changes to PEP 343 (original) (raw)

Fredrik Lundh fredrik at pythonware.com
Fri Oct 7 18:12:31 CEST 2005


Nick Coghlan wrote:

That's not what the decorator is for - it's there to turn the generator used to implement the with method into a context manager, rather than saying anything about decimal.Context as a whole.

possibly, but using a decorated with method doesn't make much sense if the purpose isn't to turn the class into something that can be used with the "with" statement.

However, requiring a decorator to get a slot to work right looks pretty ugly to me, too.

the whole concept might be perfectly fine on the "this construct corre- sponds to this code" level, but if you immediately end up with things that are not what they seem, and names that don't mean what the say, either the design or the description of it needs work.

("yes, I know you can use this class to manage the context, but it's not really a context manager, because it's that method that's a manager, not the class itself. yes, all the information that belongs to the context are managed by the class, but that doesn't make... oh, shut up and read the PEP")



More information about the Python-Dev mailing list