Entry
JaPy - Just another Python hacker
Jul 5th, 2000 10:01
Nathan Wallace, Hans Nowak, Snippet 181, Andrew Dalke
"""
Packages: miscellaneous.fun
"""
"""
Given the continuing "Not to start a language war" war^H^H^H
discussion, I have composed a series of what I will call "JAPy" for our
beloved Perl bretheren who worry about our straight-laced language
<wink>.
"""
print "Just another Pythoneer"
print "Just", "another", "Pythoneer"
print '''%s %s %s''' % ("Just", "another", "Pythoneer")
print '%(j)s %(a)s %(py)s' % { "j": "Just", "a": "another", \
"pl": "Perl Hacker", "py": "Pythoneer", "c": "C Coder", \
"f": "Fortran Freak", "turtle" : "Logo Lover" }
import sys
sys.stdout.write("Just another Pythoneer\n")
import string
x = ['r','e','e','n','o','h','t','y','P',' ','r','e','h','t','o', 'n',
'a',' ','t','s','u','J'];
x.reverse()
print string.join(x,'')
import pickle
print pickle.loads("S'Just another Pythoneer'\012p0\012.")
def k(x):
if type(x) == type({}): return x.keys()[0] + k(x.values()[0])
return x
print k({"Just ": {"another ": "Pythoneer"}})
import sys
for c in "Just another Pythoneer\n":
sys.stdout.write(c)
import uu, StringIO
s = StringIO.StringIO()
uu.decode(StringIO.StringIO('begin 666 '+\
'-\01262G5S="!A;F]T:&5R(%!Y=&AO;F5E<@ \012 \012end\012'), s)
print s.getvalue()
x = ["Just", "another", "Pythoneer"]
while x: print x[0], ; x = x[1:]
print
import string, re
a = ["Pythoneer", "extra", "Just", "words", "another", "Hello!"]
m = re.match("(?P<three>\d+).(?P<one>\d+).(?P<two>\d+)", "1A5l2")
print a[m.start("one")], a[m.start("two")], a[m.start("three")]
import mailbox, StringIO
mb = mailbox.UnixMailbox(StringIO.StringIO(
'''From - Fri Oct 30 00:00:00 1998\nFrom: dalke@bioreason.com
Subject: Just another Pythoneer
Newsgroup: comp.lang.python\nHello, world!\n'''))
print mb.next().getheader("Subject")
try:
raise "Just another Pythoneer"
except:
print sys.exc_info()[0]
import random, sys
x = "Just another Pythoneer\n"
while x:
y = random.choice(x)
try: assert(y == x[0]);sys.stdout.write(y)
except AssertionError: pass
else: x = x[1:]
def f(z):
'''Just another Pythoneer (and remember to document your code!)'''
pass
print f.__doc__[:22]
# And finally, my personal favorite!
class Print:
def __call__(self): print
def __getattr__(self, name): print name, ; return self
Print().Just.another.Pythoneer()
"""
Okay, that's where I end. You can tell I haven't been obscuring Python
much -- not a lambda in sight :)
"""