[Patches] [ python-Patches-870286 ] make Demo/scripts/primes.py usable as a module

SourceForge.net noreply at sourceforge.net
Sun Jan 4 04:18:52 EST 2004


Patches item #870286, was opened at 2004-01-04 10:18
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=870286&group_id=5470

Category: Demos and tools
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Gerrit Holl (gerrit)
Assigned to: Nobody/Anonymous (nobody)
Summary: make Demo/scripts/primes.py usable as a module

Initial Comment:
I wanted to find all primes between 1985 and 2005, and
found out that Demo/scripts/primes.py is not usable as
a module, because it unconditionally executes main().
This patch adds a 'if __name__ == "__main__"' block
around the execution of the main() function, so that
one can simply import primes and use
primes.primes(1985, 2005) in order to achieve what I
wanted to achieve.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=870286&group_id=5470



More information about the Patches mailing list