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

 

Many feared dead in Libya sinkings (27 Aug 2015)

 

Victim's father urges US gun reform (27 Aug 2015)

 

Arsenal face Bayern in group stage (27 Aug 2015)

 

Grim find in Austria migrant lorry (27 Aug 2015)

 

Poles warned off 'gold train' hunt (27 Aug 2015)

 

UK jihadist 'killed in drone strike' (27 Aug 2015)

 

Knut polar bear death riddle solved (27 Aug 2015)

 

Obama: New Orleans 'moving forward' (27 Aug 2015)

 

Bolt beats Gatlin to complete double (27 Aug 2015)

 

Saudi Arabia sees Mers deaths surge (27 Aug 2015)

more »

 

Slashdot News for nerds, stuff that matters

 

Most Healthcare Managers Admit Their IT Systems Have Been Compromised (2015-08-27T23:55:00+00:00)

 

Learn FPGAs With a Board and Open Source Tools (2015-08-27T23:11:00+00:00)

 

Canadian Nuclear Accident Study Puts Risks Into Perspective (2015-08-27T22:28:00+00:00)

 

Google May Try To Recruit You For a Job Based On Your Search Queries (2015-08-27T21:46:00+00:00)

 

NASA Scientists Paint Stark Picture of Accelerating Sea Level Rise (2015-08-27T21:05:00+00:00)

 

Former Apple CEO Creates an iPhone Competitor (2015-08-27T20:22:00+00:00)

 

A "Public Health" Approach To Internet of Things Security (2015-08-27T19:39:00+00:00)

 

Docs: Responding To Katrina, FBI Made Cell Phone Surveillance Its Priority (2015-08-27T19:01:00+00:00)

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)

 

Solyndra lied to federal government about sales, report alleges (27 Aug 2015)

 

White House ‘master of disaster’ to head Airbnb’s policy team (27 Aug 2015)

 

Apple is behind secretive Sept. 9 event at Bill Graham Auditorium (27 Aug 2015)

 

Can former Apple CEO Sculley break into cheap smartphone market? (27 Aug 2015)

 

Daily Briefing, Aug. 27 (26 Aug 2015)

 

Business News Roundup, Aug. 27 (26 Aug 2015)

more »

 

Asia Times Online

 

China ramps up charges against Zhou (Fri 20 Mar 2015 11:00:00 GMT)

 

'100 dead' in Myanmar fighting (Fri 20 Mar 2015 11:00:00 GMT)

 

Tunisian president vows no mercy (Fri 20 Mar 2015 11:00:00 GMT)

 

SPENGLER Israel's 'referendum' on 'two-state solution' (Fri 20 Mar 2015 11:00:00 GMT)

 

Russia, S Ossetia sign 'integration' pact (Fri 20 Mar 2015 11:00:00 GMT)

 

US military plunges Aquino into crisis (Fri 20 Mar 2015 11:00:00 GMT)

 

Rahmon celebrates Tajik democracy (Fri 20 Mar 2015 11:00:00 GMT)

 

THE BEAR'S LAIR Being old in 2040 no fun (Fri 20 Mar 2015 11:00:00 GMT)

 

China grant boosts Nepal ties (Fri 20 Mar 2015 11:00:00 GMT)

more »

 


Site feed Updated: 2015-Aug-27 17:00