Python-URL! - weekly Python news and links (Sep 2)
QOTW: I like how being very friendly means calling people after a guy who tried to blow up the English Parliament. - Carl Banks http://groups.google.com/group/comp.lang.python/browse_thread/thread/7a190c24d8025bb4 unichr/ord cannot handle characters outside the BMP in a narrow build: http://groups.google.com/group/comp.lang.python/t/2fe770303f1d85ea/ How to determine if a class implements a particular interface: http://groups.google.com/group/comp.lang.python/t/27ea61dd2aaa0fcb/ Igor Novikov provides a lovely small pure-Python extension to manage ARGB cursors in Tkinter. http://tkinter.unpy.net/wiki/tkXcursor Why does `some_integer += 1` create a new integer object instead of incrementing the current value? http://groups.google.com/group/comp.lang.python/t/25b921e3b00ec2ae/ Iterating and mutating a list from two or more threads: http://groups.google.com/group/comp.lang.python/t/b19381a806007f4d/ Mapping message identifiers to methods: http://groups.google.com/group/comp.lang.python/t/8f7f1771945b4add/ A class definition doesn't introduce a new lexical scope - and that's a Good Thing [long thread]: http://groups.google.com/group/comp.lang.python/t/2cd187fa256744fe/ A clean way of adding directories to the module search path: http://groups.google.com/group/comp.lang.python/t/9052cc623088bdb2/ Recipe: convert an existing module into a package or sub-package http://groups.google.com/group/comp.lang.python/t/9919cf2a60722344/ Tools for designing professional-looking applications for Windows: http://groups.google.com/group/comp.lang.python/t/d22dcd394ab08333/ The basics for doing Web applications in Python: http://groups.google.com/group/comp.lang.python/t/1176ea4e6814f466/ What CAN'T be done in Python? http://groups.google.com/group/comp.lang.python/t/a368e85aa85ab436/ Favorite debugging tools? http://groups.google.com/group/comp.lang.python/t/1efb7b97d5d94d9b/ In 3.1, print() requires the terminal to be correctly configured with respect to locale settings: http://groups.google.com/group/comp.lang.python/t/8e666bb7eae9c859/ Idea: expand the for statement to accept additional, nested 'for's and an '= if' clause: http://groups.google.com/group/comp.lang.python/t/83b1d70457345877/ Everything Python-related you want is probably one or two clicks away in these pages: Python.org's Python Language Website is the traditional center of Pythonia http://www.python.org Notice especially the master FAQ http://www.python.org/doc/FAQ.html PythonWare complements the digest you're reading with the marvelous daily python url http://www.pythonware.com/daily Just beginning with Python? This page is a great place to start: http://wiki.python.org/moin/BeginnersGuide/Programmers The Python Papers aims to publish the efforts of Python enthusiasts: http://pythonpapers.org/ The Python Magazine is a technical monthly devoted to Python: http://pythonmagazine.com Readers have recommended the Planet sites: http://planetpython.org http://planet.python.org comp.lang.python.announce announces new Python software. Be sure to scan this newsgroup weekly. http://groups.google.com/group/comp.lang.python.announce/topics Python411 indexes podcasts ... to help people learn Python ... Updates appear more-than-weekly: http://www.awaretek.com/python/index.html The Python Package Index catalogues packages. http://www.python.org/pypi/ Much of Python's real work takes place on Special-Interest Group mailing lists http://www.python.org/sigs/ Python Success Stories--from air-traffic control to on-line match-making--can inspire you or decision-makers to whom you're subject with a vision of what the language makes practical. http://www.pythonology.com/success The Python Software Foundation (PSF) has replaced the Python Consortium as an independent nexus of activity. It has official responsibility for Python's development and maintenance. http://www.python.org/psf/ Among the ways you can support PSF is with a donation. http://www.python.org/psf/donations/ The Summary of Python Tracker Issues is an automatically generated report summarizing new bugs, closed ones, and patch submissions. http://search.gmane.org/?author=status%40bugs.python.orggroup=gmane.comp.python.develsort=date Although unmaintained since 2002, the Cetus collection of Python hyperlinks retains a few gems. http://www.cetus-links.org/oo_python.html Python FAQTS
Sphinx 0.6.3 released
Hi all, I'm proud to announce the release of Sphinx 0.6.3, which is a bugfix-only release in the 0.6 series. What is it? === Sphinx is a tool that makes it easy to create intelligent and beautiful documentation for Python projects (or other documents consisting of multiple reStructuredText source files). Website: http://sphinx.pocoo.org/ What's new in 0.6.3 (short version)? Over 20 bugs and problems have been fixed. The full list is at http://sphinx.pocoo.org/changes.html. cheers, Georg -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Pydev 1.5.0 (Pydev Extensions open sourced)
Hi All, Today, Aptana is proud to announce that Pydev and Pydev Extensions have become a single plugin, with all the available contents open source (and freely available for anyone) in the 1.5.0 release (it's the same as 1.4.8 but with all the code open source). With that, Aptana believes in providing a better service and growth path for Pydev (which will still be actively maintained by Aptana), enabling anyone to provide contributions to the previously closed source product, while providing its Cloud customers a better service. Note for those already using Pydev or Pydev Extensions: The update site has been changed (see: http://www.pydev.org/download.html for more details) and if you had a previous install of Pydev Extensions, you need to uninstall it before installing the new version of Pydev. Note for developers: Pydev is now available under git (at github), and its previously used subversion will be disabled. Instructions on getting the source code from the new location is available at: http://www.pydev.org/developers.html Best Regards, -- Fabio Zadrozny Aptana http://aptana.com Pydev - Python Development Environment for Eclipse http://pydev.org http://pydev.blogspot.com -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
REMINDER: PyCon 2010: Call for Proposals
Call for proposals -- PyCon 2010 -- http://us.pycon.org/2010/ === Due date: October 1st, 2009 Want to showcase your skills as a Python Hacker? Want to have hundreds of people see your talk on the subject of your choice? Have some hot button issue you think the community needs to address, or have some package, code or project you simply love talking about? Want to launch your master plan to take over the world with python? PyCon is your platform for getting the word out and teaching something new to hundreds of people, face to face. Previous PyCon conferences have had a broad range of presentations, from reports on academic and commercial projects, tutorials on a broad range of subjects and case studies. All conference speakers are volunteers and come from a myriad of backgrounds. Some are new speakers, some are old speakers. Everyone is welcome so bring your passion and your code! We're looking to you to help us top the previous years of success PyCon has had. PyCon 2010 is looking for proposals to fill the formal presentation tracks. The PyCon conference days will be February 19-22, 2010 in Atlanta, Georgia, preceded by the tutorial days (February 17-18), and followed by four days of development sprints (February 22-25). Online proposal submission is open now! Proposals will be accepted through October 1st, with acceptance notifications coming out on November 15th. For the detailed call for proposals, please see: http://us.pycon.org/2010/conference/proposals/ For videos of talks from previous years - check out: http://pycon.blip.tv We look forward to seeing you in Atlanta! -- Aahz (a...@pythoncraft.com) * http://www.pythoncraft.com/ Look, it's your affair if you want to play with five people, but don't go calling it doubles. --John Cleese anticipates Usenet -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Re: Unable to install pywin32 for Python 2.6.2
En Thu, 03 Sep 2009 02:16:13 -0300, David Lees debl2nos...@verizon.net escribió: In case anyone else has this problem, my mistake was a PYTHONPATH that pointed to my Python 2.5 installation. I simply changed it to: C:\Python26\Lib\site-packages and reran the Pywin32 installer and all is fine. Assuming you installed Python into C:\Python26, then C:\Python26\Lib\site-packages is already on your Python search path; you don't even need to set PYTHONPATH at all. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: using queue
06:49:13 Scott David Daniels scott.dani...@acm.org wrote: Tim Arnold wrote: (1) what's wrong with having each chapter in a separate thread? Too much going on for a single processor? Many more threads than cores and you spend a lot of your CPU switching tasks. In fact, python threads work relatively the best with a powerful single core; with more cores it becomes being suprisingly inefficient. The culprit is Pythn GIL and the way it [mis]cooperates with OS scheduling. See: http://www.dabeaz.com/python/GIL.pdf Yo *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple addition to random module - Student's t
Robert Kern wrote: On 2009-09-02 14:15 PM, Raymond Hettinger wrote: On Sep 2, 6:51 am, Thomas Philipstkp...@gmail.com wrote: While the random module allows one to generate randome numbers with a variety of distributions, some useful distributions are omitted - the Student's t being among them. I'm curious to hear what your use cases are. My understanding is that t-distribution is an estimation tool used with small samples of a population where the variance or standard deviation is unknown. So, when do you ever need to generate random variables with this distribution? ISTM that this is akin to wanting a generator for a Kolmogorov distribution -- usually the distribution is used to test empirical data, not to generate it. In more complicated models, estimates of one parameter need to be propagated through the model, particularly if you are looking at sensitivity to parameters. Student's t describes the variation of an estimate of a mean of a sample from a Gaussian distribution. If I were modeling a processing wherein someone makes an estimate of a mean and then acts on that estimate, I would want to generate random t variates to feed that model. I think most of the existing generators were chosen because they are useful in simulation programs. AFAICT, the Student's t- distribution doesn't fall into that category (usually, you know the population standard deviation when you're the one generating data). Student's t distribution is also used as a sort of generic fat-tailed distribution in some models and is not tied to the estimate of a mean description. Yes. One can run the simulation with various df's to see the effect of such data and possibly how and when a model breaks. ISTM, there ought to be a statistics module that can calculate cumulative distribution functions for a variety of distributions. This would be far more helpful than creating more generators. Yes, scipy.stats. Is that stable enough so that all or part could be added to stdlib? tjr -- http://mail.python.org/mailman/listinfo/python-list
Re: Why does this group have so much spam?
Steven D'Aprano wrote: On Wed, 02 Sep 2009 15:22:08 -0400, Terry Reedy wrote: the conclusion you do. But I read your argument as being that having an open wi-fi connection was prima facie evidence of intent to commit crime regardless of whether you were a public advocate or not. Perhaps I misunderstood. Yes, as you realized later. So it's the *advocacy* (for the purposes of alibi) which is evidence of wrong-doing? I said 'reason for me to be suspicious' rather than 'courtroom evidence'. Not the open windows themselves? Correct. The vast majority of open WiFi is due to ignorance or insufficient motivation to jump through the hoops needed to add units to a closed network. (I believe this can and should be easier, but that is another topic.) The other advocated reason is basically to 'stick it to the corporation', under the delusion that it is possible to hurt the fictitious 'legal person' rather than the real people how are owners, workers, and other customers. ISP's price residential service based on average fixed cost and average usage. Multiple homes using one connection push those averages up. Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: An iteration idiom (Was: Re: [Guppy-pe-list] loading files containing multiple dumps)
Raymond Hettinger wrote: In the first case, you would write: sets.extend(h.load(f)) yes, what I had was: for s in iter(h.load(f)): sets.append(s) ...which I mistakenly thought was working, but in in fact boils down to Raymond's code. The problem is that each item that h.load(f) returns *is* actually an iterable, so either of the above just ends up the contents of each set being extended onto `sets` rather than the sets themselved. It's all really rather confusing, apologies if there's interspersed rant in here: from guppy import hpy h = hpy() Minor rant, why do I have to instantiate a class 'guppy.heapy.Use._GLUECLAMP_' to do anything with heapy? Why doesn't heapy just expose load, dump, etc? (oh, and reading the code for guppy.heapy.Use and its ilk made me go temporarily blind!) ;-) f = open('copy.hpy') s = h.load(f) Less minor rant: this applies to most things to do with heapy... Having __repr__ return the same as __str__ and having that be a long lump of text is rather annoying. If you really must, make __str__ return the big lump of text but have __repr__ return a simple, short, item containing the class, the id, and maybe the number of contained objects... Anyway... id(s) 13905272 len(s) 192 s.__class__ class guppy.heapy.Part.Stat at 0x00CD6A20 i = s[0] id(i) 13904112 len(i) 1 i.__class__ class guppy.heapy.Part.Stat at 0x00CD6A20 Hmmm, I'm sure there's a good reason why an item in a set has the exact same class and iterface as a whole set? It feels like some kind of filtering, where are the docs that explain all this? cheers, Chris -- Simplistix - Content Management, Batch Processing Python Consulting - http://www.simplistix.co.uk -- http://mail.python.org/mailman/listinfo/python-list
Re: string find mystery
I have come across this very strange behaviour. Check this code: if file_str.find('Geometry'): While the anser is to compare the results of .find() with -1, but the more Pythonic answer is just to use in: if Geometry in file_str: which reads a lot more cleanly, IMHO. -tkc -- http://mail.python.org/mailman/listinfo/python-list
match braces?
Hello In C/C++ you use the braces where as in Python you use the indentation levels. Most editors offer a Ctrl+[ to match the braces so that you can easily identify the scopes (more correctly statements blocks). I am finding it difficult to see blocks and/or jump from end to start with some IDE hotkeys, when coding in Python. Any advise? Thanks, Elias -- http://mail.python.org/mailman/listinfo/python-list
Re: match braces?
On Thu, Sep 3, 2009 at 2:38 AM, lallouslall...@lgwm.org wrote: Hello In C/C++ you use the braces where as in Python you use the indentation levels. Most editors offer a Ctrl+[ to match the braces so that you can easily identify the scopes (more correctly statements blocks). I am finding it difficult to see blocks Erm, how does the indentation itself not make it plainly and explicitly clear? Perhaps you need to set your tabstops wider? Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list
Re: match braces?
In C/C++ you use the braces where as in Python you use the indentation levels. Most editors offer a Ctrl+[ to match the braces so that you can easily identify the scopes (more correctly statements blocks). I am finding it difficult to see blocks and/or jump from end to start with some IDE hotkeys, when coding in Python. Any advise? Any editor worth its salt will offer indentation-based folding (I know vim does, and I would be astonished if emacs didn't. With other editors, YMMV). You can just collapse the indented section to get a big-picture view. -tkc -- http://mail.python.org/mailman/listinfo/python-list
Modifying a textfile
Hi! So I got this big textfile. It's full of data from a database. About 150 or more rows or lines in a textfile. There's three first rows that belong to the same subject. And then next three rows belong to another subject and so on, to the end of the file. What I need to do, is put the three rows that goes together and belong to certain subject, on a one line in the output textfile. And the next three rows again on a one new line. And that goes with the rest of the data to the end of the new file. Can't figure out a working loop structure to handle this. Thanks! OV -- http://mail.python.org/mailman/listinfo/python-list
Re: Modifying a textfile
On Thu, Sep 3, 2009 at 3:21 AM, Olli Virtallvi...@gmail.com wrote: Hi! So I got this big textfile. It's full of data from a database. About 150 or more rows or lines in a textfile. There's three first rows that belong to the same subject. And then next three rows belong to another subject and so on, to the end of the file. What I need to do, is put the three rows that goes together and belong to certain subject, on a one line in the output textfile. And the next three rows again on a one new line. And that goes with the rest of the data to the end of the new file. Can't figure out a working loop structure to handle this. #completely untested from itertools import izip_longest #from itertools recipes def grouper(n, iterable, fillvalue=None): grouper(3, 'ABCDEFG', 'x') -- ABC DEF Gxx args = [iter(iterable)] * n return izip_longest(fillvalue=fillvalue, *args) output = file(output_file.whatever, 'w') f = file(input_file.whatever, 'r') for triple in grouper(3, f): triple = triple.replace('\n', '') output.write(triple) output.write('\n') Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: your favorite debugging tool?
On Aug 25, 2:55 pm, Esmail ebo...@hotmail.com wrote: Re pdb, if you have a 'pointer' (ie reference) to an object, is there an easy way to dump out its contents, ie all of its members short of writing a method that does that and then calling it? Usually pp vars(your_object) does what you want -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple addition to random module - Student's t
On Wed, Sep 2, 2009 at 2:15 PM, Raymond Hettinger pyt...@rcn.com wrote: ISTM, there ought to be a statistics module that can calculate cumulative distribution functions for a variety of distributions. This would be far more helpful than creating more generators. Many of the formulas for cumulative distribution functions require math functions not currently provided by Python (erf, gamma, etc.). (http://bugs.python.org/issue3366 includes a patch to provide them) -- Daniel Stutzbach, Ph.D. President, Stutzbach Enterprises, LLC http://stutzbachenterprises.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem w/ mysqldump
On Wed, Sep 02, 2009 at 04:45:02PM -0400, Victor Subervi wrote: I tried running it like you said, got this error: 'mysqldump' is not a recognized internal or external command. If I could just figure out in what file the data were stored, I could copy it and try it in another computer. Any ideas? OK, that makes more sense now. It's not truly a Python problem at all, but rather an issue with the MySQL install/config on Windows. As somebody else pointed out, you are supposed to run the 'mysqldump' command from the command prompt, which in the case of Windows is the cmd.exe, as far as I remember: Start -- Run -- command I'm not familiar enough with Windows though. I haven't run it in years. However, the following URL may be of some help: http://www.vbulletin.com/forum/showthread.php?t=68822 Judging by that, MySQL's binaries may not be in your path by default when you run it on Windows. If that's the case, you may have to add it (search around for info on how to add new directories to your path in Windows' terminal) or simply specify the absolute path to the command in the Python script, instead of just passing 'mysqldump'. This other exchange from a forum may also help: http://forums.mysql.com/read.php?35,144934,144960#msg-144960 -- http://mail.python.org/mailman/listinfo/python-list
Re: Entry Level Python Jobs
On Wed, Sep 02, 2009 at 08:31:20AM -0700, JonathanB wrote: I am a self-taught Python programmer with a liberal arts degree (Cross- cultural studies). I have been programming for several years now and would like to get a job as a python programmer. Unfortunately most of the job posts I have seen are for CS Majors or people with experience. Is there a place I can look for job posts for entry level positions requiring no experience? For the hiring managers, if the job post said CS Major in the requirements, would you consider a liberal arts major at all? I have a liberal arts degree and have been working in the field for years now, not as a programmer but as a high-level technical support engineer (doing core dump analysis and the like). While I opted for not working as a programmer, other co-workers without a CompSci degree have managed to do so without major problems. It seems to me that most managers are willing to hire someone based on his/her experience and proven knowledge, and not so much on the actual degree you have. Obviously, this means you will need to get some experience before moving into actual programming. So, what would I recommend? First of all, make sure you get your foot in the door. Apply for an entry-level position at a company that works in the technology field, even if it's doing technical support or writing documentation. Once you are in, work hard, show an interest in learning programming skills, talk to the developers in the company, survey people around and try to figure out where there is a need that can be met with a not-yet-written application and put it together yourself, then show it to your manager and try to convince him/her to deploy it as an official tool for your team. I've seen this work many times. Second, search around for open source projects that may look interesting to you, download the source code, study it, subscribe to their development mailing list, check out standing bugs and see if you can fix them. This is something you can definitely add to your resume. -- http://mail.python.org/mailman/listinfo/python-list
Re: Modifying a textfile
On Thu, 03 Sep 2009 03:21:25 -0700, Olli Virta wrote: What I need to do, is put the three rows that goes together and belong to certain subject, on a one line in the output textfile. And the next three rows again on a one new line. And that goes with the rest of the data to the end of the new file. Can't figure out a working loop structure to handle this. The basic algorithm is: - grab three lines from the input file - write to the output file - repeat until done There are lots of ways to do this. Here's one: # untested out = file(outfile, 'w') in_ = file(infile, 'r') while True: # Grab three lines. a = in_.readline() if a == '': # Nothing more to read, we're done. break b = in_.readline() c = in_.readline() out.write(a.rstrip() + ' ') out.write(b.rstrip() + ' ') out.write(c.rstrip() + '\n') out.close() in_.close() Here's another version: # untested out = file(outfile, 'w') accumulator = [] for line in file(infile, 'r'): if len(accumulator) == 3: out.write(%s %s %s\n % tuple(accumulator)) accumulator = [] accumulator.append(line.rstrip()) if accumulator: out.write(%s %s %s\n % tuple(accumulator)) out.close() Chris has posted another method, using itertools. That's probably faster for very large files, but less readable. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Annoying octal notation
In article 6031ba08-08c8-416b-91db-ce8ff57ae...@w6g2000yqw.googlegroups.com, James Harris james.harri...@googlemail.com wrote: SNIP So you are saying that Smalltalk has base in decimalrnumber where r is presumably for radix? That's maybe best of all. It preserves the syntactic requirement of starting a number with a digit and seems to have greatest flexibility. Not sure how good it looks but it's certainly not bad. 0xff 0x0e | 0b1101 16rff 16r0e | 2r1101 Hmm. Maybe a symbol would be better than a letter. Like 0#ff 16#ff ? That is ALGOL68. It is incredible how many of it has become vindicated over time. (Yes, nineteen hundred sixty eight was the year that language was conceived.) James Groetjes Albert -- -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. alb...@spearc.xs4all.nl =n http://home.hccnet.nl/a.w.m.van.der.horst -- http://mail.python.org/mailman/listinfo/python-list
Re: recursive decorator
On Sep 3, 12:19 am, Ethan Furman et...@stoneleaf.us wrote: Greetings, List! The recent thread about a recursive function in a class definition led me back to a post about bindfunc from Arnaud, and from there I found Michele Simionato's decorator module (many thanks! :-), and from there I began to wonder... from decorator import decorator @decorator def recursive1(func, *args, **kwargs): return func(func, *args, **kwargs) @recursive1 def factorial1(recurse, n): if n 2: return 1 return n * recurse(n-1) factorial(4) TypeError: factorial1() takes exactly 2 arguments (1 given) What are you trying to do here? I miss why you don't use the usual definition of factorial. If you have a real life use case which is giving you trouble please share. I do not see why you want to pass a function to itself (?) M. Simionato -- http://mail.python.org/mailman/listinfo/python-list
Re: Annoying octal notation
In article mailman.591.1251468775.2854.python-l...@python.org, MRAB pyt...@mrabarnett.plus.com wrote: Steven D'Aprano wrote: SNIP Obviously I can't speak for Ken Thompson's motivation in creating this feature, but I'm pretty sure it wasn't to save typing or space on punchcards. Even in 1969, hex was more common than octal, and yet hex values are written with 0x. My guess is that he wanted all numbers to start with a digit, to simplify parsing, and beyond that, it was just his programming style -- why call the copy command `copy` when you could call it `cp`? (Thompson was the co-inventor of Unix.) Maybe it was because they were working on minicomputers, not mainframes, so there was less processing power and storage available. Not just any minicomputers: PDP11. Octal notation is friendly with the PDP11 instruction set. Groetjes Albert -- -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. alb...@spearc.xs4all.nl =n http://home.hccnet.nl/a.w.m.van.der.horst -- http://mail.python.org/mailman/listinfo/python-list
Re: string find mystery
On Thursday 03 September 2009 07:10:37 Helvin wrote: Hi, I have come across this very strange behaviour. Check this code: if file_str.find('Geometry'): #if file_str.endswith('Data_Input_Geometry.txt'): print 'I found geometry' elif file_str.find('Material'): print 'I found material' The amazing thing is when file_str = 'C:\Qt\SimLCM\Default \Data_Input_Material.txt', the first if statement if fulfilled, that seemingly says that in this file_str, python actually finds the word 'Geometry'. I know this, because the line: 'I found geometry' is printed. However, if instead of using file_str.find(), I use file_str.endswith(), it does not exhibit this strange behaviour. Obviously, I want the elif line to be true, instead of the first if statement. Does anyone know why this is happening? Help much appreciated! The interactive Interpreter is your friend: s = a;kljghkahklahdfgkjahdfhadafjd;l s.find(banana) -1 bool(_) True - Hendrik -- http://mail.python.org/mailman/listinfo/python-list
Re: Entry Level Python Jobs
On Sep 2, 5:31 pm, JonathanB doulo...@gmail.com wrote: I am a self-taught Python programmer with a liberal arts degree (Cross- cultural studies). I have been programming for several years now and would like to get a job as a python programmer. Unfortunately most of the job posts I have seen are for CS Majors or people with experience. Is there a place I can look for job posts for entry level positions requiring no experience? For the hiring managers, if the job post said CS Major in the requirements, would you consider a liberal arts major at all? Requiring a CS Major does not make sense. Sensible employers asks for programmers that know how to program, not for a piece of paper. For instance, at work here nobody has a CS degree, but still I would say that we have very competent programmers. You need a way to prove that you are a competent programmer. Partecipating to Open Source projects, writing articles about programming or having a technical blog are ways to show your expertise. Here when we hire people we look at their posts in public newsgroups. I find the quality of the posts a very good indicator of the quality of the perspective employees. -- http://mail.python.org/mailman/listinfo/python-list
Re: Entry Level Python Jobs
On Sep 3, 9:19 am, steve st...@lonetwin.net wrote: On 09/03/2009 09:36 AM, steve wrote: Hi Jonathan, [...snip...] I feel stupid replying to my own post but just one more thing i thought about mentioning but forgot to add: - Look at your Liberal Arts major as an advantage. Every field has a 'computing gap' that needs to be filled but cannot be done because they aren't any too many good people who have the relevant cross-domain knowledge. For instance, one of the reasons I think this month's sourceforge.net project of the month is really great is because the lead dev. has a CS degree and is listed as being a medicine student:http://sourceforge.net/community/potm-200909/ So, look for these gaps in your domain which can be filled using your technical knowledge. again, .. Wish you the best, regards, - steve -- random non tech spiel:http://lonetwin.blogspot.com/ tech randomness:http://lonehacks.blogspot.com/ what i'm stumbling into:http://lonetwin.stumbleupon.com/ Also, I think topcoder.com is a good place for him. I have not used them much, but their business plan -- of asking medium to difficult questions every week, and contacting people who solves them with jobs -- is quite sound. Try that too. -- http://mail.python.org/mailman/listinfo/python-list
obscure problem using elementtree to make xhtml website
Elementtree (python xml parser) will transform markup like tag boo=baa/tag into tag boo=baa / which is a reasonable thing to do for xml (called minimization, I think). But this caused an obscure problem when I used it to create the xhtml parts of my website, causing Internet Explorer to display nearly blank pages. I explain the details at http://lee-phillips.org/scripttag/ and am writing here as a heads-up to anyone who might be using a workflow similar to mine: writing documents in xml and using python and elementtree to transform those into xhtml webpages, and using the standard kludge of serving them as text/html to IE, to get around the latter's inability to handle xml. I can't be the only one (and I doubt this problem is confined to elementtree). Lee Phillips -- http://mail.python.org/mailman/listinfo/python-list
Re: Annoying octal notation
On Aug 21, 2:45 pm, John Nagle na...@animats.com wrote: snip In 2009, Unisys finally exited the mainframe hardware business, and the last of the 36-bit machines, the ClearPath servers, are being phased out. That line of machines goes back to the UNIVAC 2200 series, and the UNIVAC 1100 series, all the way back to the vacuum-tube UNIVAC 1103 from 1952. It's the longest running series of computers in history, and code for all those machines used octal heavily. You're right that the 36-bit machines rely heavily on octal notation. However, Unisys has not exited the hardware business. The descendants of the original 36-bit 1100-series machines are now called Dorado. Unisys announced new models as recently as May 2009 (see http://unisys.com/unisys/news/detail.jsp?id=1694). I have the extreme pleasure of supporting a Dorado 180 and writing Python code on Windows--the best of both worlds! Cheers, Steve J. Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: match braces?
Tim Chase python.l...@tim.thechases.com writes: Any editor worth its salt will offer indentation-based folding (I know vim does, and I would be astonished if emacs didn't. Emacs calls that “hide/show”, and the ‘hs-minor-mode’ can be enabled for any buffer (and can thus of course be automatically enabled on defined conditions, e.g. whenever a Python buffer is detected). Learn more at URL:http://www.emacswiki.org/cgi-bin/wiki/HideShow. -- \ “Creativity can be a social contribution, but only in so far as | `\society is free to use the results.” —Richard Stallman | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: python daemon - compress data and load data into MySQL by pyodbc
Sean DiZazzo wrote: On Sep 2, 8:36 pm, MacRules macru...@nome.com wrote: Hi, I installed Python daemon, pyodbc module to access the back-end DB server. My setup is like this load data job - Python Daemon A, port 6000 - Python Daemon B, port 7000 - MySQL Daemon A will perform data compression, such as GZIP, and send over data to Daemon B. Daemon B will perform data uncompression, GUNZIP, and insert records to MySQL or MSSQL or Oracle. Where should I start this to code this? Can someone give me a hint, as detail as possible here? I am a python newbie. Thanks for all the help I can get, Start by reading the tutorial. http://docs.python.org/tutorial/ ~Sean Are you a Python expert? Can you show me the basic coding to get a Daemon (pass through insert data) up and insert to the backend MySQL? -- http://mail.python.org/mailman/listinfo/python-list
Re: obscure problem using elementtree to make xhtml website
Lee wrote: Elementtree (python xml parser) will transform markup like tag boo=baa/tag into tag boo=baa / which is a reasonable thing to do for xml (called minimization, I think). But this caused an obscure problem when I used it to create the xhtml parts of my website, causing Internet Explorer to display nearly blank pages. I explain the details at http://lee-phillips.org/scripttag/ and am writing here as a heads-up to anyone who might be using a workflow similar to mine: writing documents in xml and using python and elementtree to transform those into xhtml webpages, and using the standard kludge of serving them as text/html to IE, to get around the latter's inability to handle xml. I can't be the only one (and I doubt this problem is confined to elementtree). Lee Phillips It's not just Elementtree that does this .. I've seen others libraries (admittedly in other languages I won't mention here) transform empty tags to the self-terminating form. A whitespace text node or comment node in between *should* prevent that from happening. AFAIK, the only tag in IE xhtml that really doesn't like to be reduced like that is the script tag. Firefox seems to be fine w/ self-terminating script / tags. At any rate, I tend to put a comment node in between the begin and end to prevent the reduction: script src= ... type=text/javascript!-- --/script --David -- http://mail.python.org/mailman/listinfo/python-list
Re: Annoying octal notation
In article 6b5ea596-d1e3-483d-ba79-7b139d3c7...@z24g2000yqb.googlegroups.com, Bearophile bearophileh...@lycos.com wrote: MRAB: '_': what if in the future we want to allow them in numbers for clarity? Hettinger says it's hard (= requires too many changes) to do that and Python programs don't have big integer constants often enough, so probably that improvement will not see the light. In the meantime in a Python program of mine I have put a small bug, writing 100 instead of 1000. Now in Python I write 10*1000*1000, because I try to learn from my bugs. In D I enjoy writing 10_000_000. Forth is one of the few language that could accept 10,000,000 easily (Because numbers or any token is required too be separated by whitespace). I have added that to my ciforth. Especially useful doing number theoretic things and large pointers in a 64 bit language it is pleasant to have a separator like that. Even 32 bit : 0008,,0050,4CE0 Also: In Forth you can add interpreting words, so you can add a facility CD : CD C:/prog/forth that does a directory change. If this has been loaded it is natural to use 0CD to prevent the CD word from kicking in (definitions trump numbers in Forth.) Before you know it, you're in the habit of prefixing all hex numbers by 0 if they don't start with a decimal digit: 0DEAD 0BEEF So for me there is nothing natural about leading zero means octal. --- Steven D'Aprano: In D, at least some people want to follow Python's lead and either drop support for oct literals completely, or require a 0o prefix:http://d.puremagic.com/issues/show_bug.cgi?id=2656 Yes, people in the D community are trying to improve things, but it's a slow and painful process, and often it goes nowhere. There's lot of politics. There is legacy code, of course. Bye, bearophile Groetjes Albert -- -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. alb...@spearc.xs4all.nl =n http://home.hccnet.nl/a.w.m.van.der.horst -- http://mail.python.org/mailman/listinfo/python-list
Re: Annoying octal notation
In article mailman.346.1251135629.2854.python-l...@python.org, Derek Martin c...@pizzashack.org wrote: --W1uEbMXJ1Mj4g6TI Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline On Mon, Aug 24, 2009 at 05:03:28PM +, Steven D'Aprano wrote: On Mon, 24 Aug 2009 11:21:46 -0500, Derek Martin wrote: since the old syntax is prevalent both within and without the Python community, making the change is, was, and always will be a bad idea. Octal syntax isn't prevalent *at all*, except in a small number of niche areas. Steven, don't be obtuse. Where octal is used in programming, the leading zero is prevalent. That is not the point. Octal is not prevalent. Leading zero's have a mathematical sound meaning. The convention is changed because every new user to Python will fall once into this trap. For a person not familiar with C or the like this will be a hair pulling, nail byting, head banging situation. A mathematician might even think he is gone mad. Regarding you, you will probably have noticed by now that it is going to change, so you will not pull your hair, byte your nails or bang your head. The more so because the new Python interpreter will warn you with a nice friendly message. The sacrifice asked from you is small, but all in all it is big win for humanity at large. Derek D. Martin Groetjes Albert -- -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. alb...@spearc.xs4all.nl =n http://home.hccnet.nl/a.w.m.van.der.horst -- http://mail.python.org/mailman/listinfo/python-list
Re: Modifying a textfile
On Sep 3, 2:21 pm, Olli Virta llvi...@gmail.com wrote: Hi! So I got this big textfile. It's full of data from a database. About 150 or more rows or lines in a textfile. There's three first rows that belong to the same subject. And then next three rows belong to another subject and so on, to the end of the file. What I need to do, is put the three rows that goes together and belong to certain subject, on a one line in the output textfile. And the next three rows again on a one new line. And that goes with the rest of the data to the end of the new file. Can't figure out a working loop structure to handle this. Thanks! OV Straightforward generator version. src = file('test_in.txt', 'r') dst = file('test_out.txt', 'w') def reader(src): count, lines = 0, '' for line in src: if count 2: lines += line.strip() count += 1 else: yield lines + line count, lines = 0, '' if lines: yield lines + '\n' for lines in reader(src): dst.write(lines) -- http://mail.python.org/mailman/listinfo/python-list
Re: python daemon - compress data and load data into MySQL by pyodbc
MacRules wrote: Sean DiZazzo wrote: On Sep 2, 8:36 pm, MacRules macru...@nome.com wrote: Hi, I installed Python daemon, pyodbc module to access the back-end DB server. My setup is like this load data job - Python Daemon A, port 6000 - Python Daemon B, port 7000 - MySQL Daemon A will perform data compression, such as GZIP, and send over data to Daemon B. Daemon B will perform data uncompression, GUNZIP, and insert records to MySQL or MSSQL or Oracle. Where should I start this to code this? Can someone give me a hint, as detail as possible here? I am a python newbie. Thanks for all the help I can get, Start by reading the tutorial. http://docs.python.org/tutorial/ ~Sean Are you a Python expert? Can you show me the basic coding to get a Daemon (pass through insert data) up and insert to the backend MySQL? You've asked a rather large and non-specific question. What avenues have you explored so far? Can you describe the problem this is designed to solve? --David -- http://mail.python.org/mailman/listinfo/python-list
Re: Python on the Web
Ed Singleton a écrit : On Aug 26, 4:17 am, alex23 wuwe...@gmail.com wrote: Frameworks created for the sake of creating a framework, as opposed to those written to meet a defined need, tend to be the worst examples of masturbatory coding. Indeed, but masturbation is perfectly healthy and acceptable, and we all do it every now and then. It is however, much like the framework in question, best kept private and not made public. +1 QOTW !-) -- http://mail.python.org/mailman/listinfo/python-list
Re: match braces?
On 2009-09-03, Ben Finney ben+pyt...@benfinney.id.au wrote: Tim Chase python.l...@tim.thechases.com writes: Any editor worth its salt will offer indentation-based folding (I know vim does, and I would be astonished if emacs didn't. Emacs calls that ???hide/show???, and the ???hs-minor-mode??? can be enabled for any buffer (and can thus of course be automatically enabled on defined conditions, e.g. whenever a Python buffer is detected). Learn more at URL:http://www.emacswiki.org/cgi-bin/wiki/HideShow. There's only one problem: it doesn't work out-of-the-box. At least it never has for me. The only thing it knows how to hide is the entire body of a function definition. I never want to do that. What I want to do is hide/unhide the blocks within if/then/else or loops so that the control flow is clearer. Emacs hs-minor-mode won't do that (at least not for me). ISTR that you are supposed to be able to get it working by replacing python-mode with some after-market version and then patching the hide-show code or something like that -- but I've never been brave enough (or bored enough) to attempt it. -- Grant Edwards grante Yow! Not SENSUOUS ... only at FROLICSOME ... and in visi.comneed of DENTAL WORK ... in PAIN!!! -- http://mail.python.org/mailman/listinfo/python-list
Re: obscure problem using elementtree to make xhtml website
I went with a space, but a comment is a better idea. I only mention the script tag in my article, for brevity, but I had the same problem with the object tag: basically any tag that can have content in html you had better close the html way (tag/tag), or IE will see it as unclosed and will not display the rest of the page after the tag (or do something else unexpected). Not a bug in IE (this time), which is correctly parsing the file as html. Lee -- http://mail.python.org/mailman/listinfo/python-list
Re: Annoying octal notation
On 2009-09-03, Albert van der Horst alb...@spenarnc.xs4all.nl wrote: In article mailman.591.1251468775.2854.python-l...@python.org, MRAB pyt...@mrabarnett.plus.com wrote: Steven D'Aprano wrote: SNIP Obviously I can't speak for Ken Thompson's motivation in creating this feature, but I'm pretty sure it wasn't to save typing or space on punchcards. Even in 1969, hex was more common than octal, and yet hex values are written with 0x. My guess is that he wanted all numbers to start with a digit, to simplify parsing, and beyond that, it was just his programming style -- why call the copy command `copy` when you could call it `cp`? (Thompson was the co-inventor of Unix.) Maybe it was because they were working on minicomputers, not mainframes, so there was less processing power and storage available. Not just any minicomputers: PDP11. Octal notation is friendly with the PDP11 instruction set. Indeed. Octal was the way that all of the DEC PDP-11 sw tools displayed machine code/data. -- Grant Edwards grante Yow! My CODE of ETHICS at is vacationing at famed visi.comSCHROON LAKE in upstate New York!! -- http://mail.python.org/mailman/listinfo/python-list
Re: Python on the Web
John Nagle a écrit : (snip) MySQLdb is available only up to Python 2.5. Huh ??? Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] on linux2 Type help, copyright, credits or license for more information. import MySQLdb /var/lib/python-support/python2.6/MySQLdb/__init__.py:34: DeprecationWarning: the sets module is deprecated from sets import ImmutableSet cnx = MySQLdb.connect(db='cress', user='cress', passwd='cress') cursor = cnx.cursor() cursor.execute(SELECT id_article, titre FROM spip_articles) 28L for row in cursor: ... print row ... (1L, '01. Sensibilisation') (2L, '02. Gestation') (3L, '03. Lancement') (4L, '04. D\xe9veloppement') (5L, '01. Sensibilisation') (6L, '02. Gestation') (7L, '03. Lancement') (8L, '04. D\xe9veloppement') (9L, '01. Sensibilisation') (10L, '02. Gestation') (11L, '03. Lancement') (12L, '04. D\xe9veloppement') (13L, 'Nouvel article') (14L, 'Nouvel article') (15L, '01. Les principes fondateurs d\x92une coop\xe9rative') (16L, '02. C\x92est quoi une COOPERATIVE ?') (17L, '10. Les principes fondamentaux de l\x92Economie sociale et solidaire') (18L, '20. Les familles de l\x92Economie sociale et solidaire ') (19L, 'Article 1') (20L, 'Article 2') (21L, 'Article 3') (22L, 'Article 4') (23L, 'Article 5') (24L, 'Lancement du nouveau site de la CRESS') (25L, 'Mise \xe0 jour des Formations') (26L, La CRESS au Salon de l'Emploi) (27L, '01. Pr\xe9sentation') (28L, '20. Les formations universitaires BAC +3') cursor.close() cnx.close() Seems to work just fine here... -- http://mail.python.org/mailman/listinfo/python-list
Re: Creating slice notation from string
On Sep 2, 3:55 pm, bvdp b...@mellowood.ca wrote: I'm trying to NOT create a parser to do this and I'm sure that it's easy if I could only see the light! Is it possible to take an arbitrary string in the form 1:2, 1, :-1, etc. and feed it to slice() and then apply the result to an existing list? For example, I have a normal python list. Let's say that x = [1,2,3,4] and I have a string, call it s', in the format [2:3]. All I need to do is to apply s to x just like python would do. I can, of course, convert x to a list with split(), convert the 2 and 3 to ints, and then do something like: x[a:b] ... but I'd like something more general. I think the answer is in slice() but I'm lost. Thanks. You might also consider looking at the operator module, which provides to potentially useful methods - itemgetter and getslice. Neither will directly use the string containing the bare slice notation, however they do provide another alternative to directly using eval. ~G -- http://mail.python.org/mailman/listinfo/python-list
Question about apply
Hi, I'm using apply to pass keyword arguments as a dictionary to a funcion at runtime (which keyword arguments to pass is only known at runtime) apply is very handy for this, because it takes a dictionary of keyword arguments directly def f1(a=None,b=None,c=None): pass kw={'a':1} apply(f1,[],kw) But I read in the doc that apply is deprecated. What is the non-deprecated way of doing this? Many thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: python daemon - compress data and load data into MySQL by pyodbc
MacRules macru...@nome.com writes: Are you a Python expert? This group has many Python experts, and even more people who can no doubt help you if you are able to articulate what you need help with. To help dispel a possible misunderstanding: Don't expect to have a one-on-one conversation with a single devoted correspondent here. We prefer to have these discussions in a manner open for contributions from everyone, to maximise the benefit for future readers and the chance of correcting errors. Can you show me the basic coding to get a Daemon (pass through insert data) up and insert to the backend MySQL? This doesn't make a whole lot of sense to me; it sounds like a conflation of two separate problems that would be best tackled separately. Can you re-phrase it, perhaps by describing the problem you're actually trying to solve? On the topic of implementing a daemon process in Python, there is the ‘python-daemon’ library URL:http://pypi.python.org/pypi/python-daemon which I hope you will find useful. If you can describe what you're actually trying to do, perhaps it will be clearer whether this library is a good fit. -- \ “If you're not part of the solution, you're part of the | `\ precipitate.” —Steven Wright | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: Annoying octal notation
On 3 Sep, 14:26, Albert van der Horst alb...@spenarnc.xs4all.nl wrote: In article 6031ba08-08c8-416b-91db-ce8ff57ae...@w6g2000yqw.googlegroups.com, James Harris james.harri...@googlemail.com wrote: SNIP So you are saying that Smalltalk has base in decimalrnumber where r is presumably for radix? That's maybe best of all. It preserves the syntactic requirement of starting a number with a digit and seems to have greatest flexibility. Not sure how good it looks but it's certainly not bad. 0xff 0x0e | 0b1101 16rff 16r0e | 2r1101 Hmm. Maybe a symbol would be better than a letter. Like 0#ff 16#ff ? Yes, that looks better. That is ALGOL68. It is incredible how many of it has become vindicated over time. (Yes, nineteen hundred sixty eight was the year that language was conceived.) Yes, and its predecessor Algol 60 was a masterful advance in programming languages. It set up standards we still use today. James -- http://mail.python.org/mailman/listinfo/python-list
Re: Annoying octal notation
On 3 Sep, 15:35, Grant Edwards inva...@invalid wrote: ... Obviously I can't speak for Ken Thompson's motivation in creating this feature, but I'm pretty sure it wasn't to save typing or space on punchcards. Even in 1969, hex was more common than octal, and yet hex values are written with 0x. My guess is that he wanted all numbers to start with a digit, to simplify parsing, and beyond that, it was just his programming style -- why call the copy command `copy` when you could call it `cp`? (Thompson was the co-inventor of Unix.) Maybe it was because they were working on minicomputers, not mainframes, so there was less processing power and storage available. Not just any minicomputers: PDP11. Octal notation is friendly with the PDP11 instruction set. Indeed. Octal was the way that all of the DEC PDP-11 sw tools displayed machine code/data. True. Octal was default in Macro-11 and what surprises me is that when I used it it seemed natural to think in octal (or, preferably, hex) rather than decimal. James -- http://mail.python.org/mailman/listinfo/python-list
Re: Annoying octal notation
On 3 Sep, 15:54, Albert van der Horst alb...@spenarnc.xs4all.nl wrote: In article mailman.346.1251135629.2854.python-l...@python.org, Derek Martin c...@pizzashack.org wrote: --W1uEbMXJ1Mj4g6TI Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline On Mon, Aug 24, 2009 at 05:03:28PM +, Steven D'Aprano wrote: On Mon, 24 Aug 2009 11:21:46 -0500, Derek Martin wrote: since the old syntax is prevalent both within and without the Python community, making the change is, was, and always will be a bad idea. Octal syntax isn't prevalent *at all*, except in a small number of niche areas. Steven, don't be obtuse. Where octal is used in programming, the leading zero is prevalent. That is not the point. Octal is not prevalent. Leading zero's have a mathematical sound meaning. The convention is changed because every new user to Python will fall once into this trap. For a person not familiar with C or the like this will be a hair pulling, nail byting, head banging situation. A mathematician might even think he is gone mad. Regarding you, you will probably have noticed by now that it is going to change, so you will not pull your hair, byte your nails The first time you wrote, byte your nails, I thought you meant it as a pun. But since you've mentioned it twice James -- http://mail.python.org/mailman/listinfo/python-list
Re: Question about apply
jorma kala wrote: Hi, I'm using apply to pass keyword arguments as a dictionary to a funcion at runtime (which keyword arguments to pass is only known at runtime) apply is very handy for this, because it takes a dictionary of keyword arguments directly def f1(a=None,b=None,c=None): pass kw={'a':1} apply(f1,[],kw) But I read in the doc that apply is deprecated. What is the non-deprecated way of doing this? Many thanks Use the double-star syntax: f1(**kw) Gary Herron -- http://mail.python.org/mailman/listinfo/python-list
Re: Question about apply
Many thanks!! On Thu, Sep 3, 2009 at 4:21 PM, Gary Herron gher...@islandtraining.comwrote: jorma kala wrote: Hi, I'm using apply to pass keyword arguments as a dictionary to a funcion at runtime (which keyword arguments to pass is only known at runtime) apply is very handy for this, because it takes a dictionary of keyword arguments directly def f1(a=None,b=None,c=None): pass kw={'a':1} apply(f1,[],kw) But I read in the doc that apply is deprecated. What is the non-deprecated way of doing this? Many thanks Use the double-star syntax: f1(**kw) Gary Herron -- http://mail.python.org/mailman/listinfo/python-list
Re: obscure problem using elementtree to make xhtml website
I went with a space, but a comment is a better idea. I only mention the script tag in my article, for brevity, but I had the same problem with the object tag: basically any tag that can have content in html you had better close the html way (tag/tag), or IE will see it as unclosed and will not display the rest of the page after the tag (or do something else unexpected). Not a bug in IE (this time), which is correctly parsing the file as html. Lee -- http://mail.python.org/mailman/listinfo/python-list
Re: match braces?
Grant Edwards inva...@invalid writes: On 2009-09-03, Ben Finney ben+pyt...@benfinney.id.au wrote: Tim Chase python.l...@tim.thechases.com writes: Any editor worth its salt will offer indentation-based folding (I know vim does, and I would be astonished if emacs didn't. Emacs calls that ???hide/show???, and the ???hs-minor-mode??? can be enabled for any buffer (and can thus of course be automatically enabled on defined conditions, e.g. whenever a Python buffer is detected). Learn more at URL:http://www.emacswiki.org/cgi-bin/wiki/HideShow. There's only one problem: it doesn't work out-of-the-box. At least it never has for me. The only thing it knows how to hide is the entire body of a function definition. I never want to do that. What I want to do is hide/unhide the blocks within if/then/else or loops so that the control flow is clearer. Emacs hs-minor-mode won't do that (at least not for me). Hm. I wasn't aware of hs-minor-mode. But I've often used set-selective-display (C-x $), which hides all lines that are indented more than ARG columns (and un-hides them if you don't give an argument). But to fulfill the specific request of moving up to the top of a given block, there's also a `python-beginning-of-block' command in python-mode (bound to C-c C-u). If you set the mark (C-SPC) before you do python-beginning-of-block, then you can use `C-x C-x' or `C-u SPC' to jump back where you were. -- Don't be afraid to ask (Lf.((Lx.xx) (Lr.f(rr. -- http://mail.python.org/mailman/listinfo/python-list
win32pipe
Hello, I'd like to play a little with named pipes on windows. For this purpose google told me there is a win32pipe module. My python2.6 on windows doesn't know it - so where can I get ? Does it belong to the std. python for windows or is it a separate package ? Thank a lot, Hans -- http://mail.python.org/mailman/listinfo/python-list
Re: win32pipe
Hans Müller wrote: Hello, I'd like to play a little with named pipes on windows. For this purpose google told me there is a win32pipe module. My python2.6 on windows doesn't know it - so where can I get ? Does it belong to the std. python for windows or is it a separate package ? It's part of the pywin32 package: http://sourceforge.net/projects/pywin32/ TJG -- http://mail.python.org/mailman/listinfo/python-list
print syntax
I am new to python, working by way through 'Core Python Programming'. I can find no description of using print with the built-in type for formatting. I think I have got some [most?] of it from Chun, google, and python.org. My comment is - it should not be that hard to find. I would suggest a link from the print syntax section. What is seems to be is: print format-spec % (variable-list) I assume the '%' is required token. _ Douglas Denault http://www.safeport.com d...@safeport.com Voice: 301-217-9220 Fax: 301-217-9277 -- http://mail.python.org/mailman/listinfo/python-list
Re: recursive decorator
Michele Simionato wrote: On Sep 3, 12:19 am, Ethan Furman et...@stoneleaf.us wrote: Greetings, List! The recent thread about a recursive function in a class definition led me back to a post about bindfunc from Arnaud, and from there I found Michele Simionato's decorator module (many thanks! :-), and from there I began to wonder... from decorator import decorator @decorator def recursive1(func, *args, **kwargs): return func(func, *args, **kwargs) @recursive1 def factorial1(recurse, n): if n 2: return 1 return n * recurse(n-1) factorial(4) TypeError: factorial1() takes exactly 2 arguments (1 given) What are you trying to do here? I miss why you don't use the usual definition of factorial. If you have a real life use case which is giving you trouble please share. I do not see why you want to pass a function to itself (?) M. Simionato Factorial is an example only. The original thread by Bearophile: http://mail.python.org/pipermail/python-list/2009-May/711848.html A similar thread from kj (where scopes is the actual problem): http://mail.python.org/pipermail/python-list/2009-August/725174.html Basic summary: the recursive decorator (the one you snipped, not the one showing above), is a replacement for the bindfunc decorator, and preserves the signature of the decorated function, minus the self-referring first parameter. It solves kj's problem (although there are arguably better ways to do so), and I think helps with Bearophiles as well. As a bonus, the tracebacks are more accurate if the function is called incorrectly. Consider: In [1]: def recursive(func): ...: def wrapper(*args, **kwargs): ...: return func(wrapper, *args, **kwargs) ...: return wrapper ...: In [2]: @recursive ...: def factorial(recurse, n): ...: if n 2: ...: return 1 ...: else: ...: return n * recurse(n-1) ...: In [3]: factorial(1, 2) # in incorrect call TypeError Traceback (most recent call last) C:\pythonlib\ipython console in module() C:\pythonlib\ipython console in wrapper(*args, **kwargs) TypeError: factorial() takes exactly 2 arguments (3 given) ^ mildly confusing / versus the error with the new decorator: In [2]: factorial(4, 5) # another incorrect call TypeError Traceback (most recent call last) C:\pythonlib\ipython console in module() TypeError: factorial() takes exactly 1 argument (2 given) This latter error matches how factorial actually should be called, both in normal code using it, and in the function itself, calling itself. So that's the why and wherefore. Any comments on the new decorator itself? Here it is again: def recursive(func): recursive is a signature modifying decorator. Specifially, it removes the first argument, so that calls to the decorated function act as if it does not exist. argspec = inspect.getargspec(func) first_arg = argspec[0][0] newargspec = (argspec[0][1:], ) + argspec[1:] fi = decorator.FunctionMaker(func) old_sig = inspect.formatargspec( \ formatvalue=lambda val: , *argspec)[1:-1] new_sig = inspect.formatargspec( \ formatvalue=lambda val: , *newargspec)[1:-1] new_def = '%s(%s)' % (fi.name, new_sig) body = 'return func(%s)' % old_sig def wrapper(*newargspec): return func(wrapper, *newargspec) evaldict = {'func':func, first_arg:wrapper} return fi.create(new_def, body, evaldict, \ doc=fi.doc, module=fi.module) ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list
Re: print syntax
On Thu, Sep 3, 2009 at 12:22 PM, d...@safeport.com wrote: I am new to python, working by way through 'Core Python Programming'. I can find no description of using print with the built-in type for formatting. I think I have got some [most?] of it from Chun, google, and python.org. My comment is - it should not be that hard to find. I would suggest a link from the print syntax section. What is seems to be is: print format-spec % (variable-list) I assume the '%' is required token. The % has absolutely nothing to do with the print statement. The (old) formatting syntax is based on the C printf syntax but it's actually the modulo operator on a string, not a piece of the print statement. The documentation for it is in the documentation for strings. _ Douglas Denault http://www.safeport.com d...@safeport.com Voice: 301-217-9220 Fax: 301-217-9277 -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: print syntax
On 2009-09-03 11:50 AM, Benjamin Kaplan wrote: On Thu, Sep 3, 2009 at 12:22 PM,d...@safeport.com wrote: I am new to python, working by way through 'Core Python Programming'. I can find no description of using print with the built-in type for formatting. I think I have got some [most?] of it from Chun, google, and python.org. My comment is - it should not be that hard to find. I would suggest a link from the print syntax section. What is seems to be is: print format-spec % (variable-list) I assume the '%' is required token. The % has absolutely nothing to do with the print statement. The (old) formatting syntax is based on the C printf syntax but it's actually the modulo operator on a string, not a piece of the print statement. The documentation for it is in the documentation for strings. Namely: http://docs.python.org/library/stdtypes.html#string-formatting -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list
Re: Creating slice notation from string
On Sep 2, 8:52 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Wed, 02 Sep 2009 17:32:09 -0700, Bob van der Poel wrote: Actually, nither this or Jan's latest is working properly. I don't know if it's the slice() function or what (I'm using python 2.5). But: x = [1,2,3,4,5] slice_string=2 items = [int(n) if n else None for n in slice_string.split(:)] [slice(*items)] [1, 2] It's not clear what is input and what is output. I'm *guessing* that the first four lines are input and the fifth is output. By the way, nice catch for the else None. But why are you wrapping the call to slice() in a list in the fourth line? I can't replicate your results. I get the expected results: slice_string=2 items = [int(n) if n else None for n in slice_string.split(:)] [slice(*items)] [slice(None, 2, None)] exactly the same as: slice(2) slice(None, 2, None) Testing this, I get the expected result: x = [1,2,3,4,5] x[slice(*items)] [1, 2] which is exactly the same if you do this: x[:2:] [1, 2] not the expected: [3] Why would you expect that? You can't get that result from a slice based on 2 only. Watch: x[2::] [3, 4, 5] x[:2:] [1, 2] x[::2] [1, 3, 5] There is no slice containing *only* 2 which will give you the result you are asking for. You would need to do this: x[2:3] [3] Perhaps what you are thinking of is *indexing*: x[2] 3 but notice that the argument to list.__getitem__ is an int, not a slice, and the result is the item itself, not a list. To get the behaviour you want, you need something more complicated: def strToSlice(s): if ':' in s: items = [int(n) if n else None for n in s.split(':')] else: if s: n = int(s) items = [n, n+1] else: items = [None, None, None] return slice(*items) Things like -1 don't work either. They do for me: slice_string=2:-2 x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] items = [int(n) if n else None for n in slice_string.split(:)] x[ slice(*items) ] [3, 4, 5, 6, 7, 8] x[2:-2] [3, 4, 5, 6, 7, 8] I'm really not sure what's going on, but I suspect it's the way that slice() is getting filled when the slice string isn't a nice one with each : present? I think you're confused between __getitem__ with a slice argument and __getitem__ with an int argument. -- Steven Yes, you're right ... I'm confused on what results I expect! Sorry about that ... now that another day has passed it's all a bit more clear. I need to print out a number of these messages and write some test code. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Subclassing list and splicing
I am subclassing list class and it basically works, but I don't understand why after splicing these mylist objects I don't get returned mylist objects. What I get are list objects: class mylist(list): def __init__(self): list.__init__(self) k = mylist() k.append(1) k.append(2) k.append(3) print type(k) # prints class '__main__.mylist' as expected m = k[:1] print type(m) # prints type 'list' ??? I would prefer that resulting object m belonged to myclist class. How to obtain such behaviour? Must I somehow implement __getslice__ method myself? (It's python 2.5.2, BTW) -- http://mail.python.org/mailman/listinfo/python-list
Re: Algorithms as objects?
Bearophile bearophileh...@lycos.com wrote: Please, can't you just use a bit of functional-style programming? Like creating nested functions on the fly, etc. I thought about it but I believe that in the future some parts of the code will be reimplemented in C/C++, so I try to keep it simple. In the end the hint to learn about strategy pattern led me to construct the program in the way I liked. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: match braces?
lallous wrote: Hello In C/C++ you use the braces where as in Python you use the indentation levels. Most editors offer a Ctrl+[ to match the braces so that you can easily identify the scopes (more correctly statements blocks). I am finding it difficult to see blocks and/or jump from end to start with some IDE hotkeys, when coding in Python. Any advise? Write more subroutines. If indentation gets deep enough that you have problems following your own code, it's time to break some of the code out as another function. John Nagle -- http://mail.python.org/mailman/listinfo/python-list
Re: Subclassing list and splicing
On 9/3/2009 10:10 AM Kreso said... I am subclassing list class and it basically works, but I don't understand why after splicing these mylist objects I don't get returned mylist objects. What I get are list objects: snip I would prefer that resulting object m belonged to myclist class. How to obtain such behaviour? Must I somehow implement __getslice__ method myself? Yep -- something like: class mylist(list): def __init__(self,val=None): if val is None: list.__init__(self) else: list.__init__(self,val) def __getslice__(self,slstart,slend,slstep=None): return mylist(self[slstart:slend:slstep]) Emile -- http://mail.python.org/mailman/listinfo/python-list
The future of Python immutability
Python's concept of immutability is useful, but it could be more general. In the beginning, strings, tuples, and numbers were immutable, and everything else was mutable. That was simple enough. But over time, Python has acquired more immutable types - immutable sets and immutable byte arrays. Each of these is a special case. Python doesn't have immutable objects as a general concept, but it may be headed in that direction. There was some fooling around with an immmutability API associated with NumPy back in 2007, but that was removed. As more immutable types are added, a more general approach may be useful. Suppose, for discussion purposes, we had general immutable objects. Objects inherited from immutableobject instead of object would be unchangeable once __init__ had returned. Where does this take us? Immutability is interesting for threaded programs, because immutable objects can be shared without risk. Consider a programming model where objects shared between threads must be either immutable or synchronized in the sense that Java uses the term. Such programs are free of most race conditions, without much programmer effort to make them so. Java synchronized turned out to be a headache partly because trying to figure out how to lock all the little stuff being passed around a headache. But Java doesn't have immutable objects. Python does, and that can be exploited to make thread-based programming cleaner. The general idea is that synchronized objects would have built in locks which would lock at entry to any function of the object and unlock at exit. The lock would also unlock at explicit waits. A Queue object would be a good example of a synchronized object. With this mechanism, multi-thread programs with shared data structures can be written with little or no explicit locking by the programmer. If the restrictions are made a bit stricter, strict enough that threads cannot share mutable unsynchronized data, removal of the global interpreter lock is potentially possible. This is a route to improved performance on modern multi-core CPUs. John Nagle -- http://mail.python.org/mailman/listinfo/python-list
Python for 64bit Linux version
Hello Every one, I just want to that s there a 64 bit Linux version for python ? if yes can you provide me any links for it.I could find a 64bit windows version but could not find Linuux version Your help is appriciated. Thanks Bhanu -- http://mail.python.org/mailman/listinfo/python-list
Re: Entry Level Python Jobs
On Thu, 03 Sep 2009 06:36:24 -0700, koranthala wrote: snip Also, I think topcoder.com is a good place for him. I have not used them much, but their business plan -- of asking medium to difficult questions every week, and contacting people who solves them with jobs -- is quite sound. Try that too. I got my first consulting job in a similar fashion. Local newspaper ad said the first consultant who could answer their questions got the job. I was the only one that responded correctly and despite my Biochem degree was off doing my first commercial application (purchase order system for a local Credit Union). -- http://mail.python.org/mailman/listinfo/python-list
Re: python daemon - compress data and load data into MySQL by pyodbc
Ben Finney wrote: MacRules macru...@nome.com writes: Are you a Python expert? This group has many Python experts, and even more people who can no doubt help you if you are able to articulate what you need help with. To help dispel a possible misunderstanding: Don't expect to have a one-on-one conversation with a single devoted correspondent here. We prefer to have these discussions in a manner open for contributions from everyone, to maximise the benefit for future readers and the chance of correcting errors. Can you show me the basic coding to get a Daemon (pass through insert data) up and insert to the backend MySQL? This doesn't make a whole lot of sense to me; it sounds like a conflation of two separate problems that would be best tackled separately. Can you re-phrase it, perhaps by describing the problem you're actually trying to solve? On the topic of implementing a daemon process in Python, there is the ‘python-daemon’ library URL:http://pypi.python.org/pypi/python-daemon which I hope you will find useful. If you can describe what you're actually trying to do, perhaps it will be clearer whether this library is a good fit. What I am looking for is this. Oracle DB in data center 1 (LA, west coast) MSSQL DB in data center 2 (DC, east coast) So network bandwidth is an issue, I prefer to have gzip fist and deliver the data. I need 2 python daemons or a web service here in the future. I will enter the Oracle table name, user id and password. So the task is dump out Oracle data (Linux) and insert that to MSSQL. I can try first with 1 daemon python. Take the Oracle data file, and let the daemon connects to MSSQL (with pyodbc) and load the data in. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python for 64bit Linux version
Bhanu Srinivas Mangipudi: I just want to that s there a 64 bit Linux version for python ? Yes. if yes can you provide me any links for it.I could find a 64bit windows version but could not find Linuux version I am currently too lazy to look it up for you on python.org (if it is there), but your AMD64 distribution has most likely packaged it for you already. J. -- The houses of parliament make me think of school bullies. [Agree] [Disagree] http://www.slowlydownward.com/NODATA/data_enter2.html signature.asc Description: Digital signature -- http://mail.python.org/mailman/listinfo/python-list
issue with grep command
in tcsh terminal i have the following line of code cat fileName.txt | grep a which extracts all the instances of a from the file in the terminal.. however when i am trying to create a txt while, i am unable to do so for some reason..this is the syntaxt i am using -- cat fileName.txt | frep a a.txt file then appears in the folder, however, it can no be opened because the file is not in the right format.. does anybody know how to correct this problem? thanks so much -- http://mail.python.org/mailman/listinfo/python-list
Re: Qstrings to Strings
Helvin wrote: Just wanted to say, to convert qstrings (or integers for that matter) to strings, use the str() function. http://learnwithhelvin.blogspot.com/2009/09/qstrings-and-strings.html Hmmm, will that return a Unicode string? A byte string would be rather inappropriate in most cases. I guess the unicode() function is the right thing to use here (or the str() function in Py3 - no idea if that's supported by Qt by now). Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: The future of Python immutability
John Nagle wrote: Python's concept of immutability is useful, but it could be more general. In the beginning, strings, tuples, and numbers were immutable, and everything else was mutable. That was simple enough. But over time, Python has acquired more immutable types - immutable sets and immutable byte arrays. Each of these is a special case. Python doesn't have immutable objects as a general concept, but it may be headed in that direction. There was some fooling around with an immmutability API associated with NumPy back in 2007, but that was removed. As more immutable types are added, a more general approach may be useful. Suppose, for discussion purposes, we had general immutable objects. Objects inherited from immutableobject instead of object would be unchangeable once __init__ had returned. Where does this take us? Immutability is interesting for threaded programs, because immutable objects can be shared without risk. Consider a programming model where objects shared between threads must be either immutable or synchronized in the sense that Java uses the term. Yes, this is one of the reasons I am currently learning Haskell, I am not yet anywhwere near proficient but the reason I am looking into FP is because of some of the claims of the FP community, particularly Erlang, regarding the benefits of pure FP with respect to multi-threading. It's a shame this post came right now since I'm not really up-to-speed enough with Haskell to comment on it with repsect to multi-threading. context I program Perl, Java and C++ for my day job, I've spent a lot of time making multithreaded programs work correctly and have even experienced the POE on a large project. So my comments below are based on experience of these languages. /context Such programs are free of most race conditions, without much programmer effort to make them so. I disagree. They are not free of most race conditions, and it still takes a lot of effort. Where did you get this idea from? Have you been reading some Java primer that attempts to make it sound easy? Java synchronized turned out to be a headache partly because trying to figure out how to lock all the little stuff being passed around a headache. But Java doesn't have immutable objects. Python does, and that can be exploited to make thread-based programming cleaner. This is nothing to do with Java, any multithreaded language that has mutable shared state has exactly the same problems. Can we talk about threading rather than Java please? Additionally Java provides a lot more than monitors (synchronized) for controlling multiple threads. Java does have immutable objects. Strings in Java are immutable for example. As are the object-based numeric types, Bytes, Characters etc. There are lots and lots of immutable types in Java and you can make your own by creating a class with no mutator methods and declaring it final. The general idea is that synchronized objects would have built in locks which would lock at entry to any function of the object and unlock at exit. The lock would also unlock at explicit waits. A Queue object would be a good example of a synchronized object. With this mechanism, multi-thread programs with shared data structures can be written with little or no explicit locking by the programmer. If the restrictions are made a bit stricter, strict enough that threads cannot share mutable unsynchronized data, removal of the global interpreter lock is potentially possible. This is a route to improved performance on modern multi-core CPUs. Right, this is where I would love to have had more experience with Haksell. Yes, as soon as you get to a situation where no thread can access shared state that is mutable your problems go away, you're also getting no work done becasue the threads, whilst they may be performing lots of interesting calculations have no way of allowing the rest of the program, or operating system, know about it. You can, today, in any language that provides threads, make any number of threaded programs that do not contain any race conditions, it's just that most of them are terribly dull and uninteresting. I'd love for someone from the Haskell/Erlang/other pure FP community provide some canonical example of how this is acheived in pure FP. I'll get there soon but I'm not going to skip ahead in my reading, I'm still trying to learn the basics. So, in response to your point of trying to get an immutable API so that Python can easily have multi-threaded programs that do not present race conditions I would say the following: That is not the challenge, that's the easy part. The challenge is getting useful information out of a system that has only been fed immutable objects. Regards, Nigel -- http://mail.python.org/mailman/listinfo/python-list
Re: obscure problem using elementtree to make xhtml website
Lee wrote: basically any tag that can have content in html you had better close the html way (tag/tag), or IE will see it as unclosed and will not display the rest of the page after the tag (or do something else unexpected). Not a bug in IE (this time), which is correctly parsing the file as html. ... which is obviously not the correct thing to do when it's XHTML. Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: python daemon - compress data and load data into MySQL by pyodbc
MacRules wrote: cut What I am looking for is this. Oracle DB in data center 1 (LA, west coast) MSSQL DB in data center 2 (DC, east coast) So network bandwidth is an issue, I prefer to have gzip fist and deliver the data. If bandwidth is really an issue, you should send compressed delta's. I need 2 python daemons or a web service here in the future. I will enter the Oracle table name, user id and password. So the task is dump out Oracle data (Linux) and insert that to MSSQL. That is assuming the table is the same and the columns of the table have the same type with the same restrictions and don't even get me started about encoding differences. I can try first with 1 daemon python. Take the Oracle data file, and let the daemon connects to MSSQL (with pyodbc) and load the data in. I think that you are underestimating your task, I would recommend to 'design' your application first using an UML like approach, whether you need one, two or bazillion daemons should not be a design start but a consequence of the design. Anyway here is a sum up and some further pointers to take in regard for your design: - Can I do delta's? (if yes how do I calculate them) - Are the tables comparable in design Specifically if there is a limit on the character width, does Oracle and MS-SQL think the same about newlines? (one versus two characters) - How about encoding, are you sure it works out right? - Is ATOMIC an issue - Is latency an issue, that is how long may the tables be out of sync - Can it be manual or is it preferably automatic How about a trigger in the database that sets the sync going, if that is too much burden how about a trigger that set a flag on the disk and a scheduled job that reads that flag first - Is security an issue, do I need an encrypted channel In the past I've wrote a program that had the same starting point as you had, over time it grew in design to be a datawarehouse push/pull central server with all other databases as an agency. The only reason I wrote it was because the more standard approach like business objects data integrator was just way too expensive and oracles solutions didn't play nice with PostgreSQL (though over time this issue seemed to be resolved). -- MPH http://blog.dcuktec.com 'If consumed, best digested with added seasoning to own preference.' -- http://mail.python.org/mailman/listinfo/python-list
Re: Why does this group have so much spam?
Steven D'Aprano wrote: On Thu, 03 Sep 2009 04:01:54 -0400, Terry Reedy wrote: ISP's price residential service based on average fixed cost and average usage. Multiple homes using one connection push those averages up. Is that meant to be a problem? When people buy more, the unit price they are paying falls, but the total price they pay generally goes up. E.g. we've recently upgraded our business link from AUD$150 per month for 60GB to $190 for 100GB. The per GB price is less, but the total we pay is more -- and the ISP doesn't have to do much extra work for that extra money. The difference is that you *upgraded* your service and so incurred a greater total cost. If my neighbor lets the rest of the neighborhood use his wireless, while I do not, yet my prices go up because on average more usage is happening, I am paying more but not getting more. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list
Re: The future of Python immutability
Nigel Rantor wrote: John Nagle wrote: Immutability is interesting for threaded programs, because immutable objects can be shared without risk. Consider a programming model where objects shared between threads must be either immutable or synchronized in the sense that Java uses the term. Such programs are free of most race conditions, without much programmer effort to make them so. I disagree. They are not free of most race conditions, and it still takes a lot of effort. Where did you get this idea from? Have you been reading some Java primer that attempts to make it sound easy? Read again what he wrote. In a language with only immutable data types (which doesn't mean that you can't efficiently create modified versions of a data container), avoiding race conditions is trivial. The most well known example is clearly Erlang. Adding synchronised data structures to that will not make writing race conditions much easier. Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: The future of Python immutability
Stefan Behnel wrote: Nigel Rantor wrote: John Nagle wrote: Immutability is interesting for threaded programs, because immutable objects can be shared without risk. Consider a programming model where objects shared between threads must be either immutable or synchronized in the sense that Java uses the term. Such programs are free of most race conditions, without much programmer effort to make them so. I disagree. They are not free of most race conditions, and it still takes a lot of effort. Where did you get this idea from? Have you been reading some Java primer that attempts to make it sound easy? Read again what he wrote. In a language with only immutable data types (which doesn't mean that you can't efficiently create modified versions of a data container), avoiding race conditions is trivial. The most well known example is clearly Erlang. Adding synchronised data structures to that will not make writing race conditions much easier. My comment you quoted was talking about Java and the use of synchronized. I fthat was unclear I apologise. Please feel free to read the entirety of my post before replying. n -- http://mail.python.org/mailman/listinfo/python-list
Re: python daemon - compress data and load data into MySQL by pyodbc
Martin P. Hellwig wrote: MacRules wrote: cut What I am looking for is this. Oracle DB in data center 1 (LA, west coast) MSSQL DB in data center 2 (DC, east coast) So network bandwidth is an issue, I prefer to have gzip fist and deliver the data. If bandwidth is really an issue, you should send compressed delta's. I need 2 python daemons or a web service here in the future. I will enter the Oracle table name, user id and password. So the task is dump out Oracle data (Linux) and insert that to MSSQL. That is assuming the table is the same and the columns of the table have the same type with the same restrictions and don't even get me started about encoding differences. I can try first with 1 daemon python. Take the Oracle data file, and let the daemon connects to MSSQL (with pyodbc) and load the data in. I think that you are underestimating your task, I would recommend to 'design' your application first using an UML like approach, whether you need one, two or bazillion daemons should not be a design start but a consequence of the design. Anyway here is a sum up and some further pointers to take in regard for your design: - Can I do delta's? (if yes how do I calculate them) - Are the tables comparable in design Specifically if there is a limit on the character width, does Oracle and MS-SQL think the same about newlines? (one versus two characters) - How about encoding, are you sure it works out right? - Is ATOMIC an issue - Is latency an issue, that is how long may the tables be out of sync - Can it be manual or is it preferably automatic How about a trigger in the database that sets the sync going, if that is too much burden how about a trigger that set a flag on the disk and a scheduled job that reads that flag first - Is security an issue, do I need an encrypted channel In the past I've wrote a program that had the same starting point as you had, over time it grew in design to be a datawarehouse push/pull central server with all other databases as an agency. The only reason I wrote it was because the more standard approach like business objects data integrator was just way too expensive and oracles solutions didn't play nice with PostgreSQL (though over time this issue seemed to be resolved). You understand my issue clearly. For now, I only look for 1 time event, I do not need push/pull yet. For a good push/pull + compression + security + real time in mind, you can sell it for decent money. -- http://mail.python.org/mailman/listinfo/python-list
Re: The future of Python immutability
Nigel Rantor wrote: My comment you quoted was talking about Java and the use of synchronized. I fthat was unclear I apologise. Well, it was clear. But it was also unrelated to what the OP wrote. He was talking about the semantics of synchronized in Java, not the use. Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: obscure problem using elementtree to make xhtml website
basically any tag that can have content in html you had better close the html way (tag/tag), or IE will see it as unclosed and will not display the rest of the page after the tag (or do something else unexpected). Not a bug in IE (this time), which is correctly parsing the file as html. ... which is obviously not the correct thing to do when it's XHTML. Not correct, of course, but AFAIK it's a very common hack indeed. If the goal is to produce XHTML that will work as text/html, have you considered using one of the myriad templating libraries? IIRC a lot (if not most) of them support HTMLish output for precisely that reason. On Thu, 03 Sep 2009 12:09:22 -0700, Stefan Behnel stefan...@behnel.de wrote: Lee wrote: basically any tag that can have content in html you had better close the html way (tag/tag), or IE will see it as unclosed and will not display the rest of the page after the tag (or do something else unexpected). Not a bug in IE (this time), which is correctly parsing the file as html. ... which is obviously not the correct thing to do when it's XHTML. Stefan -- Rami Chowdhury Never attribute to malice that which can be attributed to stupidity -- Hanlon's Razor 408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD) -- http://mail.python.org/mailman/listinfo/python-list
Re: The future of Python immutability
John Nagle wrote: With this mechanism, multi-thread programs with shared data structures can be written with little or no explicit locking by the programmer. If the restrictions are made a bit stricter, strict enough that threads cannot share mutable unsynchronized data, removal of the global interpreter lock is potentially possible. This is a route to improved performance on modern multi-core CPUs. The main problem with this is that the existing data structures are, well, there. You can't replace them without breaking all existing Python code, i.e. without basically inventing a new language. If that's required for removing the GIL, I doubt that it will ever be done. Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: Python for 64bit Linux version
On 2009-09-03, Jochen Schulz m...@well-adjusted.de wrote: Bhanu Srinivas Mangipudi: I just want to that s there a 64 bit Linux version for python ? Yes. if yes can you provide me any links for it.I could find a 64bit windows version but could not find Linuux version I am currently too lazy to look it up for you on python.org (if it is there), but your AMD64 distribution has most likely packaged it for you already. Actually, I find it rather surprising that it's not already installed. All the distros I've used in the past decade or so included Python as part of their base install set. -- Grant Edwards grante Yow! I'm wet! I'm wild! at visi.com -- http://mail.python.org/mailman/listinfo/python-list
Video?
Not at all important, just for fun (at least for me): It seems to me, looking at various docs, that wxWidgets includes a media control that can play video files, but it's not included in wxPython. (There's something in wxPython with a promising name but it seems to be just audio.) Is that correct? If so is there some other standard Python windowing kit that does include some sort of video functionality? (Talking Ubuntu Linux if it matters.) -- http://mail.python.org/mailman/listinfo/python-list
Re: Qstrings to Strings
On Thursday 03 September 2009 21:01, Stefan Behnel wrote: Helvin wrote: Just wanted to say, to convert qstrings (or integers for that matter) to strings, use the str() function. http://learnwithhelvin.blogspot.com/2009/09/qstrings-and-strings.html Hmmm, will that return a Unicode string? A byte string would be rather inappropriate in most cases. I guess the unicode() function is the right thing to use here (or the str() function in Py3 - no idea if that's supported by Qt by now). PyQt4.5 supports Python 3, so I imagine that str() will be what you would use with that combination. For Python 2, unicode() is probably what most people want. David -- http://mail.python.org/mailman/listinfo/python-list
Re: Python for 64bit Linux version
On Thu, 2009-09-03 at 13:30 -0500, Bhanu Srinivas Mangipudi wrote: I just want to that s there a 64 bit Linux version for python ? if yes can you provide me any links for it.I could find a 64bit windows version but could not find Linuux version If you are using a 64bit Linux distribution then likely that distribution already comes with Python and likely that Python is already 64bit. Else you can always download the source from python.org yourself and compile it. -a -- http://mail.python.org/mailman/listinfo/python-list
Re: issue with grep command
On Thu, 2009-09-03 at 11:51 -0700, Jul wrote: [Stuff about tcsh and grep deleted] What on earth does this have to do with Python? -a -- http://mail.python.org/mailman/listinfo/python-list
Re: First release of pyfsevents
[posted to c.l.py with cc in e-mail, reply to group preferred] In article mailman.908.1251986896.2854.python-announce-l...@python.org, Nicolas Dumazet python-list@python.org wrote: I am proud to announce the first release of pyfsevents, a C extension providing a Python interface to the FSEvents API. FSEvents is an Apple framework for Mac OS X =3D 10.5 allowing monitoring of file system events on Mac OS platforms. I'm curious why you went with FSEvents rather than kqueue. My company discovered that FSEvents is rather coarse-grained: it only tells you that there has been an event within a directory, it does *not* tell you anything about the change! http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/OSX_Technology_Overview/SystemTechnology/SystemTechnology.html#//apple_ref/doc/uid/TP40001067-CH207-SW4 -- Aahz (a...@pythoncraft.com) * http://www.pythoncraft.com/ Look, it's your affair if you want to play with five people, but don't go calling it doubles. --John Cleese anticipates Usenet -- http://mail.python.org/mailman/listinfo/python-list
Re: Subclassing list and splicing
Kreso kknowayu...@donoevil.com wrote: [...] I would prefer that resulting object m belonged to myclist class. I forgot to add that mylist instances in my case have some attributes (that's why I need special container class in the first place) which should be preserved after splicing. In my simple understaning of python it looks to me that list splicing has to involve copying (i.e. cannot be done only by referencing), and since base class 'list' doesn't know anything about mylist attributes, I will certainly have to override list's __getslice__ method, right? The only question is how to re-use as much of the 'lists' methods as possible, so that at list I don't need to write the code for copying of contained elements. -- http://mail.python.org/mailman/listinfo/python-list
Re: Video?
David C Ullrich wrote: ... Is that correct? If so is there some other standard Python windowing kit that does include some sort of video functionality? (Talking Ubuntu Linux if it matters.) I don't know about video and wxpython, but gstreamer has some python bindings (python-gst0.10 on jaunty). You may find a nice intro here: http://pygstdocs.berlios.de/ Hope this helped Ju -- True friends stab you in the front. -- http://mail.python.org/mailman/listinfo/python-list
Re: First release of pyfsevents
On Sep 3, 10:33 pm, a...@pythoncraft.com (Aahz) wrote: I'm curious why you went with FSEvents rather than kqueue. My company discovered that FSEvents is rather coarse-grained: it only tells you that there has been an event within a directory, it does *not* tell you anything about the change! It depends what you want to do with your events. In my case, knowing that an event occurred in a directory is sufficient because I already know the state of the directory. If you look in the examples/ folder, (watcher) you'll find that with very little work, you can maintain a directory snapshot in memory and compare it against the new state of the directory to know exactly what happened, when necessary. kqueue has the limitation that kern.kq_calloutmax is usually set at 4096. Meaning that one could not use this on a big (Mercurial) repository with 5k files. FSEvents on the other hand saves us the trouble to have to register each file individually. Also, I am not quite sure if we can use kqueue to register a directory, to be warned when a file is created in this directory. -- http://mail.python.org/mailman/listinfo/python-list
Different results for request() vs putrequest()
According to the documentation, these two sections of code should be equivalent: conn = httplib.HTTPSConnection(host) conn.putrequest(POST, url) conn.putheader(Proxy-Authorization, myProxy) conn.putheader(Content-Length, %d % len(body)) conn.endheaders() conn.send(body) vs headers = { Proxy-Authorization: myProxy } conn = httplib.HTTPSConnection(host) conn.request(POST, url, body, headers) And yet they are not. The first section works, but I get an HTTP/1.1 401 Unauthorized error from the second. Anyone know why? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, The Gashlycrumb Tinies -- http://mail.python.org/mailman/listinfo/python-list
Re: The future of Python immutability
Stefan Behnel stefan...@behnel.de writes: Read again what he wrote. In a language with only immutable data types (which doesn't mean that you can't efficiently create modified versions of a data container), avoiding race conditions is trivial. The most well known example is clearly Erlang. Adding synchronised data structures to that will not make writing race conditions much easier. Nonetheless, Erlang is subject to all kinds of traditional threading problems such as deadlocks. Haskell's use of software transactional memory may(?) avoid some of the problems but at a performance cost. -- http://mail.python.org/mailman/listinfo/python-list
Re: issue with grep command
On Thu, 03 Sep 2009 19:51:20 +0100, Jul sneaky...@gmail.com wrote: in tcsh terminal i have the following line of code cat fileName.txt | grep a which extracts all the instances of a from the file in the terminal.. however when i am trying to create a txt while, i am unable to do so for some reason..this is the syntaxt i am using -- cat fileName.txt | frep a a.txt file then appears in the folder, however, it can no be opened because the file is not in the right format.. does anybody know how to correct this problem? thanks so much This has sod all to do with Python, but I have to ask: *what* complains that the file is not in the right format? Also, I don't think you meant frep that second time, but your typing is sufficiently awful I can't be sure. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list
Re: The future of Python immutability
En Thu, 03 Sep 2009 15:03:13 -0300, John Nagle na...@animats.com escribió: Python's concept of immutability is useful, but it could be more general. Immutability is interesting for threaded programs, because immutable objects can be shared without risk. Consider a programming model where objects shared between threads must be either immutable or synchronized in the sense that Java uses the term. Such programs are free of most race conditions, without much programmer effort to make them so. In the current CPython implementation, every object has a reference count, even immutable ones. This must be a writable field - and here you have your race condition, even for immutable objects. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
possible attribute-oriented class
I have created the following class definition with the idea of making a clean syntax for non-programmers to created structured data within a python environment. I would appreciate comments on this code. First, is something like this already done? Second, are there reasons for not doing this? If this seems OK, how could I clean up the string conversion to have indented format. The expected use would have all items in the structure be simple python types or AttrClass types. Code written in python could walk the structure in a simple way to locate any desired values. Code in a C/C++ extension should also be able to walk the structure to use any value in the structure. class AttrClass(object): AttrClass lets you freely add attributes in nested manner def __init__(self): pass def __setitem__(self, key, value): return self.__dict__.__setitem__(key, value) def __repr__(self): return %s(%s) % (self.__class__.__name__, self.__dict__.__repr__()) def __str__(self): ll = ['{'] for k,v in self.__dict__.iteritems(): ll.append(%s : %s % (k, str(v))) return '\n'.join(ll) + '}' def test(): atr = AttrClass() atr.first = 1 atr.second = 2 atr.third = 'three' atrsub = AttrClass() atrsub.aaa = 'AAA' atrsub.bbb = 'BBB' atr.fourth = atrsub atr.fifth = 5 print atr print print repr(atr) print print atr.fourth.aaa = test() gives the following output: { second : 2 fifth : 5 fourth : { aaa : AAA bbb : BBB} third : three first : 1} AttrClass({'second': 2, 'fifth': 5, 'fourth': AttrClass({'aaa': 'AAA', 'bbb': 'BBB'}), 'third': 'three', 'first': 1}) AAA Ken Newton -- http://mail.python.org/mailman/listinfo/python-list
The Python: Rag September issue available
The September issue of The Python: Rag is available at: http://www.pythonrag.org A monthly, free, community run, Python magazine - issues are in pdf format, intended for anyone interested in Python, without being particularly serious. If you have anything you would like to say about Python, please contribute. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why does this group have so much spam?
On Thu, 03 Sep 2009 12:19:48 -0700, Ethan Furman wrote: Steven D'Aprano wrote: On Thu, 03 Sep 2009 04:01:54 -0400, Terry Reedy wrote: ISP's price residential service based on average fixed cost and average usage. Multiple homes using one connection push those averages up. Is that meant to be a problem? When people buy more, the unit price they are paying falls, but the total price they pay generally goes up. E.g. we've recently upgraded our business link from AUD$150 per month for 60GB to $190 for 100GB. The per GB price is less, but the total we pay is more -- and the ISP doesn't have to do much extra work for that extra money. The difference is that you *upgraded* your service and so incurred a greater total cost. If my neighbor lets the rest of the neighborhood use his wireless, while I do not, yet my prices go up because on average more usage is happening, I am paying more but not getting more. Incorrect -- you are getting all the downloads you make yourself, plus the warm fuzzy feeling of happiness from the knowledge that other people are making downloads you have paid for. Of course, if you've *unintentionally* left your wi-fi open, perhaps cold feelings of dread and horror would be more appropriate, but we're talking about the situation where folks deliberately leave their wi-fi open for whatever reason. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Why does this group have so much spam?
Steven D'Aprano wrote: On Thu, 03 Sep 2009 12:19:48 -0700, Ethan Furman wrote: Steven D'Aprano wrote: On Thu, 03 Sep 2009 04:01:54 -0400, Terry Reedy wrote: ISP's price residential service based on average fixed cost and average usage. Multiple homes using one connection push those averages up. Is that meant to be a problem? When people buy more, the unit price they are paying falls, but the total price they pay generally goes up. E.g. we've recently upgraded our business link from AUD$150 per month for 60GB to $190 for 100GB. The per GB price is less, but the total we pay is more -- and the ISP doesn't have to do much extra work for that extra money. The difference is that you *upgraded* your service and so incurred a greater total cost. If my neighbor lets the rest of the neighborhood use his wireless, while I do not, yet my prices go up because on average more usage is happening, I am paying more but not getting more. Incorrect -- you are getting all the downloads you make yourself, plus the warm fuzzy feeling of happiness from the knowledge that other people are making downloads you have paid for. Of course, if you've *unintentionally* left your wi-fi open, perhaps cold feelings of dread and horror would be more appropriate, but we're talking about the situation where folks deliberately leave their wi-fi open for whatever reason. Read a little closer, Steven -- *my* wi-fi is *closed*, it's my neighbor (in theory) who has his open, and all that extra usage is making *my* rate go up -- no warm fuzzies, only irritation. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list
Re: Video?
On Sep 3, 4:11 pm, David C Ullrich dullr...@sprynet.com wrote: Not at all important, just for fun (at least for me): It seems to me, looking at various docs, that wxWidgets includes a media control that can play video files, but it's not included in wxPython. (There's something in wxPython with a promising name but it seems to be just audio.) It is included with wxPython. But if you look in the overview in the demo, it it says: wx.MediaCtrl is not currently available on unix systems. So there's your problem, I think. On Win, it plays a video in the demo. -- http://mail.python.org/mailman/listinfo/python-list
Re: possible attribute-oriented class
On Thu, 03 Sep 2009 15:46:01 -0700, Ken Newton wrote: I have created the following class definition with the idea of making a clean syntax for non-programmers to created structured data within a python environment. What do you expect non-programmers to do with this class, without programming? How can they even use it? ... The expected use would have all items in the structure be simple python types or AttrClass types. Code written in python could walk the structure in a simple way to locate any desired values. Code in a C/C++ extension should also be able to walk the structure to use any value in the structure. I don't see the purpose of it. Nested data structures are generally harder for people to understand than non-nested ones, hence the Python Zen: flat is better than nested. For example, a list is easier to grasp than a tree. This especially applies to non-programmers. I don't see how this is simple enough for non-programmers, or useful for programmers. For programmers, just nest objects: class Parrot(object): pass obj = Parrot() obj.x = 1 obj.y = Parrot() obj.y.z = 2 obj.y.z.zz = Parrot() class AttrClass(object): AttrClass lets you freely add attributes in nested manner You don't actually need a special class for that, unless you're providing extra functionality. A bare subclass of object will let you freely add attributes in a nested manner. It seems to me that you're combining two different sets of functionality, but only describing one. The first is, nested attributes -- but you get that for free with any class. The second is the ability to set (but strangely not retrieve!) attributes using dictionary-like syntax. But that's implied by the code, you haven't mentioned it in your description or documentation. def __init__(self): pass If the __init__ method doesn't do anything, you don't need it. def __setitem__(self, key, value): return self.__dict__.__setitem__(key, value) Simpler to just say: def __setitem__(self, key, value): self.__dict__[key] = value You don't strictly need the return, because methods return None by default, and dict.__setitem__ always returns None (unless it raises an exception). This method allows you to set attributes using dict syntax: instance['key'] = 123 # same as instance.key = 123 But you don't have corresponding __getitem__ or __delitem__ methods, so you can't do these: value = instance['key'] # fails del instance['key'] # fails def __repr__(self): return %s(%s) % (self.__class__.__name__, self.__dict__.__repr__()) This strongly implies that you should be able to create a new instance using that format: AttrClass({'key': 123, 'another_key': 456}) but that fails. As a general rule, the repr() of a class should (if possible) work correctly if passed to eval(). This doesn't. That's not entirely wrong, but it is unusual and confusing. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: python daemon - compress data and load data into MySQL by pyodbc
MacRules macru...@nome.com writes: What I am looking for is this. Oracle DB in data center 1 (LA, west coast) MSSQL DB in data center 2 (DC, east coast) So network bandwidth is an issue Okay, that's a brief description but is clearer than we had before. I prefer to have gzip fist and deliver the data. Forget about gzip for now; just concentrate on the *problem* to be solved, and don't assume a particular technique. There are other ways of addressing limited bandwidth. I need 2 python daemons or a web service here in the future. Again, don't assume a particular technique until it's demonstrated that it's better than alternatives; default to a simple implementation first. Nothing in your description speaks to a need for a daemon. What it sounds like you need is two programs, one running at each end of a network connection. Whether they are daemons or not is irrelevant. I will enter the Oracle table name, user id and password. So the task is dump out Oracle data (Linux) and insert that to MSSQL. That's the core of the problem to be solved, in my view. For now, forget about limited network bandwidth or how these processes will run. Are you able to get your particular data out of the one system and into the other, successfully? What have you tried so far to do this, and what exactly went wrong? Take the Oracle data file, and let the daemon connects to MSSQL (with pyodbc) and load the data in. What was the result of this on your specific data set? If you have issues related to Oracle or MS servers, or their implementations of SQL, you'll need to seek assistance in forums specific to those products. -- \ “If you get invited to your first orgy, don't just show up | `\ nude. That's a common mistake. You have to let nudity | _o__) ‘happen.’” —Jack Handey | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: Why does this group have so much spam?
On Thu, 03 Sep 2009 16:01:26 -0700, Ethan Furman wrote: Steven D'Aprano wrote: On Thu, 03 Sep 2009 12:19:48 -0700, Ethan Furman wrote: Steven D'Aprano wrote: On Thu, 03 Sep 2009 04:01:54 -0400, Terry Reedy wrote: ISP's price residential service based on average fixed cost and average usage. Multiple homes using one connection push those averages up. Is that meant to be a problem? When people buy more, the unit price they are paying falls, but the total price they pay generally goes up. E.g. we've recently upgraded our business link from AUD$150 per month for 60GB to $190 for 100GB. The per GB price is less, but the total we pay is more -- and the ISP doesn't have to do much extra work for that extra money. The difference is that you *upgraded* your service and so incurred a greater total cost. If my neighbor lets the rest of the neighborhood use his wireless, while I do not, yet my prices go up because on average more usage is happening, I am paying more but not getting more. Incorrect -- you are getting all the downloads you make yourself, plus the warm fuzzy feeling of happiness from the knowledge that other people are making downloads you have paid for. Of course, if you've *unintentionally* left your wi-fi open, perhaps cold feelings of dread and horror would be more appropriate, but we're talking about the situation where folks deliberately leave their wi-fi open for whatever reason. Read a little closer, Steven -- *my* wi-fi is *closed*, it's my neighbor (in theory) who has his open, and all that extra usage is making *my* rate go up -- no warm fuzzies, only irritation. Okay, that makes zero sense at all. If your neighbour left his wi-fi closed, but just downloaded twice as much stuff, would you be irritated? What if he gets a roommate and they share the same account? What's the difference between my neighbour is personally downloading twice as much stuff and my neighbour is letting other people to download stuff, doubling total usage on his account? Your argument supposes that open wi-fi will lead to increased average usage, which in turn will lead to higher prices, neither of which are obviously true. If I'm leaching off my neighbour's open network, chances are that I'll be using my own account less, so the average will tend to remain about the same. Even if I download more than I otherwise would have, because I'm not paying for it, the difference will be offset due to inconvenience: I can't control when my neighbour has his account on or off, or bounce the router if there's a problem. If I have to pick up my laptop and physically walk outside and park in the street to access his open wi-fi network, forget it, I'll use my own account. According to the theory increased usage leads to higher prices, we should be paying more for Internet access now than we were in 1999, and hugely more that from the early 90s when there were hardly any Internet users. That's nonsensical. I don't know about you, but I'm paying about the same for ADSL access now as I would have paid for dial-up access in the late 90s. The explosion of Internet use has lead to more competition, lower prices and lower costs. In the late 1990s, I was paying something like AUD$35 a month for dial-up access just for myself. With inflation, that's about equal to $45 in today's prices. Now I'm paying $60 for ADSL access, for two people, that is, about $30 per person -- less than I was paying for dial-up in 1999. Even though the total amount I'm paying has increased, the cost per person, or per megabyte, is lower than it was in the 90s. My total cost has increased because my circumstances have changed, not because the service is more expensive. That contradicts the prediction more usage leads to higher prices, and as far as I'm concerned, pretty much refutes the hypothesis. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Annoying octal notation
Albert van der Horst wrote: In article 6b5ea596-d1e3-483d-ba79-7b139d3c7...@z24g2000yqb.googlegroups.com, Bearophile bearophileh...@lycos.com wrote: MRAB: '_': what if in the future we want to allow them in numbers for clarity? Hettinger says it's hard (= requires too many changes) to do that and Python programs don't have big integer constants often enough, so probably that improvement will not see the light. In the meantime in a Python program of mine I have put a small bug, writing 100 instead of 1000. Now in Python I write 10*1000*1000, because I try to learn from my bugs. In D I enjoy writing 10_000_000. Forth is one of the few language that could accept 10,000,000 easily (Because numbers or any token is required too be separated by whitespace). I have added that to my ciforth. Especially useful doing number theoretic things and large pointers in a 64 bit language it is pleasant to have a separator like that. Even 32 bit : 0008,,0050,4CE0 Also: In Forth you can add interpreting words, so you can add a facility CD : CD C:/prog/forth that does a directory change. If this has been loaded it is natural to use 0CD to prevent the CD word from kicking in (definitions trump numbers in Forth.) Before you know it, you're in the habit of prefixing all hex numbers by 0 if they don't start with a decimal digit: 0DEAD 0BEEF So for me there is nothing natural about leading zero means octal. [snip] In Modula-2, a hexadecimal literal starts with a digit and ends with H, for example: 0FFH. Using a leading zero to indicate a certain base doesn't seem natural to me either. -- http://mail.python.org/mailman/listinfo/python-list