Why not 3.__class__ ?

James_Althoff at i2.com James_Althoff at i2.com
Wed Oct 10 13:40:55 EDT 2001


Yukihiro Matsumoto wrote:
<snip>
>I'm not sure Python needs something like 3.method.  Python's
>integers have far fewer methods than Ruby (because it uses
>functional style).  And it doesn't have idioms like
>
>  100.times {|i|
>    puts i
>  }
>
>So (3).method is enough for Python.

Agreed.  Invoking methods on literals (like integers) is quite nice when
you have methods that take unnamed, in-place, code blocks as arguments as
is possible in Ruby (example above) and Smalltalk.

Obviates the need for unfortunate idioms like "for i in range(100):" -- or
should we make that "xrange"? ;-).

Jim





More information about the Python-list mailing list