On Apr 2, 2008, at 11:36 AM, Guido van Rossum wrote:
> I predict that list(x.keys()) will remain a rarity (except in
> code converted by 2to3). However sorted(x.keys()) will become a
> well-known idiom, and it's a much better one than the old idiom
>  keys = x.keys()
>  keys.sort()
> which doesn't led itself easily to use in an expression.


Is there a particular rationale describing the use of function calls  
vs. object properties in core Python?

When I see a function call required for something that could be  
conveniently expressed as a property, it generally tells me "I'm  
computing something. It might be expensive, and if you call me again,  
I'll have to recompute."

This made sense with .keys() in 2.x, but is not true in 3.0. Is there  
a good reason besides compatibility to keep the parentheses there?

     sorted(x.keys)

has a nice ring to it. Cheers,

--
Ivan Krstić <[EMAIL PROTECTED]> | http://radian.org

_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to