I have this 'code' which I wrote as new kind of art form, both as story and code.
As program it is little stupid in way of expressing things, because it is writen thinking of human who reads the code. It is supposed to be impressive in that it is quite understandable at least for me. Now I would like you to shoot it down for any mistakes in style and I would like to hear from you newbies and pros if it is really as clear than I feel like. Additionally it realy works as program doing things it talks about as story, considering the sending update to server is unimplemented.
# Save as 'why_python.py' # Important info for all programmers! from __future__ import print_function try: input = raw_input except: pass import this from ysisoft.com import joy_of_programming, Python newline, tab = '\n\t' together = (newline+tab).join def programmer_face(header=None): if header: yield header ## write to below mentioned file your own expreriences with open('experiences of lonely nights of programming.txt') as experience: for bitter_memory in experience: yield bitter_memory.rstrip() no_more = ('frustration', 'crying', 'missing deadline', 'sleeplessness', 'unreadable code') my_python = Python() print(newline + together(programmer_face('Current experience:' ))) python_programmers_face = [ expression for expression in programmer_face() if expression not in no_more] python_programmers_face.extend(joy_of_programming) print('Your expression will become:') print(tab + together(python_programmers_face)) print (''' Do you like to subscribe to Ninesoft guided online courses:''') print (tab + together(my_python.online_courses)) print ('for $9 per module?' + newline) # opening the browser to register or doing something like this ## to be implemented programmer_name = input('Give your name if you want to register:' + newline + tab) if programmer_name: my_python.register_to_course(programmer_name) print(my_python.course_participants) input('Welcome to our course.' if programmer_name in my_python.course_participants else ''' You are not registered yet. Think it over and join our effective and economical courses! Push Enter to finish running the program''')
import urllib2 joy_of_programming = 'peacefulness', 'joy' python_site = 'http://python.ysisoft.com' def _get_from_ysisoft(filename): filename = '/'.join((python_site, filename)) ## print filename # debug return urllib2.urlopen(filename).read().splitlines() class Python(): online_courses = _get_from_ysisoft('onlinecourses.txt') course_participants = _get_from_ysisoft('participants.txt') def register_to_course(self, name): # registration to be implemented success = True if success: self.course_participants.append(name) return success
Empty file named ysisoft/__init__.py