Steven D'Aprano wrote:
> One of the things I liked in Pascal was the "with" keyword. You could
> write something like this:
> 
> with colour do begin
> red := 0; blue := 255; green := 0;
> end;
> 
> instead of:
> 
> colour.red := 0; colour.blue := 255; colour.green := 0;
> 
> Okay, so maybe it is more of a feature than a trick, but I miss it and it
> would be nice to have in Python.
> 

With PEP343 (I guess in Python 2.5), you will be able to do something like:
with renamed(colour) as c:
     c.red = 0; c.blue = 255; c.green = 0

I think however it is bad.  Better solutions to me would be:

colour.setRgb(0, 255, 0)

or

c = myVeryLongNameColour
c.red = 0; c.blue = 255; c.green = 0

Regards,
Nicolas

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to