niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Programming » python
Note on PEP 299
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
Author Message
bearophileHUGS@lycos.com
*nix forums Guru Wannabe


Joined: 19 Feb 2005
Posts: 198

PostPosted: Thu Jul 20, 2006 3:21 pm    Post subject: Note on PEP 299 Reply with quote

I don't like much the syntax of:
if __name__ == '__main__':

Some time ago I have read this PEP:
http://www.python.org/dev/peps/pep-0299/

And why it was refused:
http://mail.python.org/pipermail/python-dev/2006-March/062955.html

I think the name of the standard main function may be just main(), so
there isn't the problem with the import (and *maybe* the problem with
multiple Python versions can be ignored with Python 3.0).

If a module contains the main(), the main() is executed when the module
is run alone. Otherwise you can import the module, with the main()
function managed as a normal function.

Bye,
bearophile
Back to top
Terry Reedy
*nix forums Guru


Joined: 21 Feb 2005
Posts: 544

PostPosted: Fri Jul 21, 2006 4:48 am    Post subject: Re: Note on PEP 299 Reply with quote

<bearophileHUGS@lycos.com> wrote in message
news:1153408904.879310.139640@m79g2000cwm.googlegroups.com...
Quote:
I don't like much the syntax of:
if __name__ == '__main__':

Some time ago I have read this PEP:
http://www.python.org/dev/peps/pep-0299/

And why it was refused:
http://mail.python.org/pipermail/python-dev/2006-March/062955.html

I think the name of the standard main function may be just main(), so
there isn't the problem with the import (and *maybe* the problem with
multiple Python versions can be ignored with Python 3.0).

This idea, and a couple of variations, have come up in the Py3 discussions,
so something might be tried.

tjr
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
The time now is Sun Nov 23, 2008 2:35 pm | All times are GMT
navigation Forum index » Programming » python
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Metalink doc Note 160451.1 rama rao Server 25 Fri Jul 07, 2006 4:03 pm
No new posts Note to new-comers Frederick Gotham C 12 Fri Jul 07, 2006 2:51 pm
No new posts comp.lang.c FAQs - a note of thanks neutron*star C 10 Sat Jul 01, 2006 11:36 am
No new posts Can SAX locate a single note deep within an XML tree? bissatch@yahoo.co.uk PHP 1 Mon Jun 19, 2006 9:52 pm
No new posts Make Note - debian-user@lists.debian.org Library Debian 0 Sat Jun 10, 2006 1:20 pm

Mortgages | Debt Consolidation | Credit Cards UK | Personal Loans | Flights to Cairo
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1314s ][ Queries: 16 (0.0665s) ][ GZIP on - Debug on ]