Dave Angel <d...@davea.name> writes:

> True, but in this code, the function is trying to both use the global
> value, but also a local that deliberately has the same name, but a
> different meaning and "value". The CPython compiler doesn't make this
> easy, and I think the globals() technique is unnecessarily obscure, as
> is the default-argument trick.

I disagree. The language makes it difficult, and it *should* be
difficult to do what you describe.

The tricks to achieve it are obscure and ugly, which is a good thing
IMO: they're a code smell that the design of the code needs changing.

Or, in brief: they're not unnecessarily obscure, they're as obscure as
they need to be.

> If a function knows of the presence of a global, it's not asking too
> much for it to not re-use the same name in local scope.

Yes. 

-- 
 \     “Airports are ugly. Some are very ugly. Some attain a degree of |
  `\        ugliness that can only be the result of a special effort.” |
_o__)             —Douglas Adams, _The Long Dark Tea-Time Of The Soul_ |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to