J2 0-2-6 is available

Doug Holton insert at spam.here
Tue Aug 24 22:22:21 EDT 2004


Robert Brewer wrote:

> Steven Bethard wrote:
> 
>>Actually, there's an interesting argument that the "with" for 
>>decorators and 
>>the "with" above can be thought of in similar terms:
>>
>>http://mail.python.org/pipermail/python-list/2004-August/235993.html
>>
>>I don't know if I agree with it, but I think I'm at least 
>>convinced they don't 
>>have to mean *completely* different things.
> 
> 
> FYI, I'm linking to that in the next document version later tonight.
> 

Your example from the mailing list (copied below) doesn't make sense if 
you mix and match the beginning period, and it is bizaar to have "with:" 
mean "affects a future function" while "with x:" means "within the x 
namespace", something very different.  I would not recommend using the 
same keyword for two entirely different transformations, one which 
solely affects functions defined in the future and the other which is a 
regular code block but without having to repeat the same prefix (like 
self) over and over.

with:
     classmethod
     .author = "François Pinard"
def foo(cls):
     pass

def bar():
     pass
with bar:
     staticmethod
     .version = "0.2.4"

So if I say:
with self:
     init
     .version = 3
Is that supposed to mean:
init(self)
self.version = 3?
So not using a period suddenly means "pass the previous or future 
defined variable or function to me and I'll do something to it now or in 
the future"?



More information about the Python-list mailing list