program to generate data helpful in finding duplicate large files

Steven D'Aprano steve+comp.lang.python at
Sat Sep 20 01:33:15 CEST 2014

Chris Angelico wrote:

> On Fri, Sep 19, 2014 at 9:04 PM, Steven D'Aprano
> <steve+comp.lang.python at> wrote:
>>> Hmm, you sure exit won't work?
>> In the interactive interpreter, exit is bound to a special helper object:
>> py> exit
>> Use exit() or Ctrl-D (i.e. EOF) to exit
>> Otherwise, you'll get NameError.
> It's not the interactive interpreter alone. I tried it in a script
> before posting.

Well I'll be mogadored.

Serves me right for not testing before posting.

> I've no idea how far back to go before it comes up with a NameError.
> However, this is provided (as is made clear by the type lines) by
>, and so can be disabled. But with default settings, it is
> possible to use exit(1) to set your return value.

It's a bad idea to rely on features added to, since they aren't
necessarily going to be available at all sites or in all implementations:

steve at orac:/home/steve$ ipy
IronPython 2.6 Beta 2 DEBUG ( on .NET 2.0.50727.1433
Type "help", "copyright", "credits" or "license" for more information.
>>> exit(2)
steve at orac:/home/steve$

Bugger me, I'm going home!


More information about the Python-list mailing list