Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
7a8c43ee
Commit
7a8c43ee
authored
Sep 11, 2004
by
Johannes Gijsbers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add 'if __name__ == "__main__":' to files already as a usable as a module.
parent
9324526a
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
29 additions
and
18 deletions
+29
-18
Demo/scripts/eqfix.py
Demo/scripts/eqfix.py
+2
-2
Demo/scripts/fact.py
Demo/scripts/fact.py
+2
-1
Demo/scripts/ftpstats.py
Demo/scripts/ftpstats.py
+2
-1
Demo/scripts/lpwatch.py
Demo/scripts/lpwatch.py
+5
-4
Demo/scripts/makedir.py
Demo/scripts/makedir.py
+2
-1
Demo/scripts/markov.py
Demo/scripts/markov.py
+2
-1
Demo/scripts/mboxconvert.py
Demo/scripts/mboxconvert.py
+2
-1
Demo/scripts/mkrcs.py
Demo/scripts/mkrcs.py
+2
-1
Demo/scripts/newslist.py
Demo/scripts/newslist.py
+2
-2
Demo/scripts/pi.py
Demo/scripts/pi.py
+2
-1
Demo/scripts/primes.py
Demo/scripts/primes.py
+2
-1
Demo/scripts/unbirthday.py
Demo/scripts/unbirthday.py
+2
-1
Demo/scripts/update.py
Demo/scripts/update.py
+2
-1
No files found.
Demo/scripts/eqfix.py
View file @
7a8c43ee
...
...
@@ -194,5 +194,5 @@ def fixline(line):
print
line
,
return
line
main
()
if
__name__
==
"__main__"
:
main
()
Demo/scripts/fact.py
View file @
7a8c43ee
...
...
@@ -45,4 +45,5 @@ def main():
except
EOFError
:
pass
main
()
if
__name__
==
"__main__"
:
main
()
Demo/scripts/ftpstats.py
View file @
7a8c43ee
...
...
@@ -141,4 +141,5 @@ def add(dict, key, item):
else:
dict[key] = [item]
main()
if __name__ == "__main__":
main()
Demo/scripts/lpwatch.py
View file @
7a8c43ee
...
...
@@ -103,7 +103,8 @@ def makestatus(name, thisuser):
lines
.
append
(
'lpq exit status %r'
%
(
sts
,))
return
string
.
joinfields
(
lines
,
': '
)
try
:
main
()
except
KeyboardInterrupt
:
pass
if
__name__
==
"__main__"
:
try
:
main
()
except
KeyboardInterrupt
:
pass
Demo/scripts/makedir.py
View file @
7a8c43ee
...
...
@@ -17,4 +17,5 @@ def makedirs(p):
makedirs
(
head
)
os
.
mkdir
(
p
,
0777
)
main
()
if
__name__
==
"__main__"
:
main
()
Demo/scripts/markov.py
View file @
7a8c43ee
...
...
@@ -113,4 +113,5 @@ def tuple(list):
i
=
len
(
list
)
/
2
return
tuple
(
list
[:
i
])
+
tuple
(
list
[
i
:])
test
()
if
__name__
==
"__main__"
:
test
()
Demo/scripts/mboxconvert.py
View file @
7a8c43ee
...
...
@@ -120,4 +120,5 @@ def message(f, delimiter = ''):
print
return
sts
main
()
if
__name__
==
"__main__"
:
main
()
Demo/scripts/mkrcs.py
View file @
7a8c43ee
...
...
@@ -57,4 +57,5 @@ def makedirs(p):
makedirs
(
head
)
os
.
mkdir
(
p
,
0777
)
main
()
if
__name__
==
"__main__"
:
main
()
Demo/scripts/newslist.py
View file @
7a8c43ee
...
...
@@ -359,8 +359,8 @@ def main():
createpage
(
rootpage
,
tree
,
''
)
print
'Done'
main
()
if
__name__
==
"__main__"
:
main
()
# That's all folks
######################################################################
Demo/scripts/pi.py
View file @
7a8c43ee
...
...
@@ -30,4 +30,5 @@ def output(d):
# Flush so the output is seen immediately
sys
.
stdout
.
flush
()
main
()
if
__name__
==
"__main__"
:
main
()
Demo/scripts/primes.py
View file @
7a8c43ee
...
...
@@ -23,4 +23,5 @@ def primes(min, max):
if
i
>=
min
:
print
i
i
=
i
+
2
main
()
if
__name__
==
"__main__"
:
main
()
Demo/scripts/unbirthday.py
View file @
7a8c43ee
...
...
@@ -103,4 +103,5 @@ def mkdate((year, month, day)):
days
=
days
+
day
return
days
main
()
if
__name__
==
"__main__"
:
main
()
Demo/scripts/update.py
View file @
7a8c43ee
...
...
@@ -88,4 +88,5 @@ def main():
curfile
=
FileObj
(
filename
)
curfile
.
process
(
lineno
,
line
[
n
:])
main
()
if
__name__
==
"__main__"
:
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment