On 2012-09-17, Emile van Sebille <em...@fenx.com> wrote: > > Be sure you don't at some point depend on _ having a specific value > however, as return values of functions are given the _ name in the > absense of a designated label for the returned value: > > ActivePython 2.6.6.15 (ActiveState Software Inc.) based on > Python 2.6.6 (r266:84292, Aug 24 2010, 16:01:11) [MSC v.1500 32 bit > (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> def test(): return True > ... > >>> _ > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > NameError: name '_' is not defined > >>> test() > True > >>> _ > True > >>>
This only happens as a convenience in interactive mode. In scripts or modules the _ identifier has no significance except for the convention that it is a value you don't care about. $ cat tmp.py def test(): return True test() _ $ python tmp.py Traceback (most recent call last): File "tmp.py", line 3, in <module> _ NameError: name '_' is not defined Oscar _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor