What's better about Ruby than Python?

Alex Martelli aleax at aleax.it
Thu Aug 21 09:07:09 CEST 2003


Dave Benjamin wrote:

> "Alex Martelli" <aleaxit at yahoo.com> wrote in message
> news:bht3bq02v9p at enews3.newsguy.com...
>> Thus, the direct Python equivalent might be
>>
>> import __builtins__
>> __builtins__.len = someotherfunction
>>
>> and THAT usage is very specifically warned against e.g. in
>> "Python in a Nutshell" -- you CAN do it but SHOULDN'T (again, one
>> can hope to eventually see it "officially" deprecated...!).
> 
> I agree with your position, more or less, but I am curious - how far do
> you think this deprecation should go? Just changing a function in
> __builtins__? Changing a function in any module? Or changing *anything*
> about a module from the outside?

Good question!  I don't have any preset answers yet.  We definitely do
want to impose those restrictions that have "multiple" benefits, i.e.
that both let speed increase (by allowing the compiler to 'inline' the
calls to built-in functions, once it does know they're built-ins) AND
encourage correctness -- but we don't want to cripple ordinary useful
usage, particularly not when the benefits are uncertain.  Where the
line should consequently be drawn is not 100% obvious -- which is in
part why nothing about this ended up in Python 2.3, but rather it's all
scheduled for consideration in 2.4.


Alex





More information about the Python-list mailing list