Op 19-08-13 17:04, Chris Angelico schreef:
On Mon, Aug 19, 2013 at 3:55 PM, Antoon Pardon
<antoon.par...@rece.vub.ac.be> wrote:
Pity enough they chose a
way that didn't allow programmers to protect names they thought
important enough to do so too.
As of Python 3, we can redefine something that used to be a keyword,
which is even stronger than a constant.
def print(*args,print=print,**kw):
print("##",*args,**kw)
What easier way to tag all your print calls? And this is why it helps
to have nothing technically constant. You should be able to do the
same with anything, without having to go and edit someone else's code
to remove the 'const' keyword.
But what you are showing here is shadowing, not redefintion and you can
do that even if the shadowed name would be a constant.
--
Antoon Pardon
--
http://mail.python.org/mailman/listinfo/python-list