Hi all,
As a newly converted Python lover, I am impressed at how concise Python code
actually is. But really... how concise can it GET?
As an experiment to find out the very limits of Python, I'm generously
offering a free smiley as well as my utmost and sincere admiration to
whoever can come up with the shortest python module which can print itself
(no file reading allowed).
I tried:
print "print"
But found out I got it wrong when it just displayed:
print
Duh... (I thought). So I tried:
print "print \"print\""
But I was stunned to find that this just printed:
print "print"
Hang on, this could last forever, like the "GNU" thingy! I'm sure you can
do better than that!
BTW, maybe this is a well-known problem. Anybody heard of it before? Looks
like some problem out of "Goedel, Escher, Bach" (Hofstadter), although I
frankly never got to the end of that book (something in it got you back to
chapter one just when you thought you had reached chapter two)...
Maybe we should try to do the same with C, Java, Lisp, Smalltalk, Prolog...
and check the size difference. How fun!
I smile in your general direction,
Aurélien
ps: hope this sort of post is allowed in this newsgroup... maybe there's a
geek.lang.python newsgroup somewhere which would be more appropriate? 9 1961
Aaaaaaand we have WINNER !!!
I guess the rules of my little competition should lead me to sending my
smiley to Sean B. Palmer but I think you fully deserve it!
Picasso once said something like "Good Designers Copy, Great Designers
Steal".
I guess the same should be said about programmers!
So here it is, the prize you've all been waiting for, your very own 22 karat
smiley:
:-)
Amazingly valuable, as you can see (won't be too many people answering my
quizzes next time around).
Thanks!
Aurélien
"David Eppstein" <ep******@ics.uci.edu> a écrit dans le message de
news:ep****************************@news.service.u ci.edu... In article <bd**********@biggoron.nerim.net>, "Aurélien Géron" <ag****@HOHOHOHOvideotron.ca> wrote:
BTW, maybe this is a well-known problem.
Maybe... http://www.google.com/search?q=python+quine
-- David Eppstein http://www.ics.uci.edu/~eppstein/ Univ. of California, Irvine, School of Information & Computer Science
Hey, I just found this in "A page about quines" at http://www.eleves.ens.fr:8080/home/m...ers/quine.html
"I also dedicate this page to Douglas R. Hofstadter, who coined the name (in
his justly famous book Gödel, Escher, Bach) and who so clearly explained
quines' importance and their relation with Gödel's incompleteness theorem."
Amazing, I really should have finished this book after all ! ;-)
Cheers,
Aurélien
"David Eppstein" <ep******@ics.uci.edu> a écrit dans le message de
news:ep****************************@news.service.u ci.edu... In article <bd**********@biggoron.nerim.net>, "Aurélien Géron" <ag****@HOHOHOHOvideotron.ca> wrote:
BTW, maybe this is a well-known problem.
Maybe... http://www.google.com/search?q=python+quine
-- David Eppstein http://www.ics.uci.edu/~eppstein/ Univ. of California, Irvine, School of Information & Computer Science
Thanks !
"Sean Ross" <sr***@connectmail.carleton.ca> a écrit dans le message de
news:A6*******************@news20.bellglobal.com.. . You may find this interesting: http://www.nyx.net/~gthompso/quine.htm
> As an experiment to find out the very limits of Python, I'm
generously offering a free smiley as well as my utmost and sincere admiration
to whoever can come up with the shortest python module which can print
itself (no file reading allowed).
There was a thread on this several years ago in which I participated.
Something like Shortest Self-Reproducing Programs. Should be findable
through Google.
Terry J. Reedy
David Eppstein <ep******@ics.uci.edu> wrote: In article <bd**********@biggoron.nerim.net>, "Aurélien Géron" <ag****@HOHOHOHOvideotron.ca> wrote:
BTW, maybe this is a well-known problem.
Maybe... http://www.google.com/search?q=python+quine
-- David Eppstein http://www.ics.uci.edu/~eppstein/ Univ. of California, Irvine, School of Information & Computer Science
I guess it depends on how you define "shortest possible", but observe
the following:
bash-2.05b$ cp /dev/null zero.py
bash-2.05b$ python zero.py > zero2.py
bash-2.05b$ cmp zero.py zero2.py
I therefore submit that an empty file is the shortest possible Python
program which reproduces itself on output.
Thanks Terry !
Apparently this is more like the third or fourth instance of this
discussion!!!
Check out: http://groups.google.com/groups?q=se....lang.python.*
If this link does not work, go to: http://groups.google.com
and search "self replicating group:comp.lang.python.*"
I should have lived in the stone age, when people could actually be the
first ones to discover something at all.
Nothing is original anymore. Even "Nothing is original anymore" gives 150
hits on Google.
How sad. How pathetic.
Hey wait! Did anyone ever try to find english language quines? "Repeat this
sentence" is my first shot at it. Maybe one can go shorter like "Repeat
this". Or something like "Whazaaa" usually triggers repetition. While
you're at it, "Hi" seems pretty efficient. Most certainly a world record.
Apparently those quines don't appear in G. Thompson's (excellent) list of
quines: http://www.nyx.net/~gthompso/quine.htm . Maybe I should submit them!
;-)
Aurélien
"Terry Reedy" <tj*****@udel.edu> a écrit dans le message de
news:e6********************@comcast.com... As an experiment to find out the very limits of Python, I'm generously offering a free smiley as well as my utmost and sincere admiration to whoever can come up with the shortest python module which can print itself (no file reading allowed).
There was a thread on this several years ago in which I participated. Something like Shortest Self-Reproducing Programs. Should be findable through Google.
Terry J. Reedy
Argh !
You got me.
After deliberation, the jury decides that you deserve a smiley too.
;-)
Congratulations !
Aurélien
"Roy Smith" <ro*@panix.com> a écrit dans le message de
news:bd**********@panix2.panix.com... David Eppstein <ep******@ics.uci.edu> wrote:In article <bd**********@biggoron.nerim.net>, "Aurélien Géron" <ag****@HOHOHOHOvideotron.ca> wrote:
BTW, maybe this is a well-known problem.
Maybe... http://www.google.com/search?q=python+quine
-- David Eppstein http://www.ics.uci.edu/~eppstein/ Univ. of California, Irvine, School of Information & Computer Science
I guess it depends on how you define "shortest possible", but observe the following:
bash-2.05b$ cp /dev/null zero.py bash-2.05b$ python zero.py > zero2.py bash-2.05b$ cmp zero.py zero2.py
I therefore submit that an empty file is the shortest possible Python program which reproduces itself on output. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Joan MacEachern |
last post by:
Sun Microsystems, Inc., Hutchison 3G UK Limited, Symbian,
Motorola and Macromedia Flash Player have partnered to
launch a developer competition for the Motorola A920 video
mobile. Developers are...
|
by: James Cameron |
last post by:
Hi I'm developing a program and the client is worried about future
reuse of the code. Say 5, 10, 15 years down the road. This will be a
major factor in selecting the development language. Any...
|
by: Sabine Oebbecke |
last post by:
Hi there,
Need some help again ...
I have a continuous form which shows the attendees of a competition as
per their placing in the competition. So, the first record is the
winner, the second...
|
by: YASER WAHEED |
last post by:
I have found few days ago that .NET dll can be reversed to view all source
code.
I have used Dotfuscator but it only renames variables etc.
I want to hide code.
Please reply with some...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |