Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
Python 2.4: Why only assignments to None are forbiden?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="John Roth, post: 1789417"] As Ian points out in another response, there's been some discussion about making a fairly large subset of the builtins name space immutable, and also to disallow shadowing of builtins with identical names in module scope. The main reason for this is performance optimization. Right now, the len() function, for example, requires a lookup and two (!) function evaluations. If the compiler could trust that len() was always the function in the builtins, then it could compile a direct call to the __len__() function on the object, at a savings of the lookup and one function call. There is a considerable savings projected over the entire name builtin name space. There's always a tension between protecting people against common errors and keeping the language as flexible and dynamic as possible. I'd prefer that the editors and IDEs take up the slack. For example, I found that JEdit colorized builtins differently from ordinary names. This pointed out a few bad habits I'd fallen into, without taking away the option of overriding something when I really wanted it. In any case, it won't happen in 2.4.x. That kind of change will wait for a full point release: 2.5 or later. John Roth [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
Python 2.4: Why only assignments to None are forbiden?
Top