Code hosting services
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 I know this isn't specific to Python, but it is somewhat on topic. Way back when I had a simple project, SourceForge was by far the most prominent place to host (and it still is, though to a lesser extent now). SourceForge is still an option for me, but I know there are many other hosts out there. The problem is I don't which one what the pros and cons of each are. Wikipedia has some information, but it's generally objective. This is useful, but it's not enough to narrow my choices down to one or two. What can you guys recommend? BTW, I'll likely be sticking with Mercurial for revision control. TortoiseHg is a wonderful tool set and I managed to get MercurialEclipse working well. - -- CPython 3.2.1 | Windows NT 6.1.7601.17592 | Thunderbird 5.0 PGP/GPG Public Key ID: 0xF88E034060A78FCB -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAwAGBQJOHUE+AAoJEPiOA0Bgp4/LvRUIAOX4XcC2+am9uFzBH9BpYh4l epHZptB3qrNd0QV+TWXuOG6V6tOESsoQaECZYplykzD5/fxsuSgisv62mAEY+afw gqJbsVka1XuWJQTUYBVFcA5ytL3v07SYcQ1m9EsAkgBejRD7nuXuWBB2bNUcPhMY s3IfyVFZ82utxEnbWxGo6mK4NPXnhMXdJgLbDPzg3Xg2KjI29eJLHQsKv1GjnWJC 5tYxNpVqPaeYNzGxjWtwCuDxzGuGnpWWYhSx8dUhgQbZKlR9SGhfcs9onsIroM2j z9B8cuaQe8GxbU0vneMtiLGJt8+hsCpuFTAIrMTn6AGeK7He06LXYU49skg6Bxw= =5uDV -END PGP SIGNATURE- -- http://mail.python.org/mailman/listinfo/python-list
Re: Installing PyPy alongside Python 2.7 on Windows?
You can just extract the windows pypy 1.5 distribution to any folder and run "pypy.exe" from there as if it was called "python.exe". This is how I have been using it. In fact, pypy has been the default python for my portable eclipse for a good while now. -- http://mail.python.org/mailman/listinfo/python-list
Re: An interesting beginner question: why we need colon at all in the python language?
Thomas Jollans wrote: > Coincidentally, Guido wrote this blog post just last week, without which > I'd be just as much at a loss as you: > > http://python-history.blogspot.com/2011/07/karin-dewar-indentation-an... It's also part of the Python FAQ: http://docs.python.org/faq/design.html#why-are-colons-required-for-the-if-while-def-class-statements -- http://mail.python.org/mailman/listinfo/python-list
Re: Virtual functions are virtually invisible!
rantingrick wrote: > i cannot force others If only you really understood that. -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp refactoring puzzle
On Jul 13, 9:39 am, Terry Reedy wrote: > On 7/12/2011 2:23 PM, gene heskett wrote: > > > Now, I hate to mention it Terry, but your clock seems to be about 126 > > months behind the rest of the world. > > Please do not hate to be helpful. Ha Ha. Cute one. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp refactoring puzzle
On 7/12/2011 2:23 PM, gene heskett wrote: Now, I hate to mention it Terry, but your clock seems to be about 126 months behind the rest of the world. Please do not hate to be helpful. It was a bad malfunction perhaps due to a run-down battery on a machine turned off for two weeks. I will keep watch to see if it happens again overnight. Does your system not run ntpd by default? Is that *nix or Windows? My XP system only checks the net time automatically once a week and refused to update at first on request because the dates did not match. Typically windows stupidity. If I click 'Update from internet', it should believe that I really mean it. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Enhanced dir() function
On Wed, Jul 13, 2011 at 7:46 AM, rantingrick wrote: [x for x in dir([]) if not x.startswith('_')] > ['append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', > 'reverse', 'sort'] > > Because we have plenty of room for args in this function... > dir(verbose=False) > ['append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', > 'reverse', 'sort'] > #define my_dir(o,verbose) verbose?dir(o):[x for x in dir(o) if not x.startswith('_')] And there you are, out of your difficulty at once. Granted, you now have to run your code through cpp, but is that so big a problem? ChrisA (For the sarcasm-impaired: I am NOT advocating this.) -- http://mail.python.org/mailman/listinfo/python-list
Re: Set run vars with each call
On Jul 12, 6:44 pm, Steven D'Aprano wrote: > All the words are in English, but the sentences make no sense :) LOL, impressive powers of mind-reading! Exactly what I needed: import time class Event: epoch=time.time() def doSomething(self, epoch=None): if epoch is None: epoch = self.epoch print(epoch) e = Event() e.doSomething() e.doSomething(123456789) e.epoch = 1310522110.404471 e.doSomething() Thanks for the help! -- Gnarlie http://Gnarlodious.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp refactoring puzzle
In article <4e1cf936.4050...@canterbury.ac.nz>, Gregory Ewing wrote: > Xah Lee wrote: > > they > > don't provide even simple list manipulation functions such as union, > > intersection, and the like. Not in perl, not in python, not in lisps. > > Since 2.5 or so, Python has a built-in set type that > provides these (which is arguably a better place for them > than lists). Set is the best addition to Python since string methods. -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp refactoring puzzle
Xah Lee wrote: they don't provide even simple list manipulation functions such as union, intersection, and the like. Not in perl, not in python, not in lisps. Since 2.5 or so, Python has a built-in set type that provides these (which is arguably a better place for them than lists). -- Greg -- http://mail.python.org/mailman/listinfo/python-list
Re: "Python Wizard," with apologies to The Who
John Keisling wrote: > After too much time coding Python scripts and reading Mark Lutz's > Python books, I was inspired to write the following lyrics. For those > too young to remember, the tune is that of "Pinball Wizard," by The > Who. May it bring you as much joy as it brought me! [...] I wouldn't know a good song parody if it kicked me in the head, but my wife is a (retired) professional musician with a history of writing parodies. She's not impressed by the work of most "filk singers" and supposed parodies, most of which are seventeen kinds of crap... but she gives you full marks. And trust me on this, she does not give compliments lightly. She says you got the rhyming scheme and number of syllables spot on. Technically, "That modeling and sim guy" needs to be slurred to make it fit, "That mod'ling and sim guy", but that's acceptable. (Most parodies get the syllable count wrong -- if a lyric goes dum-de-dum-de-dum, the parody ends up like dum-dum-de-dum-de-dum or dum-de-dum-de.) Have a +1 from me and the missus. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
mrjob v0.2.7 released
What is mrjob? - mrjob is a Python package that helps you write and run Hadoop Streaming jobs. mrjob fully supports Amazon's Elastic MapReduce (EMR) service, which allows you to buy time on a Hadoop cluster on an hourly basis. It also works with your own Hadoop cluster. Some important features: * Run jobs on EMR, your own Hadoop cluster, or locally (for testing). * Write multi-step jobs (one map-reduce step feeds into the next) * Duplicate your production environment inside Hadoop * Upload your source tree and put it in your job's $PYTHONPATH * Run make and other setup scripts * Set environment variables (e.g. $TZ) * Easily install python packages from tarballs (EMR only) * Setup handled transparently by mrjob.conf config file * Automatically interpret error logs from EMR * SSH tunnel to hadoop job tracker on EMR * Minimal setup * To run on EMR, set $AWS_ACCESS_KEY_ID and $AWS_SECRET_ACCESS_KEY * To run on your Hadoop cluster, install simplejson and make sure $HADOOP_HOME is set. More info: * Install mrjob: python setup.py install * Documentation: http://packages.python.org/mrjob/ * PyPI: http://pypi.python.org/pypi/mrjob * Development is hosted at github: http://github.com/Yelp/mrjob What's new? - Big thank you to Yelp intern Steve Johnson, who wrote the majority of the code for this release. Wahbeh Qardaji, another Yelp intern, contributed as well, and has been working hard on features for v0.3.0. v0.2.7, 2011-07-12 -- Hooray for interns! * All runner options can be set from the command line (Issue #121) * Including for mrjob.tools.emr.create_job_flow (Issue #142) * New EMR options: * availability_zone (Issue #72) * bootstrap_actions (Issue #69) * enable_emr_debugging (Issue #133) * Read counters from EMR log files (Issue #134) * Clean old files out of S3 with mrjob.tools.emr.s3_tmpwatch (Issue #9) * EMR parses and reports job failure due to steps timing out (Issue #15) * EMR boostrap files are no longer made public on S3 (Issue #70) * mrjob.tools.emr.terminate_idle_job_flows handles custom hadoop streaming jars correctly (Issue #116) * LocalMRJobRunner separates out counters by step (Issue #28) * bootstrap_python_packages works regardless of tarball name (Issue #49) * mrjob always creates temp buckets in the correct AWS region (Issue #64) * Catch abuse of __main__ in jobs (Issue #78) * Added mr_travelling_salesman example -- http://mail.python.org/mailman/listinfo/python-list
Re: Set run vars with each call
Gnarlodious wrote: > Question. Is there a special method or easy way to set default values > with each call to an instance? Any ideas to make it easier? What I > want to do is have a constantly updating set of values which can be > overridden. Just thought there was an easy way to set that up. All the words are in English, but the sentences make no sense :) Seriously, I don't understand what you mean. "Call to an instance"? Do mean treating instances as a callable (like a function), or do you mean calling an arbitrary method? To make an instance itself callable, define a __call__ method. What do you mean, "constantly updating set of values that can be overridden"? Perhaps a simple example might help. The closest thing I can think of, might be: you want to store a data attribute in an instance, and use that if the caller doesn't specify differently. Something like: class Parrot: name = "Polly" def speak(self, name=None): if name is None: name = self.name print("%s wants a cracker!" % name) And in use: >>> p = Parrot() >>> p.speak() Polly wants a cracker! >>> p.speak("Peter") Peter wants a cracker! >>> p.name = "Penelope" >>> p.speak() Penelope wants a cracker! If None is a legitimate value, then you can define your own sentinel to use instead: MISSING = object() # Unique object guaranteed not to be used by the caller. # (Guarantee void on planet Earth.) then replace None by MISSING in the code above. Is this the sort of scenario you are talking about? If not, I'm completely lost. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Wgy isn't there a good RAD Gui tool fo python
On Jul 12, 5:18 pm, rantingrick wrote: > On Jul 12, 1:43 pm, CM wrote: > > > > > One reason there hasn't been much demand for a GUI builder is that, in > > > > many cases, it's just as simpler or simpler to code a GUI by hand. > > > I use a GUI builder because I'd rather click less than > > type more. I just tried that in Boa Constructor; with ~10 > > mouse clicks I produced 964 characters of Python code. > > Remember, it's NOT the length of the code that matters, no, it's the > motion of the "sources" ocean. Did it produce rough seas full of > spaghetti monsters? Or tranquil fjords worth pining over (sadly to > death apparently?)? In my experience, the GUI builder I use creates reasonable code that deals with the GUI in a separate portion of the code. It does not strike me as spaghetti-ish (though it's not perfect). > Also, you MAY have created 964 chars of code with your ten or so > clicks HOWEVER that is just template code. You'll need to set many > attributes for the widgets before they are ready for prime time. Your > "supposed" ten or so click estimate is very naive. It takes MUCH more > to create even a simple GUI, because, we have NOT even discussed logic > yet! Sure. But my point was just that to even get as far as I did (which was just a frame and two unspecified widgets) takes 964+ keystrokes, but only ~10 clicks. So the pacing of keystrokes:clicks is favorable. If I built a small functioning GUI application, it might take 100 clicks and 9,640 keystrokes (very roughly). But it is the same point. > > I would use a sketch-pad and pencil and *then* use the GUI builder. > > But do you really? Your following statements lead me to believe that > you don't. > > > What's nice about a builder is one can move things around > > quickly and see the results in the real application, which > > one can never really see well on a paper sketch. I just meant that though I might start on paper, once it is on the screen I sometimes will shift things around a bit at that point to see how it looks. This is easily done with sizers and a sizer collection manager and an up/down arrow, so it is worth an extra minute to just see how it looks. > 1. GUI builders remove us from the initial "mental design phase" and > temp us to let our inner "click-ity-click" and "drag-ity-drag" child > loose. This inner child likes to play but he hates to plan. Very soon > he has the play room floor (source code) overflowing with toys (code) > arranged in a completely haphazard way. Unlike the child however, > there is no code mommy to spank this bad little boy when he is a > programmer. So he just keeps messing up play room after play room > making a complete fool of himself along the way. > > 2. GUI builders remove us from the source code. When you are playing > "clicky-click" with yourself you could be in the trenches fighting the > spaghetti code monster. Instead you are losing mental focus. Remember, > playing with yourself makes you lazy! I've certainly heard of others who feel that working with only code is "cleaner" for them, mentally speaking. I can understand that. I think it just depends on what one is used to. I don't find the GUI builder disrupts my ability to plan or keep things orderly. In fact, most of my disorder and spaghetti problems have been in the logic side of the applications, the part which the GUI builder doesn't have anything to do with. (That's my own issue to keep working on). > Kevin made the argument earlier that Tkinter (and others) are so easy > to use that they render needing a GUI builder useless -- and he is > correct! But did you know that there are GUI libraries EVEN more > highly abstracted than Tkinter? Oh yes! So your "OMG, this typing and > using my imagination is so difficult" *crap* is really making me > laugh. My attitude is, if I could speak in English to an AI to tell it what I'd like the program to do, I'd do it. Yes, since I can't do that, I inevitably do sometimes enjoy puzzling things out, but only because I have to. > PS: if you don't like to type, programming IS NOT the best career (or > hobby) choice for you. I guess it is not so much that I dislike typing, as I dislike having to switch from visual mode to code mode, remember the keywords and such for the widgets, rather than quickly clicking around. The keystroke count is really just a proxy for that sort of effort. CM -- http://mail.python.org/mailman/listinfo/python-list
Re: How to write a file generator
Am 12.07.2011 16:46 schrieb Billy Mays: I want to make a generator that will return lines from the tail of /var/log/syslog if there are any, but my function is reopening the file each call ... I have another solution: an object which is not an iterator, but an iterable. class Follower(object): def __init__(self, file): self.file = file def __iter__(self): while True: l = self.file.readline() if not l: return yield l if __name__ == '__main__': f = Follower(open("/var/log/messages")) while True: for i in f: print i, print "foo" import time time.sleep(4) Here, you iterate over the object until it is exhausted, but you can iterate again to get the next entries. Thomas -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp refactoring puzzle
Neil Cerutti writes: > What's the rationale for providing them? Are the definitions > obvious for collections that a not sets? The rational is to prove that Xah is dumb. -- __Pascal Bourguignon__ http://www.informatimago.com/ A bad day in () is better than a good day in {}. -- http://mail.python.org/mailman/listinfo/python-list
Re: "Python Wizard," with apologies to The Who
John Keisling wrote: After too much time coding Python scripts and reading Mark Lutz's Python books, I was inspired to write the following lyrics. For those too young to remember, the tune is that of "Pinball Wizard," by The Who. May it bring you as much joy as it brought me! Absolutely hilarious! Thanks! ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list
Installing PyPy alongside Python 2.7 on Windows?
I'd like to evaluate the recent build of PyPy on the project I'm currently working on, but am not sure how best to go about it. So my question is simply - how would I go about installing PyPy alongside Python 2.7 on Windows? In particular, unzipping PyPy and adding it to the PATH is easy enough, but what about getting setuptools and easy_setup working to install various packages for it? Is there a virtualenv-based method I can use here? (And is pip a decent replacement for setuptools on Windows yet?) -- Ben Sizer -- http://mail.python.org/mailman/listinfo/python-list
Re: Enhanced dir() function
On Jul 1, 12:20 pm, Tim Chase wrote: > If it came in as an effortless (i.e. O(1) where I do it once and > never again; not an O(n) where n=the number of times I invoke > Python) default replacement for dir(), I'd reach for it a lot > more readily. I seem to recall there's some environment-var or > magic file-name that gets sourced on every startup. > > I use the list-comp version on a regular basis: I strongly agree with this statement because i prefer the LC myself. HOWEVER i've always lamented the verbosity of dir(). --- Case in Point --- >>> dir([]) ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__delslice__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getslice__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__setslice__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'] --- Do we really need to see all the built in methods EVERY time? I don't, i've had them memorized for years. HOWEVER i do understand the fact that n00bs need to see them every time. So why should old hats need to type this every time... >>> [x for x in dir([]) if not x.startswith('_')] ['append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'] Because we have plenty of room for args in this function... >>> dir(verbose=False) ['append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'] Ahhh, i love it when a plan comes together! -- http://mail.python.org/mailman/listinfo/python-list
Re: Enhanced dir() function
On Jun 30, 11:29 pm, Steven D'Aprano wrote: > The dir() function is designed for interactive use, inspecting objects for > the names of attributes and methods. > > Here is an enhanced version that allows you to pass a glob to filter the > names you see: meh, I have always believed in keeping my namespace squeaky clean so i never have this problem. Modules like Tkinter (where you yourself have supported the global import!) i always import as "tk". I think this IS more a housekeeping issue than a "nail on patch" issue. PS: However pay attention because i have some interesting ideas about "dir culling" in my next post to this thread. -- http://mail.python.org/mailman/listinfo/python-list
Re: Set run vars with each call
Gnarlodious writes: > OK, [the ‘__init__’ method] sets a value at init time. But is there a > similar built-in to run whenever the class instance is called? You can write a ‘__call__’ method which will be called when the instance is called. But I suspect that's still not what you're asking. Maybe it will be quicker to ask: What is it you want to achieve? -- \ “Compulsory unification of opinion achieves only the unanimity | `\of the graveyard.” —Justice Roberts in 319 U.S. 624 (1943) | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: Wgy isn't there a good RAD Gui tool fo python
On Jul 12, 1:43 pm, CM wrote: > > > One reason there hasn't been much demand for a GUI builder is that, in > > > many cases, it's just as simpler or simpler to code a GUI by hand. > > I use a GUI builder because I'd rather click less than > type more. I just tried that in Boa Constructor; with ~10 > mouse clicks I produced 964 characters of Python code. Remember, it's NOT the length of the code that matters, no, it's the motion of the "sources" ocean. Did it produce rough seas full of spaghetti monsters? Or tranquil fjords worth pining over (sadly to death apparently?)? 1. Never judge the quality of code simply by it's length. Because if you do, some folks might suffer from "source envy"! Also, you MAY have created 964 chars of code with your ten or so clicks HOWEVER that is just template code. You'll need to set many attributes for the widgets before they are ready for prime time. Your "supposed" ten or so click estimate is very naive. It takes MUCH more to create even a simple GUI, because, we have NOT even discussed logic yet! > Now, sure, depending on how I wrote the code I could do > better than that, but for me, I just find it more > intuitive and easier to use a GUI to make a GUI. Personal opinions should always be respected, and as such i respect yours but later i would outline my GUI design workflow so pay close attention. > > Often a GUI builder is used as a bad replacement for > > sketch-pad and pencil. > > I would use a sketch-pad and pencil and *then* use the GUI builder. But do you really? Your following statements lead me to believe that you don't. > What's nice about a builder is one can move things around > quickly and see the results in the real application, which > one can never really see well on a paper sketch. I prefer to skip any pencil and paper completely myself. I just use my imagination. UNLESS the GUI is EXTREMELY complicated. For me the design of a GUI starts in my brain. No pencil, no paper, no three hours using Auto Cad GUI designer. Next i start creating widgets and laying them out using geometry managers (in CODE). Finally i run a few tests, make a few changes, and design phase is over. Time for logic. - My argument against GUI builders is two fold. - 1. GUI builders remove us from the initial "mental design phase" and temp us to let our inner "click-ity-click" and "drag-ity-drag" child loose. This inner child likes to play but he hates to plan. Very soon he has the play room floor (source code) overflowing with toys (code) arranged in a completely haphazard way. Unlike the child however, there is no code mommy to spank this bad little boy when he is a programmer. So he just keeps messing up play room after play room making a complete fool of himself along the way. 2. GUI builders remove us from the source code. When you are playing "clicky-click" with yourself you could be in the trenches fighting the spaghetti code monster. Instead you are losing mental focus. Remember, playing with yourself makes you lazy! -- What happens is... you get lost "playing" and fail to keep your mental focus. A programmers metal focus is his most valuable weapon in the fight against the spaghetti code monster. I am a programmer. I love my source code more than i love most people in this world. I do not want to be away from my source. I am jealous of my source! And so too should you be. Kevin made the argument earlier that Tkinter (and others) are so easy to use that they render needing a GUI builder useless -- and he is correct! But did you know that there are GUI libraries EVEN more highly abstracted than Tkinter? Oh yes! So your "OMG, this typing and using my imagination is so difficult" *crap* is really making me laugh. That is my argument people. Opinions may vary. Keep watch for the spaghetti code monster! Cheers folks. PS: if you don't like to type, programming IS NOT the best career (or hobby) choice for you. -- http://mail.python.org/mailman/listinfo/python-list
Re: Enhanced dir() function
Ethan Furman wrote: Tim Chase wrote: If it came in as an effortless (i.e. O(1) where I do it once and never again; not an O(n) where n=the number of times I invoke Python) default replacement for dir(), I'd reach for it a lot more readily. I seem to recall there's some environment-var or magic file-name that gets sourced on every startup. interact.py 8<--- import os, sys sys.ps1 = '--> ' from cookbook.utils import dir # or whereever you keep your copy sys.modules['__builtin__'].dir = dir 8<--- Imagine my amusement when I went to change an environment variable today and found: PYTHONSTARTUP=c:\python25\interact.py ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list
Building Python 2.5.6 on Ubuntu Natty
Hi folks. Has anyone succeeded in building Python 2.5.6 from sources in Ubuntu Natty? I installed all the build dependencies and keep getting running build_ext /usr/include/sqlite3.h: version 3.7.4 Traceback (most recent call last): File "./setup.py", line 1545, in main() File "./setup.py", line 1540, in main 'Lib/smtpd.py'] File "/tmp/Python-2.5.6/Lib/distutils/core.py", line 151, in setup File "/tmp/Python-2.5.6/Lib/distutils/dist.py", line 974, in run_commands File "/tmp/Python-2.5.6/Lib/distutils/dist.py", line 994, in run_command File "/tmp/Python-2.5.6/Lib/distutils/command/build.py", line 112, in run File "/root/Python-2.5.6/Lib/cmd.py", line 333, in run_command del help[cmd] File "/tmp/Python-2.5.6/Lib/distutils/dist.py", line 994, in run_command File "/tmp/Python-2.5.6/Lib/distutils/command/build_ext.py", line 290, in run File "./setup.py", line 97, in build_extensions self.detect_modules() File "./setup.py", line 810, in detect_modules sqlite_libdir = [os.path.abspath(os.path.dirname(sqlite_libfile))] File "/root/Python-2.5.6/Lib/posixpath.py", line 119, in dirname return split(p)[0] File "/root/Python-2.5.6/Lib/posixpath.py", line 77, in split i = p.rfind('/') + 1 AttributeError: 'NoneType' object has no attribute 'rfind' make: *** [sharedmods] Error 1 when I do "make test" and Compiling /opt/python2.5/lib/python2.5/zipfile.py ... make: *** [libinstall] Error 1 when I do "make install" Any ideas? -- Ricardo Bánffy http://www.dieblinkenlights.com http://twitter.com/rbanffy -- http://mail.python.org/mailman/listinfo/python-list
Re: "Python Wizard," with apologies to The Who
> That's pretty funny. I knew what it would be even when I saw the cut-off > subject line, and I am too young to remember it. > > Carl Banks TTTO "[She put the lime in the] Coconut": Brother wrote a database, he finish it on time His sister add requirements, refactor every line She change design in the database, she mix it all up She change design in the database, she mix it all up She change design in the database, she mix it all up She change design in that database, she called the doctor, woke him up, Sayin' "Doctor, now I got to pay my dues, I say, Doctor, to debug away my blues, I say, Doctor, such a big change has to break, I say, Doctor! I must'a made a bug mistake!" "Now let me get this straight, You change the design in the database, mix things all up You change the design in the database, mix it all up, You change the design in the database, mix it all up..." http://c2.com/cgi/wiki?SheChangeDesignInTheDatabase -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp refactoring puzzle
Petter Gustad wrote: > Xah Lee writes: > > > it's funny, in all these supposedly modern high-level langs, they > > don't provide even simple list manipulation functions such as union, > > intersection, and the like. Not in perl, not in python, not in lisps. > > In Common Lisp you have: > > CL-USER> (union '(a b c) '(b c d)) > (A B C D) > CL-USER> (intersection '(a b c) '(b c d)) > (C B) The order was changed. COBOL Lisp is always mindless. * (union '(2 2 3 4) '(7 7 8 9)) (4 3 2 2 7 7 8 9) The right way (MatzLisp): [2,2,3,4] | [7,7,8,9] ==>[2, 3, 4, 7, 8, 9] -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp refactoring puzzle
On 2011-07-12, Petter Gustad wrote: > Xah Lee writes: > >> it's funny, in all these supposedly modern high-level langs, they >> don't provide even simple list manipulation functions such as union, >> intersection, and the like. Not in perl, not in python, not in lisps. > > In Common Lisp you have: > > CL-USER> (union '(a b c) '(b c d)) > (A B C D) > CL-USER> (intersection '(a b c) '(b c d)) > (C B) What's the rationale for providing them? Are the definitions obvious for collections that a not sets? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list
Complete Google Advertising Solutions
TheItValley is a capable web development application, software combination, search engine optimization, E-commerce, E-banking and complete Google advertising solution Organization based in UK main branches office in Sweden, Norway and Pakistan. The Internet is the most efficient and greatest growing sales channel for many organizations. Through internet every organization can enhance the sale and purchase volume which is very effective and significant way. Therefore TheitValley is offering complete Google advertising solutions to evaluate the E commerce and E business solutions using the Internet to increase customers and generate more sales. Choosing the right E commerce supplier is a key decision: choosing one with a proven track record, experience and deep familiarity with all aspects of the online marketing, TIV is aimed at providing elevated quality and cost-induced web application/software solutions from small to medium organizations worldwide by combining the onsite analysis phase with offshore development & testing phase, followed by onsite implementation. With the help of TIV’s Global Delivery Model, software project costs of its clients worldwide can be reduced by about 50% without having to compromise on absolute quality and delivery schedules. The projects are executed on Fixed-Price or Time & Material basis, depending upon the nature of each project. Internet marketing is the origin link building for any quality Internet marketing operation. We Build Pages views links as “votes” for your website, justification from the Internet society that your website and associated services and resources are valuable. The additional links, the more popular the website, and the higher it will rank in the search engines; but there is a catch, not all votes are the same. The more authoritative the site that links to another site, the more “votes” its worth. We Build Pages targets the most authoritative sites to ensure that your link building efforts get the most bang for your buck. We all want more traffic, and more importantly, we want that traffic to turn into customers. With this common goal in mind, We Build Pages is dedicated to providing our clients with the tools and feedback to make your website and services successful. Search engine optimization is the permanent performance of civilizing search engine position of a website. We Build Pages Internet Marketing Services believes that by growing traffic to a website using link building services, proactive Internet marketing, and original SEO content creation to improve search engine positioning. With the latest organic link building services, We Build Pages provides the most significant and modified SEO services accessible. Web design and web application development is a complex process that requires a extensive range of creative, business and technical skills. Good design must impressively communicate key marketing messages and well as providing simple intuitive navigation. In web development felid, we have successfully established ourselves in providing high quality web design and web development from our wide range and verity to our client all around the world. The design also lays down a sequence of “calls to action” designed to engage and facilitate the business process. TheitValley is the biggest and largest providing complete Google advertising solution after Google. The first and foremost priority of the TIV is to attain the customer objective without any compromise. The work procedure of the TIV is planning and analysis, user interface design, project management, documentation, onsite testing, implementation, post implementation, warranty support achieving the goal with effectively and efficiently work. http://www.theitvalley.com/seo.html -- http://mail.python.org/mailman/listinfo/python-list
Re: How to write a file generator
On 07/12/2011 06:42 PM, Billy Mays wrote: > On 07/12/2011 11:52 AM, Thomas Jollans wrote: >> On 07/12/2011 04:46 PM, Billy Mays wrote: >>> I want to make a generator that will return lines from the tail of >>> /var/log/syslog if there are any, but my function is reopening the file >>> each call: >>> >>> def getLines(): >>> with open('/var/log/syslog', 'rb') as f: >>> while True: >>> line = f.readline() >>> if line: >>> yield line >>> else: >>> raise StopIteration >>> >>> >>> I know the problem lies with the StopIteration, but I'm not sure how to >>> tell the caller that there are no more lines for now. >>> >>> -- >>> Bill >> >> http://stackoverflow.com/questions/1475950/tail-f-in-python-with-no-time-sleep >> > > > That was actually the behavior I was trying to avoid. If there is no > data to be read, the call will hang. That function is actually called > by a webserver (from wsgiref) so it cannot hang indefinitely. What Terry said, then. (Not Bruno, I confused that. Sorry for sending a mail both short and wrong.) -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp refactoring puzzle
Xah Lee writes: > it's funny, in all these supposedly modern high-level langs, they > don't provide even simple list manipulation functions such as union, > intersection, and the like. Not in perl, not in python, not in lisps. In Common Lisp you have: CL-USER> (union '(a b c) '(b c d)) (A B C D) CL-USER> (intersection '(a b c) '(b c d)) (C B) //Petter -- .sig removed by request. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to write a file generator
On 07/12/2011 06:42 PM, Billy Mays wrote: > On 07/12/2011 11:52 AM, Thomas Jollans wrote: >> On 07/12/2011 04:46 PM, Billy Mays wrote: >>> I want to make a generator that will return lines from the tail of >>> /var/log/syslog if there are any, but my function is reopening the file >>> each call: >>> >>> def getLines(): >>> with open('/var/log/syslog', 'rb') as f: >>> while True: >>> line = f.readline() >>> if line: >>> yield line >>> else: >>> raise StopIteration >>> >>> >>> I know the problem lies with the StopIteration, but I'm not sure how to >>> tell the caller that there are no more lines for now. >>> >>> -- >>> Bill >> >> http://stackoverflow.com/questions/1475950/tail-f-in-python-with-no-time-sleep >> > > > That was actually the behavior I was trying to avoid. If there is no > data to be read, the call will hang. That function is actually called > by a webserver (from wsgiref) so it cannot hang indefinitely. In that case, what Bruno said. -- http://mail.python.org/mailman/listinfo/python-list
Re: "Python Wizard," with apologies to The Who
On Tuesday, July 12, 2011 9:40:23 AM UTC-7, John Keisling wrote: > After too much time coding Python scripts and reading Mark Lutz's > Python books, I was inspired to write the following lyrics. For those > too young to remember, the tune is that of "Pinball Wizard," by The > Who. May it bring you as much joy as it brought me! > > > I cut my teeth on BASIC > At scripting I'm no pawn > From C++ to Java > My code goes on and on > But I ain't seen nothing like this > In any place I've gone > That modeling and sim guy > Sure codes some mean Python! That's pretty funny. I knew what it would be even when I saw the cut-off subject line, and I am too young to remember it. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list
Re: Set run vars with each call
On Tue, Jul 12, 2011 at 11:50 AM, Andrew Berg wrote: > On 2011.07.12 12:32 PM, Gnarlodious wrote: >> OK, that sets a value at init time. But is there a similar built-in >> to run whenever the class instance is called? > What do you mean by call an instance? Do you want to run certain code > whenever any method is called? Do you want to want certain code to run > whenever an attribute is accessed? Calling an instance doesn't make any > sense, especially if you're not referring to the __init__() method. If I'm understanding correctly, I think the OP wants to do something like this: class Gadget: def do_something(self, some_argument=some_default_value): # do stuff where the exact default value of some_argument depends on the current state of the Gadget instance. The canonical approach here would be: class Gadget: def do_something(self, some_argument=None): if some_argument is None: some_argument = self._some_argument_default # do stuff And then the other instance methods of Gadget can update the default by setting the value of the _some_argument_default attribute. -- http://mail.python.org/mailman/listinfo/python-list
Re: "Python Wizard," with apologies to The Who
On Jul 12, 11:34 am, Tim Daneliuk wrote: > On 7/12/2011 12:08 PM, Tim Daneliuk said this: > > > On 7/12/2011 11:40 AM, John Keisling said this: > >> After too much time coding Python scripts and reading Mark Lutz's > >> Python books, I was inspired to write the following lyrics. For those > >> too young to remember, the tune is that of "Pinball Wizard," by The > >> Who. May it bring you as much joy as it brought me! > > > > > > You realize that you must now reprise this with, > > "I'm your wicked Uncle Guido" ... right? > > While were on the subject: > > "T-t-t-alking 'bout my generator " > > -- > > Tim Daneliuk > tun...@tundraware.com Brilliant! LOL! -- http://mail.python.org/mailman/listinfo/python-list
Re: Wgy isn't there a good RAD Gui tool fo python
> > One reason there hasn't been much demand for a GUI builder is that, in > > many cases, it's just as simpler or simpler to code a GUI by hand. I use a GUI builder because I'd rather click less than type more. I just tried that in Boa Constructor; with ~10 mouse clicks I produced 964 characters of Python code. Now, sure, depending on how I wrote the code I could do better than that, but for me, I just find it more intuitive and easier to use a GUI to make a GUI. > Often a GUI builder is used as a bad replacement for sketch-pad and > pencil. I would use a sketch-pad and pencil and *then* use the GUI builder. What's nice about a builder is one can move things around quickly and see the results in the real application, which one can never really see well on a paper sketch. You could use a mock-up program of course, but I feel you might as well do it in the builder because when you're satisfied with it you have a real runnable application instead of just a picture. > Using a GUI builder with layout managers might actually > feel awkward. It takes some getting used to in Boa, in my experience, but then it feels intuitive and I really like using sizers with Boa. It helps if you give your sizers descriptive names. Che -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp refactoring puzzle
On Tuesday, July 12, 2011 02:08:02 PM Terry Reedy did opine: > On 7/11/2011 11:37 PM, Xah Lee wrote: > > watch the first episode of Douglas Crockford's talk here: > > http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-1 > > The link includes a transcript of the talk, which I read > > I suspect Lee likes Crockford because they both think they are smarter > than everyone else. Writing about Smalltalk, for instance, Crockford > says: > > "I don't know why it is, but a lot of programmers just couldn't get used > to this syntax. [everything is done by sending a message with arguments > to some object] ...So this may be a superior notation, but it was > profoundly rejected. By who? By us, by the programmers, because we > couldn't understand it." > > Actually, I and others see Smalltalk as deeply flawed because its > message passing syntax arbitrarily breaks symmetries in operations. For > instance, in the expression 'a+b', both operands have equivalent roles > in the operation for all normal interpretations of '+'.# On the other > hand, in the expression 'a.extend(b)', where a is a list and b any > iterable and the result is to mutate a but not b, a and b have very > different roles in both the operation and the expression that invokes > it. > > # Under the covers, Python implements 'a+b' as first 'a.__add__(b)', but > it also tries 'b.__radd__(a)' if the first does not work. This > introduces a slight asymmetry in that a gets first say at defining the > meaning of 'a+b', but it does not get the only say. And, as far as I can > presently remember, this asymmetry is never visible with builtins. In > fact, this implementation makes it possible for 'a+b' and 'b+a' to both > give the same answer when a is a builtin and b is a user-class instance. > > Crockford is right that he does not 'know why it is' that not everyone > loves Smalltalk. He should have stopped there instead of projecting his > ignorance on everyone else. > I have my own reasons to hate smalltalk but won't elaborate. > As a side note, the same principle of expressions matching operations in > symmetry suggest that majority of up are quite sensible and not dumb > idiots for preferring 'f(x)' to the '(f x)' of Lisp. In a function call, > the function has a different role than the arguments, so it is > appropriate that it have a different role in the expression. Which should be well documented if one expects the programmers to use it properly. So far, I have only found two languages that are adequately defined and implemented. K&R C, and the now essentially defunct Amiga ARexx. But I should preface that by saying that I have not yet adequately studied python, one of the reasons I joined this list. Specifically, I am trying to install the altera quartus software so I can program one of their DE1 boards, but because the majority of the linux distro's have not kept their repo's zlib packages up to date, one of the quartus imports, gzdirect is on the missing list and I am dead in the water until I install zlib version 1.2.5. I hope this list serves me as a tutorial to fill in the gaps of my python knowledge which at the moment seem too wide to jump over. I hope I can ask intelligent, if newbie, questions occasionally. Now, I hate to mention it Terry, but your clock seems to be about 126 months behind the rest of the world. Does your system not run ntpd by default? The date in the header from your machine is "Mon Jan 1 14:11:11 2001". Cheers, gene -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) What makes us so bitter against people who outwit us is that they think themselves cleverer than we are. -- http://mail.python.org/mailman/listinfo/python-list
Re: "Python Wizard," with apologies to The Who
> That modeling and sim guy > Sure codes some mean Python! C-; And he changes key on the fly, too! -- http://mail.python.org/mailman/listinfo/python-list
new python contracts library
Hey I recently created a contracts library for python and was wondering if anyone finds it useful or wants to have additional features added ? Feel free to open new issues on the github project. https://github.com/rlgomes/contracts This is just a v0.1 and I welcome any and all suggestions to make it into something really useful. I've found it useful for when I start putting together a few other project ideas I have and want to make sure that the certain functions are being used correctly and that bad arguments or return values don't end up blowing up the application in a completely unrelated function call sometime later than the original point where the bug actually occurred. If this is not the correct forum for this posting let me know and i'll move it elsewhere. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to write a file generator
On 7/12/2011 10:46 AM, Billy Mays wrote: I want to make a generator that will return lines from the tail of /var/log/syslog if there are any, but my function is reopening the file each call: def getLines(): with open('/var/log/syslog', 'rb') as f: while True: line = f.readline() if line: yield line else: raise StopIteration Please use spaces rather than (disappearing) tabs in posted code. I know the problem lies with the StopIteration, but I'm not sure how to tell the caller that there are no more lines for now. The same way you currently decide when to raise StopIteration def tail(filename): with open(filename, 'rb') as f: while True: yield f.readline() When the caller gets '', it should go and do something else for awhile. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Set run vars with each call
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 On 2011.07.12 12:32 PM, Gnarlodious wrote: > OK, that sets a value at init time. But is there a similar built-in > to run whenever the class instance is called? What do you mean by call an instance? Do you want to run certain code whenever any method is called? Do you want to want certain code to run whenever an attribute is accessed? Calling an instance doesn't make any sense, especially if you're not referring to the __init__() method. - -- CPython 3.2.1 | Windows NT 6.1.7601.17592 | Thunderbird 5.0 PGP/GPG Public Key ID: 0xF88E034060A78FCB -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAwAGBQJOHImDAAoJEPiOA0Bgp4/LEzYH/1R+cXobysF02GiB45LcXjHm oQsSkrbXtlvutgOlVHOI8MRVRzMndgK+0jWsujYD4nZYf45GO3b0hw/zb9jy3bUI 7BafZMRAz+wI1BJFlDD3P+IjPDoW4WvpMP0q09H4f664DYwQNuXfeveNOwAQnPXl SpqpcvnTm0fqocC0o2G9jUuV50QXFFPntz/VVwl+3UpJLS95pCuAq+URs4OVhLM2 QB1ulmZ35PyfArdz5pYvoXvtfeURldfZhhAm1/mkVThzffUxAcCTANg6AeYd2JNb QO0jSCedhrzWfsK5J63Ax+nrmjvms8+gZ3TxNkdMaz0zICtDuq5lLSIml1JuUfk= =EMT2 -END PGP SIGNATURE- -- http://mail.python.org/mailman/listinfo/python-list
Re: "Python Wizard," with apologies to The Who
On 7/12/2011 12:08 PM, Tim Daneliuk said this: > On 7/12/2011 11:40 AM, John Keisling said this: >> After too much time coding Python scripts and reading Mark Lutz's >> Python books, I was inspired to write the following lyrics. For those >> too young to remember, the tune is that of "Pinball Wizard," by The >> Who. May it bring you as much joy as it brought me! >> > > > > You realize that you must now reprise this with, > "I'm your wicked Uncle Guido" ... right? > > While were on the subject: "T-t-t-alking 'bout my generator " -- Tim Daneliuk tun...@tundraware.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Set run vars with each call
On Jul 12, 8:46 am, Alister Ware wrote: > I thought that was the role of the __init__ function > > class Something: > def __init__(self): > self.value="some value" OK, that sets a value at init time. But is there a similar built-in to run whenever the class instance is called? -- Gnarlie -- http://mail.python.org/mailman/listinfo/python-list
Re: "Python Wizard," with apologies to The Who
On 7/12/2011 11:40 AM, John Keisling said this: > After too much time coding Python scripts and reading Mark Lutz's > Python books, I was inspired to write the following lyrics. For those > too young to remember, the tune is that of "Pinball Wizard," by The > Who. May it bring you as much joy as it brought me! > You realize that you must now reprise this with, "I'm your wicked Uncle Guido" ... right? -- Tim Daneliuk tun...@tundraware.com -- http://mail.python.org/mailman/listinfo/python-list
Re: How to write a file generator
On 12 Jul, 16:46, Billy Mays wrote: > I know the problem lies with the StopIteration, but I'm not sure how to > tell the caller that there are no more lines for now. Try 'yield None' instead of 'raise StopIteration'. Sturla -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp refactoring puzzle
On 7/11/2011 11:37 PM, Xah Lee wrote: watch the first episode of Douglas Crockford's talk here: http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-1 The link includes a transcript of the talk, which I read I suspect Lee likes Crockford because they both think they are smarter than everyone else. Writing about Smalltalk, for instance, Crockford says: "I don't know why it is, but a lot of programmers just couldn't get used to this syntax. [everything is done by sending a message with arguments to some object] ...So this may be a superior notation, but it was profoundly rejected. By who? By us, by the programmers, because we couldn't understand it." Actually, I and others see Smalltalk as deeply flawed because its message passing syntax arbitrarily breaks symmetries in operations. For instance, in the expression 'a+b', both operands have equivalent roles in the operation for all normal interpretations of '+'.# On the other hand, in the expression 'a.extend(b)', where a is a list and b any iterable and the result is to mutate a but not b, a and b have very different roles in both the operation and the expression that invokes it. # Under the covers, Python implements 'a+b' as first 'a.__add__(b)', but it also tries 'b.__radd__(a)' if the first does not work. This introduces a slight asymmetry in that a gets first say at defining the meaning of 'a+b', but it does not get the only say. And, as far as I can presently remember, this asymmetry is never visible with builtins. In fact, this implementation makes it possible for 'a+b' and 'b+a' to both give the same answer when a is a builtin and b is a user-class instance. Crockford is right that he does not 'know why it is' that not everyone loves Smalltalk. He should have stopped there instead of projecting his ignorance on everyone else. As a side note, the same principle of expressions matching operations in symmetry suggest that majority of up are quite sensible and not dumb idiots for preferring 'f(x)' to the '(f x)' of Lisp. In a function call, the function has a different role than the arguments, so it is appropriate that it have a different role in the expression. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: "Python Wizard," with apologies to The Who
I don't know whether to LOL or mourn the part of me that just died inside :-P j/k j/k clever song, and it made me laugh :) On Tue, Jul 12, 2011 at 12:40 PM, John Keisling wrote: > After too much time coding Python scripts and reading Mark Lutz's > Python books, I was inspired to write the following lyrics. For those > too young to remember, the tune is that of "Pinball Wizard," by The > Who. May it bring you as much joy as it brought me! > > > I cut my teeth on BASIC > At scripting I'm no pawn > >From C++ to Java > My code goes on and on > But I ain't seen nothing like this > In any place I've gone > That modeling and sim guy > Sure codes some mean Python! > > He knows his dictionaries > His exceptions never pass > His polymorphic methods > Extend each superclass > He uses indentation > Its lines are clearly drawn > That modeling and sim guy > Sure codes some mean Python! > > He's a Python wizard > His code just never wrecks > A Python wizard > He knows simple beats complex > > How do you think he does it? > (I don't know) > What makes him so good? > > He codes with TkInter > He can render treble clefs > He uses lamdba functions > With *args in their defs > Defines his module search path > Of tuples he's the don > That modeling and sim guy > Sure codes some mean Python! > > I thought I was > The scripting language king > But I just handed > My Python crown to him > > He links in to libraries > All optimized in C > He always uses docstrings > For readability > He knows file iterators > He bids all bugs begone > That modeling and sim guy > Sure codes some mean Python! > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Re: How to write a file generator
On 07/12/2011 11:52 AM, Thomas Jollans wrote: On 07/12/2011 04:46 PM, Billy Mays wrote: I want to make a generator that will return lines from the tail of /var/log/syslog if there are any, but my function is reopening the file each call: def getLines(): with open('/var/log/syslog', 'rb') as f: while True: line = f.readline() if line: yield line else: raise StopIteration I know the problem lies with the StopIteration, but I'm not sure how to tell the caller that there are no more lines for now. -- Bill http://stackoverflow.com/questions/1475950/tail-f-in-python-with-no-time-sleep That was actually the behavior I was trying to avoid. If there is no data to be read, the call will hang. That function is actually called by a webserver (from wsgiref) so it cannot hang indefinitely. -- Bill -- http://mail.python.org/mailman/listinfo/python-list
"Python Wizard," with apologies to The Who
After too much time coding Python scripts and reading Mark Lutz's Python books, I was inspired to write the following lyrics. For those too young to remember, the tune is that of "Pinball Wizard," by The Who. May it bring you as much joy as it brought me! I cut my teeth on BASIC At scripting I'm no pawn >From C++ to Java My code goes on and on But I ain't seen nothing like this In any place I've gone That modeling and sim guy Sure codes some mean Python! He knows his dictionaries His exceptions never pass His polymorphic methods Extend each superclass He uses indentation Its lines are clearly drawn That modeling and sim guy Sure codes some mean Python! He's a Python wizard His code just never wrecks A Python wizard He knows simple beats complex How do you think he does it? (I don't know) What makes him so good? He codes with TkInter He can render treble clefs He uses lamdba functions With *args in their defs Defines his module search path Of tuples he's the don That modeling and sim guy Sure codes some mean Python! I thought I was The scripting language king But I just handed My Python crown to him He links in to libraries All optimized in C He always uses docstrings For readability He knows file iterators He bids all bugs begone That modeling and sim guy Sure codes some mean Python! -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp refactoring puzzle
I think the problem with so-called "forward looking" or "highest level" languages is that they tend to become domain specific. What Lispers are always saying is construct your own high level language out of your favorite Lisp. Of course no one else will use it then, or even discuss it, unless you have some good buddies. What happens is that high level languages don't end up addressing needs across a large community. The lower down languages can be common denominators across wide swaths of programmers. So we live in this world of roll-your-own on top of the common denominator language. One exception to this is in data base development, where there were some "4th generation" languages that had some success, where the needs of mapping business data models onto data base oriented implementation has had a large community. I guess Mathematica, or MatLab in my environment, also address a community of needs for modelling mathematical algorithms, or for doing analysis of data sets. However both the data base field and the math/arithmetic tool field are examples of domains that are narrower than programming in general. Hence those higher level languages could be seen as domain specific, but for domains with lots of users. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to write a file generator
On 07/12/2011 04:46 PM, Billy Mays wrote: > I want to make a generator that will return lines from the tail of > /var/log/syslog if there are any, but my function is reopening the file > each call: > > def getLines(): > with open('/var/log/syslog', 'rb') as f: > while True: > line = f.readline() > if line: > yield line > else: > raise StopIteration > > > I know the problem lies with the StopIteration, but I'm not sure how to > tell the caller that there are no more lines for now. > > -- > Bill http://stackoverflow.com/questions/1475950/tail-f-in-python-with-no-time-sleep -- http://mail.python.org/mailman/listinfo/python-list
Re: How to write a file generator
On Jul 12, 4:46 pm, Billy Mays wrote: > I want to make a generator that will return lines from the tail of > /var/log/syslog if there are any Err... I must have missed something, but python files are their own iterators. Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. pythonrc start pythonrc done >>> f = open("/var/log/syslog") >>> for line in f: ... print line ... (snip unintersting syslog stuff)) >, but my function is reopening the file > each call: How do you know, and how do you call your function ? > def getLines(): > with open('/var/log/syslog', 'rb') as f: > while True: > line = f.readline() > if line: > yield line > else: > raise StopIteration > > I know the problem lies with the StopIteration, but I'm not sure how to > tell the caller that there are no more lines for now. If you want the generator to wait until new content is available, just remove the raise part - but you'll have a blocking call... Else, I don't see what behaviour you are expecting exactly. -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp refactoring puzzle
On Mon, Jul 11, 2011 at 8:37 PM, Xah Lee wrote: > > it's funny, in all these supposedly modern high-level langs, they > don't provide even simple list manipulation functions such as union, > intersection, and the like. Not in perl, not in python, not in lisps. > (sure, lib exists, but it's a ride in the wild) Python has them, but, as they are set functions, not list functions, they exist for the set type: Intersection: >>> set((1, 2, 3)) & set((2,3,4)) set([2, 3]) Union: >>> set((1, 2, 3)) | set((2,3,4)) set([1, 2, 3, 4]) Symmetric Difference: >>> set((1, 2, 3)) ^ set((2,3,4)) set([1, 4]) You can also get a non-symmetric difference by calling the difference method of the set: >>> set((1, 2, 3)).difference(set((2,3,4))) set([1]) >>> set((2, 3, 4)).difference(set((1,2,3))) set([4]) >>> In Python 3 (2.7?) there is even more syntactical sugar for them: {1, 2, 3} ^ {2, 3, 4} produces {1, 4}. -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp refactoring puzzle
Xah Lee wrote: > it's funny, in all these supposedly modern high-level langs, they > don't provide even simple list manipulation functions such as union, > intersection, and the like. Not in perl, not in python, not in lisps. Ruby has them. Intersection: [2,3,5,8] & [0,2,4,6,8] ==>[2, 8] Union: [2,3,5,8] | [0,2,4,6,8] ==>[2, 3, 5, 8, 0, 4, 6] -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp refactoring puzzle
I might argue that it isn't quite right (or politic) to call those who resist technological changes "idiots" so much as to observe they often have goals which cannot wait for the ideal expressive system. People love python not because Python is the platonic programming language, but because it does what they need it to do right now. Ditto (often) for Lisp. It is easy to point out an example of forward thinking languages like Mathematica, and who knows, perhaps it will be the template upon which languages are built in the next 100 years. But if it is, there will be tons of other technologies which _didn't_ make it but which might have seemed equally advanced. Early adoption is always a risk, and few people want to deal with it when technology exists now that solves their problem now, however sub-optimally. That is hardly idiotic, Xah. -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp refactoring puzzle
On 7/11/2011 11:37 PM, Xah Lee wrote: it's funny, in all these supposedly modern high-level langs, they don't provide even simple list manipulation functions such as union, intersection, and the like. Not in perl, not in python, Union and intersection are set operations, not list operations. Python has had a set type with a full set of set operations for several years. It has list concatenation, which is the list equivalent of union. It has lots of other useful list operations. > Mathematica has Union, Intersection, and a host of others > some 20 years ago, and today it has a complete set of combinatorics > functions as *builtin* functions Python has the basic combinatoric function in the itertools module, though they are not used much. If Mathematica has Catalan sequences builtin, I wonder how much they are used. Since Python is free, in both meanings, it does not have paid people sitting around writing things to pad numbers to justify a $2k price tag. On the other hand, lots of people have added and made available lots of good add-ons. Mathematica should probably be most fairly compared with Python+numpy+scipy and maybe a few other things. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
How to write a file generator
I want to make a generator that will return lines from the tail of /var/log/syslog if there are any, but my function is reopening the file each call: def getLines(): with open('/var/log/syslog', 'rb') as f: while True: line = f.readline() if line: yield line else: raise StopIteration I know the problem lies with the StopIteration, but I'm not sure how to tell the caller that there are no more lines for now. -- Bill -- http://mail.python.org/mailman/listinfo/python-list
Re: Set run vars with each call
On Tue, 12 Jul 2011 06:32:32 -0700, Gnarlodious wrote: > Question. Is there a special method or easy way to set default values > with each call to an instance? Any ideas to make it easier? What I want > to do is have a constantly updating set of values which can be > overridden. Just thought there was an easy way to set that up. > > -- Gnarlie I thought that was the role of the __init__ function class Something: def __init__(self): self.value="some value" -- No matter how subtle the wizard, a knife in the shoulder blades will seriously cramp his style. -- http://mail.python.org/mailman/listinfo/python-list
Set run vars with each call
Question. Is there a special method or easy way to set default values with each call to an instance? Any ideas to make it easier? What I want to do is have a constantly updating set of values which can be overridden. Just thought there was an easy way to set that up. -- Gnarlie -- http://mail.python.org/mailman/listinfo/python-list
Re: Python bug? Indexing to matrices
Thank all for the very helpful replies. The goal of the matrix multiply exercise was just to help my son and I learn Python better. I now understand *why* my initialization of [c] was wrong and I am continuing to check out numpy and scipy. Regards, David -- http://mail.python.org/mailman/listinfo/python-list
Re: Python bug? Indexing to matrices
On 12 Jul, 14:59, sturlamolden wrote: > ma = np.matrix(a) > mb = np.matrix(b) > a*b ma*mb Sorry for the typo. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python bug? Indexing to matrices
On 12 Jul, 07:39, David wrote: > Should the following line work for defining a matrix with zeros? > > c= [[0]*col]*row No. The rows will be aliased. This will work: c = [[0]*col for i in range(row)] Note that Python lists are not ment to be used as matrices. We have NumPy or the array module for that. > If this a valid way of initializing a matrix in Python 3.2.1, then it > appears to me that a bug surfaces in Python when performing this line: > > c[i][j] = c[i][j] + a[i][k] * b[k][j] > > It writes to the jth column rather than just the i,j cell. That is due to aliasing. > I'm new at Python and am not sure if I'm just doing something wrong if > there is really a bug in Python. The script works fine if I > initialize the matrix with numpy instead: > > c = np.zeros((row,col)) > > So, I know my matrix multiply algorithm is correct (I know I could use > numpy for matrix multiplication, this was just to learn Python). Like so: np.dot(a,b) or ma = np.matrix(a) mb = np.matrix(b) a*b or call BLAS directly: scipy.linalg.fblas.dgemm Sturla -- http://mail.python.org/mailman/listinfo/python-list
Re: Wgy isn't there a good RAD Gui tool fo python
On Tue, Jul 12, 2011 at 8:24 PM, Steven D'Aprano wrote: > Where is the Windows equivalent of yum or apt-get? Why isn't there a central > repository of independent and third party Windows software? It seems clear > to me that it is the major open source communities that aim for > convenience, at the cost of the opportunity to sell licences. > The nearest commercial equivalent is probably Apple's iTunes store. It manages to be the "one place to go" for iphone apps, many of which cost money. Upside: Developers know where to host their stuff if they want it to sell. Downside: Developers have to host it there if they want it to sell - and Apple snag 30% on the way through. I've not seen a Windows equivalent, but Microsoft could make one if they wanted to. All they need is for the next version of Windows to recommend that all software be signed, and make it somewhat awkward to install unsigned software, and that would be that. It would probably be the knell of Windows, but it could be done. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
What Programing Language are the Largest Website Written In?
maybe this will be of interest. 〈What Programing Language Are the Largest Website Written In?〉 http://xahlee.org/comp/website_lang_popularity.html - i don't remember how, but today i suddenly got reminded that Facebook is written in PHP. So, on the spur of the moment, i twitted: “Remember folks, the world's largest sites {Facebook, Wikipedia, “Yahoo!”, etc} are written in Pretty Home Page!” and followed with: “To Chinese friends, what's Baido, QQ, Taobao, Sina written in?” Then, this question piqued me, even i tried to not waste my time. But it overpowered me before i resisted, becuase i quickly spend 15 min to write this list (with help of Google): 1 Google ◇ Java 2 Facebook ◇ PHP 3 YouTube ◇ Python 4 Yahoo! ◇ PHP 5 blogger.com ◇ Java 6 baidu.com ◇ C/C++. perl/python/ruby 7 Wikipedia ◇ PHP 8 Windows Live live.com 9 Twitter.com ◇ Scala and Ruby? 10 QQ.com ◇ ? 11 MSN.com ◇ ? 13 LinkedIn ◇ PHP? 15 TaoBao.com ◇ ? 16 sina.com.cn ◇ ? 17 Amazon.com ◇ ? 18 WordPress.com ◇ PHP 22 eBay.com ◇ ? 23 yandex.ru (Russian) ◇ ? 24 Bing ◇ ? 27 Microsoft.com ◇ ? 28 网易 163.com ◇ ? 29 PayPal.com ◇ Java? 31 新浪微博 weibo.com ◇ ? 32 Flickr.com ◇ ? 34 mail.ru ◇ ? 35 Craiglist.org ◇ perl 36 FC2.com ◇ ? 38 Apple.com ◇ Objective J? 39 imdb.com ◇ ? 41 VKontakte.ru ◇ ? 43 搜狐网 sohu.com ◇ ? 44 Ask.com ◇ ? 45 BBC.co.uk ◇ ? 46 tumblr.com ◇ PHP 47 LiveJasmin.com (porn) ◇ ? 48 xvideos.com (porn) ◇ ? … 56 土豆网 Todou.com ◇ ? 81 YouPorn.com ◇ ? StumbleUpon.com ◇ PHP, Perl, C++ … the numbers is site ranking, from alexa.com. (missing ones are mostly duplicates, such as google japan, google india, etc.) i think notable interest is that twitter stands out, with Scala and Ruby. Those with perl are probably going back to the first dot com era (aka Web 1.0, ~1995 to ~2002). At that time, perl was basically the only game in town (secondarily: Java). (i don't recall what amazon and ebay were in... was it perl or php? how about imdb.com?) most php follows starting in early 2000s, that's when PHP quietly surpassed perl in all battle fronts. it'd be interesting to know what some of the chinese sites uses, and porn sites (e.g. livejasmin, xvideos, youporn) as for Microsoft sites... are they in C/C++ and or dotnet? Xah -- http://mail.python.org/mailman/listinfo/python-list
Re: Wgy isn't there a good RAD Gui tool fo python
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 On 2011.07.12 05:24 AM, Steven D'Aprano wrote: > Rather than taking advantage of that convenience, commercial vendors > put barriers in the way and try to carve out little walled gardens. > Did they not learn anything from AOL? DRM and activation schemes will /always/ make things harder, but that is the cost of doing business, at least in the minds of commercial software vendors. There are actually a lot of good freeware (proprietary, but zero cost) apps out there. Some even better than open-source alternatives. I avoid commercial apps, though, since they tend to be far inferior to the alternatives (inconvenience aside). > Where is the Windows equivalent of yum or apt-get? Why isn't there a > central repository of independent and third party Windows software? If Microsoft made such a repository, how much of the repository would be high-quality open-source software, and how much would be commercial shovelware? Attempts at independent repos have been made, but they all fail because there's no effort among developers (especially developers of proprietary software), to package their software this way. These attempts also fail because they fail to gain support from users (a catch-22 where users don't bother because there's not much in the repo and there's not much in the repo because users don't bother). > It seems clear to me that it is the major open source communities > that aim for convenience, at the cost of the opportunity to sell > licences. The developers of open-source projects often aim to please the user rather than make money. You'd think pleasing the user and making money would go hand-in-hand, but history has shown that the latter can be achieved with little thought of the former. > That might have been true, oh, 20 years ago, but today, that's far > less of a rule. Linux distros make interoperability far simpler. Some > level of savvy is needed, but it is remarkable how much Linux > software Just Works. At first, Linux had to learn how to crawl and then walk. Now it's doing gymnastics. :) > In my experience, two categories of Linux software are generally hard > to deal with: one-man projects (usually stuck on version 0.2b for the > last seven years), and big, popular projects that have been taken > over by developers from the Windows world (I'm looking at you, > Firefox). YMMV. Firefox (and Thunderbird with it) are falling into the same trap that many fall into when they become popular. This is more prevalent among commercial apps, but it's not too surprising considering Firefox's popularity. The trap is making things shiny. That is, using UI designs (and to a lesser extent adding neat, but generally useless features) that appeal to the computer-illiterate masses who cling to something that looks neat, regardless of how useful it ultimately is. AFAICT, Mozilla's problem isn't that incompetent Windows-centric devs took over, but rather that Google and MS were stepping up their game with their respective browsers and is desperately trying not to lose market share. - -- CPython 3.2 | Windows NT 6.1.7601.17592 | Thunderbird 5.0 PGP/GPG Public Key ID: 0xF88E034060A78FCB -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAwAGBQJOHC4EAAoJEPiOA0Bgp4/Lgm0IAOT+/LQNalPHm5pvt4ilF1yt RM9fPBSgAF5k9U8jWBuQy/V6QJ/a1Sfkzu8ulZ8TyAYS64quucIqTwMJugdTUmct KsGbDsyXg0FObMxNiKKFuZblVYOtnULkYtYZOxeE33qy+85X6NMuFUv7ARHaLi/3 1Bdmnsj43hRrzJ1Rwb8x+xbOmiq+fJ7199loPQ+unSu7s37NJoL1e1vFNnsmGz8A Jg58Q0MbGiwettPdM9ZySYWgTJhiawtEX4SF6YiQqf22e04OyPWyxUfejixnZNoQ 7vbksr9k8PQzuTlG2y3G1pJx6XGrxgOQuEoVjInMGbZW0tx43paJLEWCOcd38FI= =3FGv -END PGP SIGNATURE- -- http://mail.python.org/mailman/listinfo/python-list
Re: Wgy isn't there a good RAD Gui tool fo python
Thorsten Kampe wrote: > * sturlamolden (Mon, 11 Jul 2011 06:44:22 -0700 (PDT)) >> On 11 Jul, 14:39, Ben Finney wrote: >> > The Unix model is: a collection of general-purpose, customisable >> > tools, with clear standard interfaces that work together well, and >> > are easily replaceable without losing the benefit of all the others. >> >> This is opposed to the "Windows model" of a one-click installer for a >> monolithic application. Many Windows users get extremely frustrated >> when they have to use more than one tool. > > *sigh* There is no Windows nor Unix "model". There is only you-get-what- > you-pay-for. > > On Windows, you're a customer and the developer wants to make using his > application as convenient as possible for you, the customer. That's an astonishing statement. Today, I started to update a commercial, proprietary Windows application, Quickbooks. I didn't actually get around to running the installer application yet, on account of the installer having trouble if your data is on a network share. (Apparently the developers of Quickbooks never considered that when you have multiple users connected to the same database at once, at least one of them must be accessing it over the network.) But in preparation for the process, I took note of the information needed to make QB run. I don't have the list in front of me, but there were something like 6 or 8 keys needed to make the software work: Customer account number Licence key Upgrade key Validation code etc. (I don't remember the full list. I try not to bring that part of my work home :) Or consider the Windows licence key, product activation code, etc. If "as convenient as possible" was their aim (as opposed to "making a profit from licencing"), then you wouldn't need all that. Why on earth should I have to install a "Amazon MP3 Downloader" app to purchase mp3s? Or the iTunes app? The internet and web browsers excel at making it easy to download files. Rather than taking advantage of that convenience, commercial vendors put barriers in the way and try to carve out little walled gardens. Did they not learn anything from AOL? Where is the Windows equivalent of yum or apt-get? Why isn't there a central repository of independent and third party Windows software? It seems clear to me that it is the major open source communities that aim for convenience, at the cost of the opportunity to sell licences. In fairness though, open source developers' idea of "convenient" is not always the same as mine. > On Unix you don't pay and the developer couldn't care less if his > application works together with application b or how much it takes you > to actually get this damn thing running. That might have been true, oh, 20 years ago, but today, that's far less of a rule. Linux distros make interoperability far simpler. Some level of savvy is needed, but it is remarkable how much Linux software Just Works. In my experience, two categories of Linux software are generally hard to deal with: one-man projects (usually stuck on version 0.2b for the last seven years), and big, popular projects that have been taken over by developers from the Windows world (I'm looking at you, Firefox). YMMV. > And as soon as developers start developing for Unix customers (say > Komodo, for instance), they start following the "Windows model" - as you > call it. Surely that's because Komodo started off as a Windows application before being ported to Unix? -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Virtual functions are virtually invisible!
On Tue, Jul 12, 2011 at 7:46 AM, rantingrick wrote: > Actually no i was purposely implying Mt. Vesuvius. You know, the > VOLCANO that erupted and left poor Pompeii in ruins? Here is some text > from the wiki verbatim: > Yes, I do know that mountain. But it doesn't have very many gods sitting on it... maybe a magma elemental, but that's all. Anyhow, this is quite off-topic for Python I think. (Though not off-topic for rantingrick.) ChrisA -- http://mail.python.org/mailman/listinfo/python-list