tungwaiyip.info

home

about me

links

my software

Media

Yucatán Photos

St Lucia Photos

Photo Album

Videos

Blog

< November 2011 >
SuMoTuWeThFrSa
   1 2 3 4 5
6 7 8 9101112
13141516171819
20212223242526
27282930   

past articles »

Click for San Francisco, California Forecast

San Francisco, USA

 

A Program That Output Itself

Long time ago my schoolmate pose a challenge, write a program those output is itself. I take on the challenge think I'm fairly good in programming and mathematics. But I can never get it right and this problem haunted me for many years.

def rep(template):
    print template + 'rep(' + '"'*3 + template + '"'*3 + ")"

rep("""def rep(template):
    print template + 'rep(' + '"'*3 + template + '"'*3 + ")"

""")

Now that I'm reading Gödel, Escher, Bach I finally beginning to learn the technique. I am really happy to finally successfully written the program that output itself in Python above!

2011.11.17 [] - comments

 

 

blog comments powered by Disqus

past articles »

 

BBC News

 

New York shuts down for blizzard (27 Jan 2015)

 

Greece debt repayment 'unrealistic' (27 Jan 2015)

 

Argentina disbands intelligence body (27 Jan 2015)

 

Facebook suffers widespread outage (27 Jan 2015)

 

FBI cracks 'Russian spy ring' (26 Jan 2015)

 

South Korea swimmer fails dope test (27 Jan 2015)

 

Islamic State 'driven out of Kobane' (26 Jan 2015)

 

Litvinenko 'killed on third attempt' (26 Jan 2015)

 

Fidel Castro reacts to US-Cuba thaw (27 Jan 2015)

 

Oxfam seeks post-Ebola Marshall Plan (27 Jan 2015)

more »

 

Slashdot News for nerds, stuff that matters

 

Ubisoft Revokes Digital Keys For Games Purchased Via Unauthorised Retailers (2015-01-27T01:22:00Z)

 

Comcast Ghost-Writes Politician's Letters To Support Time Warner Mega-Merger (2015-01-27T00:40:00Z)

 

Windows 10 IE With Spartan Engine Performance Vs. Chrome and Firefox (2015-01-26T23:57:00Z)

 

Police Organization Wants Cop-Spotting Dropped From Waze App (2015-01-26T23:14:00Z)

 

Getting Charged Up Over Chargers at CES (Video) (2015-01-26T22:33:00Z)

 

Plan C: The Cold War Plan Which Would Have Brought the US Under Martial Law (2015-01-26T21:41:00Z)

 

NVIDIA GTX 970 Specifications Corrected, Memory Pools Explained (2015-01-26T20:57:00Z)

 

Virgin Galactic Dumps Scaled Composites For Spaceship Two (2015-01-26T20:13:00Z)

more »

 

TechPsychic Tech Rumors and Invented News

more »

 

SF Gate

 

Bay Area News (7 Jan 2012)

 

City Insider (11 Feb 2012)

 

Crime Scene (13 Feb 2012)

 

C.W Newius Column (10 Jan 2012)

 

C.W. Nevius Blog (11 Feb 2012)

 

Education News (10 Jan 2012)

 

KALW (11 Feb 2012)

 

Matier and Ross Blog (11 Feb 2012)

 

Bloomberg Briefing, Jan. 27 (26 Jan 2015)

 

Trading stock in private startups finally comes of age (26 Jan 2015)

 

Sling TV works for cord cutters, but won’t cut it for cable fans (26 Jan 2015)

 

Winklevoss twins seek to create regulated bitcoin exchange (25 Jan 2015)

 

Ship traffic, Jan. 26 (25 Jan 2015)

 

Great compact cameras for advanced photographers (25 Jan 2015)

more »

 

Asia Times Online

 

Obama insists he's on course in Yemen (Mon 26 Jan 2015 11:00:00 GMT)

 

The Saudi palace coup (Mon 26 Jan 2015 11:00:00 GMT)

 

Blair turned deaf ear to warnings (Mon 26 Jan 2015 11:00:00 GMT)

 

Why the Teesta matters (Mon 26 Jan 2015 11:00:00 GMT)

 

The rich get richer (Mon 26 Jan 2015 11:00:00 GMT)

 

CREDIT BUBBLE BULLETIN Crisis as you sleep (Mon 26 Jan 2015 11:00:00 GMT)

more »

 


Site feed Updated: 2015-Jan-27 00:00