pyArkansas 2010 Call For Papers
The 3rd annual pyArkansas conference, a gathering of Python programming enthusiasts, will be held on Saturday, October 16th, on the campus of the University of Central Arkansas (Conway) and we would like you to present a talk. We are accepting proposals for 30 or 60 minute talks (25 and 55 minutes, actually) on anything Python. Do you want to present on a particular topic (Python 3? Web? Database? Objects? Packages? Images? GIS? Sphinx?)? How about telling us about that cool program you just wrote? This is a conference run by enthusiasts for enthusiasts; you will never find a better audience. Last year we had 78 people attend including students/teachers from at least 5 Arkansas Colleges/Universities as well as High School and home school students. Professionals from 5 different states were on hand as well. We will have a wiki up in the next week but, if you are interested, please send your name and a brief description of the topic you would like to present (a paragraph would be just fine). Tell us if you would like a 30 or 60-minute slot and anything else we should know. We'll select talks by October 1st, so you'll know a couple weeks in advance if you were selected (and there will be open space so even if you are not selected you still can give it a go). Send you proposal to pyar2-organiz...@python.org. -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
RedNotebook 1.1.1
RedNotebook 1.1.1 has been released. You can get the tarball, the Windows installer and links to distribution packages at http://rednotebook.sourceforge.net/downloads.html What is RedNotebook? RedNotebook is a **graphical journal** and diary helping you keep track of notes and thoughts. It includes a calendar navigation, customizable templates, export functionality and word clouds. You can also format, tag and search your entries. RedNotebook is available in the repositories of most common Linux distributions and a Windows installer is available. What's new? --- * Let user delete category with 'DELETE' key (LP:608717) * Sort categories alphabetically (LP:612859) * Fix: After clicking Change the text on an annotation, directly edit it (LP:612861) * Fix: Journal - _Journal in menu * Fix: Do not clear entry when category is changed in new-entry dialog * Fix: restore left divider position * Fix: Use rednotebook website for retrieving newest version information (LP:621975) * Windows: Shrink installer size * Windows: Update gtk libs * Windows: New theme * Windows: New icons * New translations: * English (United Kingdom) * Norwegian Bokmal * Many translations updated Cheers, Jendrik -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?
Oh, I am so going to regret getting sucked into this tarpit... oh well. On Sat, 21 Aug 2010 09:58:18 -0700, Hugh Aguilar wrote: The following is a pretty good example, in which Alex mixes big pseudo- intellectual words such as scintilla with gutter language such as turd in an ungrammatical mish-mash You say that like it's a bad thing. Besides, scintilla isn't a big pseudo-intellectual word. It might seem so to those whose vocabulary (that's another big word, like patronizing and fatuousness) is lacking, but it's really quite a simple word. It means a spark, hence scintillating, as in he thinks he's quite the scintillating wit, and he's half right. It also means an iota, a smidgen, a scarcely detectable amount, and if anyone can't see the connection between a spark and a smidgen, there's probably no hope for them. Nothing intellectual about it, let alone pseudo-intellectual, except that it comes from Latin. But then so do well more half the words in the English language. Anyway, I'm looking forward to hear why overuse of the return stack is a big reason why people use GCC rather than Forth. (Why GCC? What about other C compilers?) Me, in my ignorance, I thought it was because C was invented and popularised by the same universities which went on to teach it to millions of programmers, and is firmly in the poplar and familiar Algol family of languages, while Forth barely made any impression on those universities, and looks like line-noise and reads like Yoda. (And I'm saying that as somebody who *likes* Forth and wishes he had more use for it.) In my experience, the average C programmer wouldn't recognise a return stack if it poked him in the eye. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Detect string has non-ASCII chars without checking each char?
Hi! Another way : # -*- coding: utf-8 -*- import unicodedata def test_ascii(struni): strasc=unicodedata.normalize('NFD', struni).encode('ascii','replace') if len(struni)==len(strasc): return True else: return False print test_ascii(uabcde) print test_ascii(uabcdê) @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list
Re: Python why questions
On Aug 21, 1:33 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Fri, 20 Aug 2010 11:01:42 -0700, Russ P. wrote: Most programmers probably never use vectors and matrices, so they don't care about the inconsistency with standard mathematical notation. Perhaps you should ask the numpy programmers what they think about that. Why would I care in the least about something called numpy? Vectors and matrices are just arrays, and the suggestion that most programmers don't use arrays (or array-like objects like lists) is ludicrous. But the vast majority of arrays are not vectors or matrices in the mathematical sense. And the vast majority of programmers who use arrays have no clue about vectors and matrices in the mathematical sense. Ask your typical programmer what an SVD is. And yes, I understand that zero-based indexing can be slightly more efficient. That's why I think it's appropriate for low-level languages such as C. However, I think one-based indexing is more appropriate for high-level languages. Only if your aim is to reduce the learning curve for newbies and non- programmers, at the expense of making it easier for them to produce buggy code. If you're suggesting that one-based indexing makes it easier to produce buggy code, I think you must be smoking something. That's a defensible choice. I'm a great fan of Apple's Hypercard from the late 80s and early 90s, and it used one-based indexing, as well as English-like syntax like: Python is a high level language, and high-level languages have many features that make it easier for newbies as well as experienced programmers at the expense of extreme efficiency. But the array indexing in Python is a throwback to C: it is zero-based and uses square brackets. Say what you will, but both of those aspects just seem wrong and awkward to me. However, I've switched from Python to Scala, so I really don't care. You guys can have it. -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem checking an existing browser cookie
On 16 Αύγ, 14:31, Peter Otten __pete...@web.de wrote: Νίκος wrote: # initializecookie cookie=Cookie.SimpleCookie() cookie.load( os.environ.get('HTTP_COOKIE', '') ) mycookie =cookie.get('visitor') if ( mycookie and mycookie.value != 'nikos' ) or re.search( r'(cyta| yandex|13448|spider|crawl)', host ) is None: blabla... I checked and Chrome has acookienames visitor with a value ofnikos within. So, i have to ask why the if fails? Maybe it's because != != == Iwant ti if code block to be executed only if the browser cookie names visitor fetched doesnt cotnain the vbalue of 'nikos' Is there somethign wrong with the way i wrote it? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python why questions
On Sun, Aug 22, 2010 at 12:23 AM, Russ P. russ.paie...@gmail.com wrote: On Aug 21, 1:33 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Fri, 20 Aug 2010 11:01:42 -0700, Russ P. wrote: Most programmers probably never use vectors and matrices, so they don't care about the inconsistency with standard mathematical notation. Perhaps you should ask the numpy programmers what they think about that. Why would I care in the least about something called numpy? Because it's a popular matrix math package for Python. Its users are thus a subset of programmers which by definition don't fall into the most programmers group you describe. Cheers, Chris -- Google is your friend! http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
freq function
Here is a function which takes any list and creates a freq table, which can be printed unsorted, sorted by cases or items. It's supposed to mirror the proc freq in SAS. Dirk def freq(seq,order='unsorted',prin=True): #order can be unsorted, cases, items freq={} for s in seq: if s in freq: freq[s]+=1 else: freq[s]=1 if prin==True: print 'Items=',len(seq),'Cases=',len(freq) print '' if order=='unsorted': for k in freq.keys(): print k,freq[k],float(freq[k])/len(seq) elif order=='cases': #http://blog.client9.com/2007/11/sorting-python-dict-by- value.html freq2=sorted(freq.iteritems(), key=lambda (k,v): (v,k),reverse=True) for f in freq2: print f[0],f[1],float(f[1])/len(seq) elif order=='items': for k in sorted(freq.iterkeys()): print k,freq[k],float(freq[k])/len(seq) print '' return freq #test import random rand=[] for i in range(1): rand.append(str(int(100*random.random( fr=freq(rand) fr2=freq(rand,order='items') fr2=freq(rand,order='cases') -- http://mail.python.org/mailman/listinfo/python-list
Re: freq function
On Sun, Aug 22, 2010 at 1:31 PM, Dirk Nachbar dirk...@gmail.com wrote: Here is a function which takes any list and creates a freq table, which can be printed unsorted, sorted by cases or items. It's supposed to mirror the proc freq in SAS. Dirk def freq(seq,order='unsorted',prin=True): #order can be unsorted, cases, items freq={} for s in seq: if s in freq: freq[s]+=1 else: freq[s]=1 The above code can be replaced with this: freq = {} for s in seqn: freq[s] = freq.get(s,0) + 1 if prin==True: print 'Items=',len(seq),'Cases=',len(freq) print '' if order=='unsorted': for k in freq.keys(): print k,freq[k],float(freq[k])/len(seq) elif order=='cases': #http://blog.client9.com/2007/11/sorting-python-dict-by- value.html freq2=sorted(freq.iteritems(), key=lambda (k,v): (v,k),reverse=True) for f in freq2: print f[0],f[1],float(f[1])/len(seq) elif order=='items': for k in sorted(freq.iterkeys()): print k,freq[k],float(freq[k])/len(seq) print '' return freq #test import random rand=[] for i in range(1): rand.append(str(int(100*random.random( fr=freq(rand) fr2=freq(rand,order='items') fr2=freq(rand,order='cases') -- I feel the code you wrote is bloated a bit. You shall definately give another try to improvise it. http://mail.python.org/mailman/listinfo/python-list -- ~l0nwlf -- http://mail.python.org/mailman/listinfo/python-list
Re: freq function
On Sun, Aug 22, 2010 at 1:16 AM, Shashwat Anand anand.shash...@gmail.com wrote: On Sun, Aug 22, 2010 at 1:31 PM, Dirk Nachbar dirk...@gmail.com wrote: Here is a function which takes any list and creates a freq table, which can be printed unsorted, sorted by cases or items. It's supposed to mirror the proc freq in SAS. Dirk snip freq={} for s in seq: if s in freq: freq[s]+=1 else: freq[s]=1 The above code can be replaced with this: freq = {} for s in seq: freq[s] = freq.get(s,0) + 1 Which can be further replaced by: from collections import Counter freq = Counter(seq) Using collections.defaultdict is another possibility if one doesn't have Python 2.7. Cheers, Chris -- It really bothers me that Counter isn't a proper Bag. http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Running python script before user login
I have wrote a python script and want to run it before user login. To do that, I have added it to the ubuntu startup file (init.d). However it seems that the script doesn't work. I want to know does python modules work before user login? // Naderan *Mahmood; -- http://mail.python.org/mailman/listinfo/python-list
Re: Running python script before user login
On Sun, Aug 22, 2010 at 1:52 AM, Mahmood Naderan nt_mahm...@yahoo.com wrote: I have wrote a python script and want to run it before user login. To do that, I have added it to the ubuntu startup file (init.d). However it seems that the script doesn't work. Specify exactly how it's not working. Cheers, Chris -- More details = Better assistance -- http://mail.python.org/mailman/listinfo/python-list
how to use xdrlib
Hi there, I am trying to understand how xdrlib works as I want to read files in this format. The problem is I don't much about xdr (although I read http://docs.python.org/library/xdrlib.html and RFC 1832). Another problem is I don't know how the file I want to read was encoded. So when I do something like: import xdrlib f = open('file.xdr').read() data = xdrlib.Unpacker(f) Then, I don't know which unpack_* to use. If I use, repr(data.unpack_string()) sometimes it returns something meaningful like: 'Ryckaert-Bell.' but other times, '\x00\x00\x00\x04Bond\x00\x00\x00\x05Angle\x00\x00\x00\x00\x00\x00\x0bProper Dih.\x00' if not a error. Well, as you see, I am a bit lost here and any hint would be very appreciated. Thanks in advance, Alan -- Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate Department of Biochemistry, University of Cambridge. 80 Tennis Court Road, Cambridge CB2 1GA, UK. http://www.bio.cam.ac.uk/~awd28 -- http://mail.python.org/mailman/listinfo/python-list
Re: Running python script before user login
Specify exactly how it's not working. I have wrote a script to send my ip address to an email address. It does work when I am login (python sendip.py). I then followed the procedure in https://help.ubuntu.com/community/RcLocalHowto. However after restart, no email is sent. // Naderan *Mahmood; From: Chris Rebert c...@rebertia.com To: Mahmood Naderan nt_mahm...@yahoo.com Cc: python mailing list python-list@python.org Sent: Sun, August 22, 2010 1:28:45 PM Subject: Re: Running python script before user login On Sun, Aug 22, 2010 at 1:52 AM, Mahmood Naderan nt_mahm...@yahoo.com wrote: I have wrote a python script and want to run it before user login. To do that, I have added it to the ubuntu startup file (init.d). However it seems that the script doesn't work. Specify exactly how it's not working. Cheers, Chris -- More details = Better assistance -- http://mail.python.org/mailman/listinfo/python-list
Wrong unichr docstring in 2.7
I think there is a small point here. sys.version 2.7 (r27:82525, Jul 4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] print unichr.__doc__ unichr(i) - Unicode character Return a Unicode string of one character with ordinal i; 0 = i = 0x10. # but unichr(0x10fff) Traceback (most recent call last): File psi last command, line 1, in module ValueError: unichr() arg not in range(0x1) (narrow Python build) Note: I find 0x0 = i = 0x more logical than 0 = i = 0x (orange-apple comparaison) Ditto, for Python 2.6.5 Regards, jmf -- http://mail.python.org/mailman/listinfo/python-list
CodeSnipr Learning can be simple!!
Hi, All the group members right at here, we people recently lunched a website CodeSnipr based on Computer language like (PHP, RUBBY, HTML, CSS, MYSQL, JQURY, IPHONE DEVELOPMENT, JAVASCRIPT, C++,.NET,XML,C# etc.). CodeSnipr will provide you access to user generated tutorials. Here you can post your code snippet and learn from other's snippet. We believe learning can be simple. We want your feedback about this tutorial please visit to join this : http://www.codesnipr.com/. -- http://mail.python.org/mailman/listinfo/python-list
Re: Wrong unichr docstring in 2.7
On Sunday 22 August 2010, it occurred to jmfauth to exclaim: I think there is a small point here. sys.version 2.7 (r27:82525, Jul 4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] print unichr.__doc__ unichr(i) - Unicode character Return a Unicode string of one character with ordinal i; 0 = i = 0x10. # but unichr(0x10fff) Traceback (most recent call last): File psi last command, line 1, in module ValueError: unichr() arg not in range(0x1) (narrow Python build) This is very tricky ground. I consider the behaviour of unichr() to be wrong here. The user shouldn't have to care much about UTF-16 and the difference between wide and narrow Py_UNICODDE builds. In fact, in Python 3.1, this behaviour has changed: on a narrow Python 3 build, chr(0x10fff) == '\ud803\udfff' == '\U00010fff'. Now, the Python 2 behaviour can't be fixed [1] -- it was specified in PEP 261 [2], which means it was pretty much set in stone. Then, it was deemed more important for unichr() to always return a length-one string that for it to work with wide characters. And then add pretty half-arsed utf-16 support... The doc string could be changed for narrow Python builds. I myself don't think docstrings should change depending on build options like this -- it could be amended to document the different behaviours here. Note that the docs [3] already include this information. If you want to, feel free to report a bug at http://bugs.python.org/ Note: I find 0x0 = i = 0x more logical than 0 = i = 0x (orange-apple comparaison) Would a zero by any other name not look as small? Honestly, I myself find it nonsensical to qualify 0 by specifying a base, unless you go all the way and represent the full uint16_t by saying 0x = i = 0x - Thomas [1] http://bugs.python.org/issue1057588 [2] http://www.python.org/dev/peps/pep-0261/ [3] http://docs.python.org/library/functions.html#unichr -- http://mail.python.org/mailman/listinfo/python-list
Re: Wrong unichr docstring in 2.7
jmfauth wrote: I think there is a small point here. sys.version 2.7 (r27:82525, Jul 4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] print unichr.__doc__ unichr(i) - Unicode character Return a Unicode string of one character with ordinal i; 0 = i = 0x10. # but unichr(0x10fff) Traceback (most recent call last): File psi last command, line 1, in module ValueError: unichr() arg not in range(0x1) (narrow Python build) Note: I find 0x0 = i = 0x more logical than 0 = i = 0x (orange-apple comparaison) Ditto, for Python 2.6.5 Regards, jmf There are two variants that CPython can be compiled for, 16 bit Unicode and 32 bit. By default, the Windows implementation uses 16 bits, and the Linux one uses 32. I believe you can rebuild your version if you have access to an appropriate version MSC compiler, but I haven't any direct experience. At any rate, the bug here is that the docstring doesn't get patched to match the compile switches for your particular build of CPython. DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: how to use xdrlib
On Sunday 22 August 2010, it occurred to Alan Wilter Sousa da Silva to exclaim: Hi there, I am trying to understand how xdrlib works as I want to read files in this format. The problem is I don't much about xdr (although I read http://docs.python.org/library/xdrlib.html and RFC 1832). Another problem is I don't know how the file I want to read was encoded. So when I do something like: import xdrlib f = open('file.xdr').read() data = xdrlib.Unpacker(f) Then, I don't know which unpack_* to use. If you actually have read RFC 1832, then this surprises me: as far as I can see, and I have only skimmed the RFC so I may be wrong, it includes no way to specify the type of a piece of data -- you have to know what you're reading. If I use, repr(data.unpack_string()) sometimes it returns something meaningful like: 'Ryckaert-Bell.' This happens when the data was actually a string -- so you correctly used unpack_string but other times, '\x00\x00\x00\x04Bond\x00\x00\x00\x05Angle\x00\x00\x00\x00\x00\x00\x0bPrope r Dih.\x00' Here, you read data that was not originally a string as if it were one. What the xdrlib module did is: it read four bytes. Probably 00 00 00 24. And it interpreted these to be the length of the string you're trying to read. Actually, you probably should have read an int first. After that, you could have called unpack_string, which would have read in 00 00 00 04 -- aha, a four-long string -- and then read another four bytes, the actual string: Bond. Similarly, Angle has length 0x0005, it's followed by padding unto 4-byte margins, followed by the length of Proper Dih., which happens to be 0x000b. if not a error. That might happen if the number xdrlib interprets as the string length is larger than the length of the rest of the file. Well, as you see, I am a bit lost here and any hint would be very appreciated. Basically, you have to know which file format you're dealing with, and use the right unpack functions in the correct order for the specific file you're dealing with. So you need some documentation for the file format you're using -- XDR (like Microsoft's StructuredStorage, or even XML) doesn't as of itself make any claims about the nature or structure of the data it holds. Cheers, - Thomas -- http://mail.python.org/mailman/listinfo/python-list
Re: Running python script before user login
On Sunday 22 August 2010, it occurred to Mahmood Naderan to exclaim: Specify exactly how it's not working. I have wrote a script to send my ip address to an email address. It does work when I am login (python sendip.py). I then followed the procedure in https://help.ubuntu.com/community/RcLocalHowto. However after restart, no email is sent. The first step would be to make sure your init script is actually running. Add some simple command that you know will not fail, and where you can see easily that it worked. Say, you could use #!/bin/sh date /home/[USER]/Desktop/created_during_boot.txt as an init script. Then you could see that, if the file was created on your desktop, that the script is running at all. When you know that, THEN you can start to worry about Python (I think Ubuntu probably doesn't bring up the network before NetworkManager does this after login. So you might just not be able to send e-mail before login. You can check this by saving the output of /sbin/ifconfig somewhere) // Naderan *Mahmood; From: Chris Rebert c...@rebertia.com To: Mahmood Naderan nt_mahm...@yahoo.com Cc: python mailing list python-list@python.org Sent: Sun, August 22, 2010 1:28:45 PM Subject: Re: Running python script before user login On Sun, Aug 22, 2010 at 1:52 AM, Mahmood Naderan nt_mahm...@yahoo.com wrote: I have wrote a python script and want to run it before user login. To do that, I have added it to the ubuntu startup file (init.d). However it seems that the script doesn't work. Specify exactly how it's not working. Cheers, Chris -- More details = Better assistance -- http://mail.python.org/mailman/listinfo/python-list
ANN: warehouse Objects in SQLite : y_serial module
Module download at SourceForge http://yserial.sourceforge.net Documentation has been revised and v0.60 released. Serialization + persistance :: in a few lines of code, compress and annotate Python objects into SQLite; then later retrieve them chronologically by keywords without any SQL. Most useful standard module for a database to store schema-less data. The module is instructive in the way it unifies the standard batteries: sqlite3 (as of Python v2.5), zlib (for compression), and cPickle (for serializing objects). If your Python program requires data persistance, then y_serial is a module which should be worth importing. All objects are warehoused in a single database file in the most compressed form possible. Tables are used to differentiate projects. Steps for insertion, organization by annotation, and finally retrieval are amazingly simple... y_serial.py module :: warehouse Python objects with SQLite http://yserial.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Detect string has non-ASCII chars without checking each char?
On Aug 22, 5:07 pm, Michel Claveau - MVPenleverlesx_xx...@xmclavxeaux.com.invalid wrote: Hi! Another way : # -*- coding: utf-8 -*- import unicodedata def test_ascii(struni): strasc=unicodedata.normalize('NFD', struni).encode('ascii','replace') if len(struni)==len(strasc): return True else: return False print test_ascii(uabcde) print test_ascii(uabcdê) -1 Try your code with uabcd\xa1 ... it says it's ASCII. Suggestions: test_ascii = lambda s: len(s.decode('ascii', 'ignore')) == len(s) or test_ascii = lambda s: all(c u'\x80' for c in s) or use try/except Also: if a == b: return True else: return False is a horribly bloated way of writing return a == b -- http://mail.python.org/mailman/listinfo/python-list
trying to use sdl_pango with python
i'm new to ctypes. can someone help me use sdl_pango with python? here's the documentation: http://sdlpango.sourceforge.net/ here's my code: - import pygame from ctypes import * import win32api MATRIX_TRANSPARENT_BACK_WHITE_LETTER = c_char_p(\xFF\xFF\0\0\xFF\xFF \0\0\xFF\xFF\0\0\0\xFF\0\0) margin_x = margin_y = 10 def sdlwrite(rtext, width, height=None): context = sdlpango.SDLPango_CreateContext() sdlpango.SDLPango_SetDefaultColor(context, MATRIX_TRANSPARENT_BACK_WHITE_LETTER) sdlpango.SDLPango_SetMinimumSize(context, width, height) sdlpango.SDLPango_SetMarkup(context, rtext, -1) w = sdlpango.SDLPango_GetLayoutWidth(context) h = sdlpango.SDLPango_GetLayoutHeight(context) surface = sdl.SDL_CreateRGBSurface(sdlpango.SDL_SWSURFACE, w + margin_x, h + margin_y, 32, 255 (8*3), 255 (8*2), 255 (8*1), 255) sp = POINTER(surface) sdlpango.SDLPango_Draw(context, ps, margin_x, margin_y) sdl.SDL_FreeSurface(ps) return context def surfwrite(rtext, width, height=None): sdlcontext = sdlwrite(rtext, width, height) print 'sdlcontext:', sdlcontext #scr = pygame.set_mode() #rloss, gloss, bloss, aloss = scr. sdlpango = windll.LoadLibrary(rC:\projects\soundshop\pango-1.18.3\bin \sdl_pango.dll) sdl = windll.LoadLibrary(rsdl.dll) #sdlpango.SDLPango_SetDefaultColor.argtypes = [c_void_p, c_char_p] #sdlpango.SDLPango_SetMinimumSize.argtypes = [c_void_p, c_int, c_int] #sdlpango.SDLPango_SetMarkup.argtypes = [c_void_p, c_char_p, c_int] #sdlpango.SDLPango_GetLayoutWidth.argtypes = [c_void_p] #sdlpango.SDLPango_GetLayoutHeight.argtypes = [c_void_p] #sdl.SDL_CreateRGBSurface.argtypes = [c_uint, c_int, c_int, c_int, c_uint, c_uint, c_uint, c_uint] #sdlpango.SDLPango_Draw.argtypes = [c_void_p, c_uint, c_int, c_int] #sdl.SDL_FreeSurface.argtypes = [c_void_p] sdlpango.SDLPango_SetDefaultColor.argtypes = [c_uint, c_uint] sdlpango.SDLPango_SetMinimumSize.argtypes = [c_uint, c_int, c_int] sdlpango.SDLPango_SetMarkup.argtypes = [c_uint, c_char_p, c_int] sdlpango.SDLPango_GetLayoutWidth.argtypes = [c_uint] sdlpango.SDLPango_GetLayoutHeight.argtypes = [c_uint] sdl.SDL_CreateRGBSurface.argtypes = [c_uint, c_int, c_int, c_int, c_uint, c_uint, c_uint, c_uint] sdlpango.SDLPango_Draw.argtypes = [c_uint, c_uint, c_int, c_int] sdl.SDL_FreeSurface.argtypes = [c_uint] surfwrite(hello, 640) - here's the .h file that i got MATRIX_TRANSPARENT_BACK_WHITE_LETTER from. http://sdlpango.sourceforge.net/_s_d_l___pango_8h-source.html - here's my error: Traceback (most recent call last): File C:\projects\soundshop\sdlpango.py, line 54, in module surfwrite(hello, 640) File C:\projects\soundshop\sdlpango.py, line 25, in surfwrite sdlcontext = sdlwrite(rtext, width, height) File C:\projects\soundshop\sdlpango.py, line 13, in sdlwrite sdlpango.SDLPango_SetDefaultColor(context, MATRIX_TRANSPARENT_BACK_WHITE_LETTER) ctypes.ArgumentError: argument 2: type 'exceptions.TypeError': wrong type - i've tried other things, like using c_char_p instead for MATRIX_TRANSPARENT_BACK_WHITE_LETTER, but the only other result i can manage to get is this: C:\projects\soundshopsdlpango.py Traceback (most recent call last): File C:\projects\soundshop\sdlpango.py, line 52, in module surfwrite(hello, 640) File C:\projects\soundshop\sdlpango.py, line 25, in surfwrite sdlcontext = sdlwrite(rtext, width, height) File C:\projects\soundshop\sdlpango.py, line 13, in sdlwrite sdlpango.SDLPango_SetDefaultColor(context, MATRIX_TRANSPARENT_BACK_WHITE_LETTER) ValueError: Procedure probably called with too many arguments (8 bytes in excess) - thx for any help. -- http://mail.python.org/mailman/listinfo/python-list
Re: freq function
Dirk Nachbar wrote: Here is a function which takes any list and creates a freq table, which can be printed unsorted, sorted by cases or items. It's supposed to mirror the proc freq in SAS. Dirk def freq(seq,order='unsorted',prin=True): #order can be unsorted, cases, items freq={} for s in seq: if s in freq: freq[s]+=1 else: freq[s]=1 if prin==True: print 'Items=',len(seq),'Cases=',len(freq) print '' if order=='unsorted': for k in freq.keys(): print k,freq[k],float(freq[k])/len(seq) elif order=='cases': #http://blog.client9.com/2007/11/sorting-python-dict-by- value.html freq2=sorted(freq.iteritems(), key=lambda (k,v): (v,k),reverse=True) Sorting in two steps gives a slightly better result when there are items with equal keys. Compare freq = {a: 2, b: 1, c: 1, d: 2} sorted(freq.iteritems(), key=lambda (k, v): (v, k), reverse=True) [('d', 2), ('a', 2), ('c', 1), ('b', 1)] with freq2 = sorted(freq.iteritems(), key=lambda (k, v): k) freq2.sort(key=lambda (k, v): v, reverse=True) freq2 [('a', 2), ('d', 2), ('b', 1), ('c', 1)] Here the keys within groups of equal frequency are in normal instead of reversed order. -- http://mail.python.org/mailman/listinfo/python-list
Re: Running python script before user login
I am trying to execute this script before login: #!/bin/sh date /home/mahmood/dateatboot.txt echo In local file /usr/bin/python2.6 /home/mahmood/sendip.py echo python script finished after restart, dateatboot.txt was created shows that the script was executed. In the python file, I have this: import smtplib, commands, os, datetime # find IP address and write to file print 'I am in python file' f = open('.ip.txt', 'w') f.write( commands.getoutput(ifconfig).split(\n)[1].split()[1][5:]) f.close() ... After boot there is no .ip.txt file. // Naderan *Mahmood; From: Thomas Jollans tho...@jollybox.de To: python-list@python.org Sent: Sun, August 22, 2010 3:17:57 PM Subject: Re: Running python script before user login On Sunday 22 August 2010, it occurred to Mahmood Naderan to exclaim: Specify exactly how it's not working. I have wrote a script to send my ip address to an email address. It does work when I am login (python sendip.py). I then followed the procedure in https://help.ubuntu.com/community/RcLocalHowto. However after restart, no email is sent. The first step would be to make sure your init script is actually running. Add some simple command that you know will not fail, and where you can see easily that it worked. Say, you could use #!/bin/sh date /home/[USER]/Desktop/created_during_boot.txt as an init script. Then you could see that, if the file was created on your desktop, that the script is running at all. When you know that, THEN you can start to worry about Python (I think Ubuntu probably doesn't bring up the network before NetworkManager does this after login. So you might just not be able to send e-mail before login. You can check this by saving the output of /sbin/ifconfig somewhere) // Naderan *Mahmood; From: Chris Rebert c...@rebertia.com To: Mahmood Naderan nt_mahm...@yahoo.com Cc: python mailing list python-list@python.org Sent: Sun, August 22, 2010 1:28:45 PM Subject: Re: Running python script before user login On Sun, Aug 22, 2010 at 1:52 AM, Mahmood Naderan nt_mahm...@yahoo.com wrote: I have wrote a python script and want to run it before user login. To do that, I have added it to the ubuntu startup file (init.d). However it seems that the script doesn't work. Specify exactly how it's not working. Cheers, Chris -- More details = Better assistance -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Running python script before user login
On Sunday 22 August 2010, it occurred to Mahmood Naderan to exclaim: I am trying to execute this script before login: #!/bin/sh date /home/mahmood/dateatboot.txt echo In local file /usr/bin/python2.6 /home/mahmood/sendip.py echo python script finished after restart, dateatboot.txt was created shows that the script was executed. In the python file, I have this: import smtplib, commands, os, datetime # find IP address and write to file print 'I am in python file' f = open('.ip.txt', 'w') f.write( commands.getoutput(ifconfig).split(\n)[1].split()[1][5:]) f.close() ... After boot there is no .ip.txt file. Where are you looking? Do you actually know in which working directory your script is being executed? How about something like this: #!/bin/sh cd /home/mahmood/ python sendip.py sendip.log 21 ... this will write Python's output to a log file. If there is an exception, you'd be able to see it. // Naderan *Mahmood; From: Thomas Jollans tho...@jollybox.de To: python-list@python.org Sent: Sun, August 22, 2010 3:17:57 PM Subject: Re: Running python script before user login On Sunday 22 August 2010, it occurred to Mahmood Naderan to exclaim: Specify exactly how it's not working. I have wrote a script to send my ip address to an email address. It does work when I am login (python sendip.py). I then followed the procedure in https://help.ubuntu.com/community/RcLocalHowto. However after restart, no email is sent. The first step would be to make sure your init script is actually running. Add some simple command that you know will not fail, and where you can see easily that it worked. Say, you could use #!/bin/sh date /home/[USER]/Desktop/created_during_boot.txt as an init script. Then you could see that, if the file was created on your desktop, that the script is running at all. When you know that, THEN you can start to worry about Python (I think Ubuntu probably doesn't bring up the network before NetworkManager does this after login. So you might just not be able to send e-mail before login. You can check this by saving the output of /sbin/ifconfig somewhere) // Naderan *Mahmood; From: Chris Rebert c...@rebertia.com To: Mahmood Naderan nt_mahm...@yahoo.com Cc: python mailing list python-list@python.org Sent: Sun, August 22, 2010 1:28:45 PM Subject: Re: Running python script before user login On Sun, Aug 22, 2010 at 1:52 AM, Mahmood Naderan nt_mahm...@yahoo.com wrote: I have wrote a python script and want to run it before user login. To do that, I have added it to the ubuntu startup file (init.d). However it seems that the script doesn't work. Specify exactly how it's not working. Cheers, Chris -- More details = Better assistance -- http://mail.python.org/mailman/listinfo/python-list
Re: Running python script before user login
It seems that changing the directory before python command is mandatory: #!/bin/sh cd /home/mahmood/ python sendip.py I am now able to receive the IP address right after boot and before login page. Thank you // Naderan *Mahmood; From: Thomas Jollans tho...@jollybox.de To: python-list@python.org Sent: Sun, August 22, 2010 5:50:00 PM Subject: Re: Running python script before user login On Sunday 22 August 2010, it occurred to Mahmood Naderan to exclaim: I am trying to execute this script before login: #!/bin/sh date /home/mahmood/dateatboot.txt echo In local file /usr/bin/python2.6 /home/mahmood/sendip.py echo python script finished after restart, dateatboot.txt was created shows that the script was executed. In the python file, I have this: import smtplib, commands, os, datetime # find IP address and write to file print 'I am in python file' f = open('.ip.txt', 'w') f.write( commands.getoutput(ifconfig).split(\n)[1].split()[1][5:]) f.close() ... After boot there is no .ip.txt file. Where are you looking? Do you actually know in which working directory your script is being executed? How about something like this: #!/bin/sh cd /home/mahmood/ python sendip.py sendip.log 21 ... this will write Python's output to a log file. If there is an exception, you'd be able to see it. // Naderan *Mahmood; From: Thomas Jollans tho...@jollybox.de To: python-list@python.org Sent: Sun, August 22, 2010 3:17:57 PM Subject: Re: Running python script before user login On Sunday 22 August 2010, it occurred to Mahmood Naderan to exclaim: Specify exactly how it's not working. I have wrote a script to send my ip address to an email address. It does work when I am login (python sendip.py). I then followed the procedure in https://help.ubuntu.com/community/RcLocalHowto. However after restart, no email is sent. The first step would be to make sure your init script is actually running. Add some simple command that you know will not fail, and where you can see easily that it worked. Say, you could use #!/bin/sh date /home/[USER]/Desktop/created_during_boot.txt as an init script. Then you could see that, if the file was created on your desktop, that the script is running at all. When you know that, THEN you can start to worry about Python (I think Ubuntu probably doesn't bring up the network before NetworkManager does this after login. So you might just not be able to send e-mail before login. You can check this by saving the output of /sbin/ifconfig somewhere) // Naderan *Mahmood; From: Chris Rebert c...@rebertia.com To: Mahmood Naderan nt_mahm...@yahoo.com Cc: python mailing list python-list@python.org Sent: Sun, August 22, 2010 1:28:45 PM Subject: Re: Running python script before user login On Sun, Aug 22, 2010 at 1:52 AM, Mahmood Naderan nt_mahm...@yahoo.com wrote: I have wrote a python script and want to run it before user login. To do that, I have added it to the ubuntu startup file (init.d). However it seems that the script doesn't work. Specify exactly how it's not working. Cheers, Chris -- More details = Better assistance -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Python why questions
On 2010-08-21, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: There is room in the world for programming languages aimed at non- programmers (although HC is an extreme case), but not all languages should prefer the intuition of non-programmers over other values. Extremer: Inform 7. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list
Re: Wrong unichr docstring in 2.7
Short comments: 1) I'm aware Python can be built in ucs2 or ucs4 mode. It remains that the unichr doc string does not seem correct. 2) 0x0 versus 0 Do not take this too seriously. Sure the value of 0x0 and 0 are equal, but the unit sounds strange. Eg. If a is a length, I would not express a as beeing 0 mm = a = 999 m (or 0 in = a = 999 ft) but 0 m = a = 999 m . I agree a notation like 0x = i = 0x is even the best. 3) Of course, the Python 3 behaviour (chr() instead of unichr()) is correct. jmf -- http://mail.python.org/mailman/listinfo/python-list
windows hook to catch WM_CREATE
Hello all, I'm looking for a method, lib, ... to create a windows hook to catch WM_CREATE message in python 2.6? For keyboard and mouse I use pyHook. any idea ? -- Jacques -- http://mail.python.org/mailman/listinfo/python-list
Re: Detect string has non-ASCII chars without checking each char?
Re ! Try your code with uabcd\xa1 ... it says it's ASCII. Ah? in my computer, it say False @-salutations -- MCi -- http://mail.python.org/mailman/listinfo/python-list
Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?
John Bokma j...@castleamber.com writes: David Kastrup d...@gnu.org writes: John Passaniti john.passan...@gmail.com writes: Amen! All this academic talk is useless. Who cares about things like the big-O notation for program complexity. Can't people just *look* at code and see how complex it is?! And take things like the years of wasted effort computer scientists have put into taking data structures (like hashes and various kinds of trees) and extending them along various problem domains and requirements. Real programmers don't waste their time with learning that junk. What good did any of that ever do anyone?! It is my experience that in particular graduated (and in particular Phd) computer scientists don't waste their time _applying_ that junk. Question: do you have a degree in computer science? Since in my experience: people who talk about their experience with graduated people often missed the boat themselves and think that reading a book or two equals years of study. I have a degree in electrical engineering. But that's similarly irrelevant. I have a rather thorough background with computers (started with punched cards), get along with about a dozen assembly languages and quite a few other higher level languages. I've had to write the BIOS for my first computer and a number of other stuff and did digital picture enhancement on DOS computers with EMM (programming 80387 assembly language and using a variant of Hartley transforms). I have rewritten digital map processing code from scratch that has been designed and optimized by graduated computer scientists (including one PhD) to a degree where it ran twice as fast as originally, at the cost of occasional crashes and utter unmaintainability. Twice as fast meaning somewhat less than a day of calculation time for medium size data sets (a few 10 of data points, on something like a 25MHz 68020 or something). So I knew the problem was not likely to be easy. Took me more than a week. After getting the thing to compile and fixing the first few crashing conditions, I got stuck in debugging. The thing just terminated after about 2 minutes of runtime without an apparent reason. I spent almost two more days trying to find the problem before bothering to even check the output. The program just finished regularly. That has not particularly helped my respect towards CS majors and PhDs in the function of programmers (and to be honest: their education is not intended to make them good programmers, but to enable them to _lead_ good programmers). That does not mean that I am incapable of analyzing, say quicksort and mergesort, and come up with something reasonably close to a closed form for average, min, and max comparisons (well, unless a close approximation is good enough, you have to sum about lg n terms which is near instantaneous, with a real closed form mostly available when n is special, like a power of 2). And I know how to work with more modern computer plagues, like the need for cache coherency. So in short, I have a somewhat related scientific education, but I can work the required math. And I can work the computers. Oh, and rest assured, it works both ways: people who did graduate are now and then thinking it's the holy grail and no body can beat it with home study. Both are wrong, by the way. Depends. In my personal opinion, living close to the iron and being sharp enough can make a lot of a difference. Donald Knuth never studied computer science. He more or less founded it. As a programmer, he is too much artist and too little engineer for my taste: you can't take his proverbial masterpiece TeX apart without the pieces crumbling. He won't write inefficient programs: he has the respective gene and the knowledge to apply it. But the stuff he wrote is not well maintainable and reusable. Of course, he has no need for reuse if he can rewrite as fast as applying an interface. -- David Kastrup -- http://mail.python.org/mailman/listinfo/python-list
Organizing unit test?
Over the years, I've tried different styles of organizing unit tests. I used to create a test directory and put all my tests there. I would maintain a one-to-one correspondence between production source and test source, i.e. the test code for foo.py would be in test/foo.py. More recently, I've taken to having foo.py and test_foo.py in the same directory. My latest experiment is to just put both the production code and the test code in the same file, ending with if __name__ == '__main__': unittest.main() So, if I import the file, I get the production code as a module, and if I run it from the command line, it runs the tests. This makes the file messier, but it makes the directory structure cleaner and (I think) makes the whole thing easier to edit. Any of these work. I'm just curious what organizations other people have used and what the plusses and minuses ended up being. -- http://mail.python.org/mailman/listinfo/python-list
Re: Get authentication error while using 'smtplib'
Well, login plain did the job: session = smtplib.SMTP(smtpserver) session.ehlo() session.esmtp_features[auth] = LOGIN PLAINif AUTHREQUIRED: session.login(smtpuser, smtppass) // Naderan *Mahmood; From: Mahmood Naderan nt_mahm...@yahoo.com To: python mailing list python-list@python.org Sent: Fri, August 20, 2010 6:13:20 PM Subject: Get authentication error while using 'smtplib' I have this script to send an email via SMTP: import smtplib smtpserver = 'smtp.server.com' AUTHREQUIRED = 1# if you need to use SMTP AUTH set to 1 smtpuser = username# for SMTP AUTH, set SMTP username here smtppass = password# for SMTP AUTH, set SMTP password here RECIPIENTS ='recipi...@server.com' SENDER = 'sen...@server.com' mssg = open('filename.txt', 'r').read() session = smtplib.SMTP(smtpserver) if AUTHREQUIRED: session.login(smtpuser, smtppass) smtpresult = session.sendmail(SENDER, RECIPIENTS, mssg) After running the script I get this error: Traceback (most recent call last): File my_mail.py, line 14, in module session.login(smtpuser, smtppass) File /usr/lib/python2.6/smtplib.py, line 589, in login raise SMTPAuthenticationError(code, resp) smtplib.SMTPAuthenticationError: (535, '5.7.0 Error: authentication failed: authentication failure') However there is no problem with my user/pass because I can login to my mail account. Thanks for any idea. // Naderan *Mahmood; -- http://mail.python.org/mailman/listinfo/python-list
comparing tuples
level: beginners I was trying to write simple code that compares 2 tuples and returns any element in the second tuple that is not in the first tuple. def tuples(t1, t2): result = [] for b in t2: for a in t1: if b == a: break else: result=result+[b,] return result print tuples([0,5,6], [0,5,6,3,7]) the code works but i was surprised by the following: my understanding was that an ELSE clause is part of an IF statement. Therefore it comes at the same indentation as the IF statement. However the above example only works if the ELSE clause is positioned under the second FOR loop. As if it was an ELSE clause without an IF statement!? Why/How does this work? tnx Baba -- http://mail.python.org/mailman/listinfo/python-list
Re: Iterative vs. Recursive coding
Steven D'Aprano st...@remove-this-cybersource.com.au writes: * It throws away information from tracebacks if the recursive function fails; and [...] If you're like me, you're probably thinking that the traceback from an exception in a recursive function isn't terribly useful. Agreed. On the other hand, a full-fledged tail recursion optimization might throw away more than that. For tail recursion elimination to work for those used to it, it needs to also handle the case of mutually recursive tail calls. The obvious way is by eliminating *all* tail calls, not just recursive ones. Tail call optimization, as opposed to tail recursion optimization, means that code such as: def f(n): return g(n + 5) is executed by a conceptual jump from the body of f to the body of g, regardless of whether recursion is involved at any point in the call chain. Now, if invocation of g() fails, the stack trace will show no sign of f() having been invoked. On the other hand, if f() invocation remains stored on the stack, mutually recursive functions will overflow it. Python being dynamic, I would expect it to be impossible to determine at compile-time whether a tail call will ultimately lead to a recursive invocation. -- http://mail.python.org/mailman/listinfo/python-list
Re: comparing tuples
On 08/22/10 12:50, Baba wrote: level: beginners I was trying to write simple code that compares 2 tuples and returns any element in the second tuple that is not in the first tuple. def tuples(t1, t2): result = [] for b in t2: for a in t1: if b == a: break else: result=result+[b,] return result print tuples([0,5,6], [0,5,6,3,7]) the code works but i was surprised by the following: my understanding was that an ELSE clause is part of an IF statement. Therefore it comes at the same indentation as the IF statement. The ELSE clause can be used either with an IF (as you know) or with a FOR loop, which is interpreted as if this loop reached the end naturally instead of exiting via a BREAK statement, execute this block of code. If you reach the end of t1 without having found a value (and then issuing a break), then the current value of t2 (b) should be appended to the result. That said, unless order matters, I'd just use sets: def tuples(t1, t2): return list(set(t2)-set(t1)) which should have better performance characteristics for large inputs. -tkc -- http://mail.python.org/mailman/listinfo/python-list
Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?
David Kastrup d...@gnu.org writes: John Bokma j...@castleamber.com writes: David Kastrup d...@gnu.org writes: John Passaniti john.passan...@gmail.com writes: Amen! All this academic talk is useless. Who cares about things like the big-O notation for program complexity. Can't people just *look* at code and see how complex it is?! And take things like the years of wasted effort computer scientists have put into taking data structures (like hashes and various kinds of trees) and extending them along various problem domains and requirements. Real programmers don't waste their time with learning that junk. What good did any of that ever do anyone?! It is my experience that in particular graduated (and in particular Phd) computer scientists don't waste their time _applying_ that junk. Question: do you have a degree in computer science? Since in my experience: people who talk about their experience with graduated people often missed the boat themselves and think that reading a book or two equals years of study. I have a degree in electrical engineering. But that's similarly irrelevant. Nah, it's not: your attitude towards people with a degree in computer science agrees with what I wrote. That has not particularly helped my respect towards CS majors and PhDs in the function of programmers (and to be honest: their education is not intended to make them good programmers, but to enable them to _lead_ good programmers). I disagree. That does not mean that I am incapable of analyzing, say quicksort and mergesort, Oh, that's what I was not implying. I am convinced that quite some people who do self-study can end up with better understanding of things than people who do it for a degree. I have done both: I already was programming in several languages before I was studying CS. And my experience is that a formal study in CS can't compare to home study unless you're really good and have the time and drive to read formal books written on CS. And my experience is that most self-educaters don't have that time. On the other hand: some people I knew during my studies had no problem at all with introducing countless memory leaks in small programs (and turning off compiler warnings, because it gave so much noise...) Donald Knuth never studied computer science. Yes, yes, and Albert Einstein worked at an office. Those people are very rare. But my experience (see for plenty of examples: Slashdot) is that quite some people who don't have a degree think that all that formal education is just some paper pushing and doesn't count. While some of those who do have the paper think they know it all. Those people who are right in either group are a minority in my experience. As for electrical engineering: done that (BSc) and one of my class mates managed to connect a transformer the wrong way around twice. Yet he had the highest mark in our class. So in short: yes, self-study can make you good at something. But self-study IMO is not in general a replacement for a degree. Someone who can become great after self-study would excel at a formal study and learn more. Study works best if there is competition and if there are challenges. I still study a lot at home, but I do miss the challenges and competition. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
[ANN]VTD-XML 2.9
VTD-XML 2.9, the next generation XML Processing API for SOA and Cloud computing, has been released. Please visit https://sourceforge.net/projects/vtd-xml/files/ to download the latest version. * Strict Conformance # VTD-XML now fully conforms to XML namespace 1.0 spec * Performance Improvement # Significantly improved parsing performance for small XML files * Expand Core VTD-XML API # Adds getPrefixString(), and toNormalizedString2() * Cutting/Splitting # Adds getSiblingElementFragment() * A number of bug fixes and code enhancement including: # Fixes a bug for reading very large XML documents on some platforms # Fixes a bug in parsing processing instruction # Fixes a bug in outputAndReparse() -- http://mail.python.org/mailman/listinfo/python-list
Re: Iterative vs. Recursive coding
Steven D'Aprano st...@remove-this-cybersource.com.au writes: On Sat, 21 Aug 2010 19:09:52 -0500, John Bokma wrote: this means that Python should eliminate / optimize tail recursion. There have been various suggestions to add tail recursion optimization to the language. Two problems: [snip] But this is not the only sort of tail-call recursion, and a traceback like the following is useful: recurse(4) Traceback (most recent call last): File stdin, line 1, in module File stdin, line 5, in recurse File stdin, line 3, in f File stdin, line 5, in recurse File stdin, line 3, in f File stdin, line 5, in recurse File stdin, line 3, in f File stdin, line 4, in recurse File stdin, line 2, in g ValueError If all you saw was the last line (the call to g), debugging the exception would be significantly harder. Yup, agreed, good example. Me personally, I'd like to see either a (preferably) run-time setting or compile-time switch that enables/disables this optimization. Even an explicit decorator would be fine. And lo and behold: http://hircus.wordpress.com/2008/06/21/python-tail-call-optimization-done-right/ http://groups.google.com/group/comp.lang.python/msg/9b047d1392f2b8ec Add it to your bag of tricks and have fun. Thanks for the links. And yes, I will add this to my bag of tricks (aka local wiki with notes ;-) ). -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Sphinx cross reference question
In my shopzeus.db.pivot.convert.py file, in the run() method of my Data2Facts class, I can write this into the docstring: class Data2Facts(threading.Thread): # code here... def prepare(self,*args): # code here... # more code here def run(self): Start data conversion. You need to call :meth:`prepare` before starting the conversion with :meth:`run`. # more code here... This works perfectly - it places cross links in the HTML documentation. I have another file where I'm writting a tutorial for my Data2Facts class. It is not the API, but I would like to make references to the API. So I can do this: The :meth:`shopzeus.db.pivot.convert.Data2Facts.prepare` method is used for blablabla However, I do not want to write shopzeus.db.pivot.convert. every time. I want to make this my current module for cross-referencing. So I tried this: .. :currentmodule:: shopzeus.db.pivot.convert The :meth:`Data2Facts.prepare` method is used for blablabla But it does not work! It is displayed in bold, but there is no link. The sphinx build command does not give me any warnings about invalid references. What am I doing wrong? Thanks, Laszlo -- http://mail.python.org/mailman/listinfo/python-list
Re: Python why questions
On Aug 22, 12:47 am, Chris Rebert c...@rebertia.com wrote: On Sun, Aug 22, 2010 at 12:23 AM, Russ P. russ.paie...@gmail.com wrote: On Aug 21, 1:33 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Fri, 20 Aug 2010 11:01:42 -0700, Russ P. wrote: Most programmers probably never use vectors and matrices, so they don't care about the inconsistency with standard mathematical notation. Perhaps you should ask the numpy programmers what they think about that. Why would I care in the least about something called numpy? Because it's a popular matrix math package for Python. Its users are thus a subset of programmers which by definition don't fall into the most programmers group you describe. Yes, I know what numpy is, and I'm sure it's great. I was just taking a light-hearted jab at the name. -- http://mail.python.org/mailman/listinfo/python-list
Re: comparing tuples
On Aug 22, 7:12 pm, Tim Chase python.l...@tim.thechases.com wrote: On 08/22/10 12:50, Baba wrote: level: beginners I was trying to write simple code that compares 2 tuples and returns any element in the second tuple that is not in the first tuple. def tuples(t1, t2): result = [] for b in t2: for a in t1: if b == a: break else: result=result+[b,] return result print tuples([0,5,6], [0,5,6,3,7]) the code works but i was surprised by the following: my understanding was that an ELSE clause is part of an IF statement. Therefore it comes at the same indentation as the IF statement. The ELSE clause can be used either with an IF (as you know) or with a FOR loop, which is interpreted as if this loop reached the end naturally instead of exiting via a BREAK statement, execute this block of code. If you reach the end of t1 without having found a value (and then issuing a break), then the current value of t2 (b) should be appended to the result. That said, unless order matters, I'd just use sets: def tuples(t1, t2): return list(set(t2)-set(t1)) which should have better performance characteristics for large inputs. -tkc Thanks Tim! -- http://mail.python.org/mailman/listinfo/python-list
Re: Iterative vs. Recursive coding
On 8/21/2010 8:32 PM, Steven D'Aprano wrote: On Sat, 21 Aug 2010 19:09:52 -0500, John Bokma wrote: this means that Python should eliminate / optimize tail recursion. There have been various suggestions to add tail recursion optimization to the language. Two problems: * It throws away information from tracebacks if the recursive function fails; and * nobody willing to do the work is willing to champion it sufficiently to get it approved in the face of opposition due to the above. I would rank tail recursion way down on the list of things which make CPython slow. (Unladen Swallow seems to have stalled. Last quarterly release, October 2009. Last wiki update, May 2010. Last issue advanced to started state, Feb. 2010. There are still code checkins, so somebody is still working, but little visible progress. They did get a JIT working, but discovered that the performance improvement was very slight. They wanted at least 5x; they got 1x to 2x at best.) John Nagle -- http://mail.python.org/mailman/listinfo/python-list
Re: psycopg2 for insertion of binary data to PostgreSQL database
Thanks a lot, this was the solution. It would be greate, if you could also show me a way to extract the inserted binary object from the table on the server to a file on a client. Peter Otten wrote: Julia Jacobson wrote: Hello everybody out there using python, For the insertion of pictures into my PostgreSQL database [with table foo created by SQL command CREATE TABLE foo (bmp BYTEA)], I've written the following script: #!/usr/bin/python import psycopg2 try: conn = psycopg2.connect(dbname='postgres' user='postgres' host='localhost' password='data'); except: print I am unable to connect to the database cur = conn.cursor() f = open(test.bmp, 'rb') myfile = f.read() try: cur.execute(INSERT INTO foo VALUES (%s),(buffer(myfile),)) except: print Insert unsuccessful python script.py runs the script without any errors or messages. However, the SQL command SELECT * FROM foo returns the output foo (0 rows) with no entries in the table. I'm using Python 2.7 and PostgreSQL 8.3. Could anyone help me to find a way to pin down the problem? Perhaps you need to conn.commit() your changes. -- http://mail.python.org/mailman/listinfo/python-list
Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?
Le Sun, 22 Aug 2010 20:12:36 +0200, John Bokma j...@castleamber.com a écrit: David Kastrup d...@gnu.org writes: John Bokma j...@castleamber.com writes: David Kastrup d...@gnu.org writes: John Passaniti john.passan...@gmail.com writes: Amen! All this academic talk is useless. Who cares about things like the big-O notation for program complexity. Can't people just *look* at code and see how complex it is?! And take things like the years of wasted effort computer scientists have put into taking data structures (like hashes and various kinds of trees) and extending them along various problem domains and requirements. Real programmers don't waste their time with learning that junk. What good did any of that ever do anyone?! It is my experience that in particular graduated (and in particular Phd) computer scientists don't waste their time _applying_ that junk. Question: do you have a degree in computer science? Since in my experience: people who talk about their experience with graduated people often missed the boat themselves and think that reading a book or two equals years of study. I have a degree in electrical engineering. But that's similarly irrelevant. Nah, it's not: your attitude towards people with a degree in computer science agrees with what I wrote. That has not particularly helped my respect towards CS majors and PhDs in the function of programmers (and to be honest: their education is not intended to make them good programmers, but to enable them to _lead_ good programmers). I disagree. That does not mean that I am incapable of analyzing, say quicksort and mergesort, Oh, that's what I was not implying. I am convinced that quite some people who do self-study can end up with better understanding of things than people who do it for a degree. I have done both: I already was programming in several languages before I was studying CS. And my experience is that a formal study in CS can't compare to home study unless you're really good and have the time and drive to read formal books written on CS. And my experience is that most self-educaters don't have that time. On the other hand: some people I knew during my studies had no problem at all with introducing countless memory leaks in small programs (and turning off compiler warnings, because it gave so much noise...) Donald Knuth never studied computer science. Yes, yes, and Albert Einstein worked at an office. Those people are very rare. But my experience (see for plenty of examples: Slashdot) is that quite some people who don't have a degree think that all that formal education is just some paper pushing and doesn't count. While some of those who do have the paper think they know it all. Those people who are right in either group are a minority in my experience. As for electrical engineering: done that (BSc) and one of my class mates managed to connect a transformer the wrong way around twice. Yet he had the highest mark in our class. So in short: yes, self-study can make you good at something. But self-study IMO is not in general a replacement for a degree. Someone who can become great after self-study would excel at a formal study and learn more. Study works best if there is competition and if there are challenges. I still study a lot at home, but I do miss the challenges and competition. Hi all, I quite agree with the fact that self learning is not enough. Another thing you learn in studying in University is the fact that you can be wrong, which is quite difficult to accept for self taught people. When you work in groups, you are bound to admit that you don't have the best solution all the time. To my experience, self-taught people I worked with had tremendous difficulties to accept that they were wrong, that their design was badly done, that their code was badly written or strangely designed. Because self teaching was done with a lot of efforts, in particular to figure out complex problems on their own. Most of the time, the self learned people are attached to the things they learned by themselves and have difficulties to envisage that being right of wrong is often not an issue provided the group comes to the best option. They often live contradiction as a personal offense while it is just work, you know. That's another interest of the degree, confrontation with other people that have the same background. And letting the things learned at the place they should be and not in the affective area. 1001 -- Utilisant le logiciel de courrier révolutionnaire d'Opera : http://www.opera.com/mail/ -- http://mail.python.org/mailman/listinfo/python-list
Re: psycopg2 for insertion of binary data to PostgreSQL database
On Sunday 22 August 2010, it occurred to Julia Jacobson to exclaim: Thanks a lot, this was the solution. It would be greate, if you could also show me a way to extract the inserted binary object from the table on the server to a file on a client. Probably something along the lines of: * execute an appropriate SELECT query * get the record you're interested in * open a file for writing * f.write(data) * f.close() and other clean-up code Peter Otten wrote: Julia Jacobson wrote: Hello everybody out there using python, For the insertion of pictures into my PostgreSQL database [with table foo created by SQL command CREATE TABLE foo (bmp BYTEA)], I've written the following script: #!/usr/bin/python import psycopg2 try: conn = psycopg2.connect(dbname='postgres' user='postgres' host='localhost' password='data'); except: print I am unable to connect to the database cur = conn.cursor() f = open(test.bmp, 'rb') myfile = f.read() try: cur.execute(INSERT INTO foo VALUES (%s),(buffer(myfile),)) except: print Insert unsuccessful python script.py runs the script without any errors or messages. However, the SQL command SELECT * FROM foo returns the output foo (0 rows) with no entries in the table. I'm using Python 2.7 and PostgreSQL 8.3. Could anyone help me to find a way to pin down the problem? Perhaps you need to conn.commit() your changes. -- http://mail.python.org/mailman/listinfo/python-list
Re: Detect string has non-ASCII chars without checking each char?
On Aug 23, 1:10 am, Michel Claveau - MVPenleverlesx_xx...@xmclavxeaux.com.invalid wrote: Re ! Try your code with uabcd\xa1 ... it says it's ASCII. Ah? in my computer, it say False Perhaps your computer has a problem. Mine does this with both Python 2.7 and Python 2.3 (which introduced the unicodedata.normalize function): import unicodedata t1 = uabcd\xa1 t2 = unicodedata.normalize('NFD', t1) t3 = t2.encode('ascii', 'replace') [t1, t2, t3] [u'abcd\xa1', u'abcd\xa1', 'abcd?'] map(len, _) [5, 5, 5] -- http://mail.python.org/mailman/listinfo/python-list
Re: expression in an if statement
Thomas Jollans wrote: What if set has side effects? A compiler could only exclude this possibility if it knew exactly what set will be at run time, And also that 'a' remains bound to the same object, and that object or anything reachable from it is not mutated in any way that could affect the result of set(a). That's quite a lot of information for an optimiser to deduce, particularly in a language as dynamic as Python. -- Greg -- http://mail.python.org/mailman/listinfo/python-list
What is a class method?
I understand the concept of a static method. However I don't know what is a class method. Would anybody pls. explain me? class C: @classmethod def ... ... Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: What is a class method?
On Mon, Aug 23, 2010 at 12:49 PM, Paulo da Silva psdasilva.nos...@netcabonospam.pt wrote: I understand the concept of a static method. However I don't know what is a class method. Would anybody pls. explain me? Please read this first: http://docs.python.org/library/functions.html#classmethod Then ask us questions :) cheers James -- -- James Mills -- -- Problems are solved by method -- http://mail.python.org/mailman/listinfo/python-list
Re: What is a class method?
Em 23-08-2010 04:30, James Mills escreveu: On Mon, Aug 23, 2010 at 12:49 PM, Paulo da Silva psdasilva.nos...@netcabonospam.pt wrote: I understand the concept of a static method. However I don't know what is a class method. Would anybody pls. explain me? Please read this first: http://docs.python.org/library/functions.html#classmethod Then ask us questions :) I did it before posting ... The explanation is not very clear. It is more like how to use it. Thanks anyway. -- http://mail.python.org/mailman/listinfo/python-list
Re: What is a class method?
On Mon, Aug 23, 2010 at 1:53 PM, Paulo da Silva psdasilva.nos...@netcabonospam.pt wrote: I did it before posting ... The explanation is not very clear. It is more like how to use it. Without going into the semantics of languages basically the differences are quite clear: @classmethod is a decorator that warps a function with passes the class as it's first argument. @staticmethod (much like C++/Java) is also a decorator that wraps a function but does not pass a class or instance as it's first argument. I won't go into the use-cases as I don't use static or class methods myself personally in any of my work (yet). cheers James -- -- James Mills -- -- Problems are solved by method -- http://mail.python.org/mailman/listinfo/python-list
Re: What is a class method?
On Sun, Aug 22, 2010 at 9:53 PM, Paulo da Silva psdasilva.nos...@netcabonospam.pt wrote: Em 23-08-2010 04:30, James Mills escreveu: On Mon, Aug 23, 2010 at 12:49 PM, Paulo da Silva psdasilva.nos...@netcabonospam.pt wrote: I understand the concept of a static method. However I don't know what is a class method. Would anybody pls. explain me? Please read this first: http://docs.python.org/library/functions.html#classmethod Then ask us questions :) I did it before posting ... The explanation is not very clear. It is more like how to use it. Consider this: class A(object): @staticmethod def new(): return A() class B(A): pass versus this: class C(object): @classmethod def new(cls): return cls() class D(C): pass B.new() will return a new instance of A, not B. D.new() will return a new instance of D. Does this answer your question? -- http://mail.python.org/mailman/listinfo/python-list
Re: What is a class method?
On 8/22/2010 11:53 PM, Paulo da Silva wrote: Please read this first: http://docs.python.org/library/functions.html#classmethod Then ask us questions :) I did it before posting ... When you ask a question, it help people answer if they know what you have already tried and failed with ;-) The explanation is not very clear. It is more like how to use it. A function accessed as a class attribute is normal treated as an instance function/method -- with an instance of the class as the first argument. A class method takes the class as the first argument. A 'staticmethod' is a function that takes neither as the first argument and, with one esoteric exception, does not need to be a class attribute but is for convenience. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
[issue8750] Many of MutableSet's methods assume that the other parameter is not self
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: The patch looks good. Feel free to apply. -- assignee: rhettinger - stutzbach ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8750 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9157] Allow inspection of used decorators on a function
Nick Coghlan ncogh...@gmail.com added the comment: That's a lot of boilerplate for minimal gain. The Django commenter was right - proposals that start with everybody in the world needs to do X differently from the way they do it now for this to be useful aren't ever likely to gain much traction. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9157 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9214] Most Set methods of KeysView and ItemsView do not work right
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Fixed in r84252, r84252, and r84254. -- priority: high - normal resolution: accepted - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9214 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9131] test_set_reprs in test_pprint is fragile
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- assignee: rhettinger - stutzbach ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9131 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9396] Standardise (and publish?) cache handling in standard library
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9396 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7871] Duplicate test method in test_heapq
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Fixed in r84255. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7871 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8743] set() operators don't work with collections.Set instances
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- priority: normal - high ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8743 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9251] Test for the import lock
Nick Coghlan ncogh...@gmail.com added the comment: With the new setUp and tearDown methods, the threadedimp2 patch doesn't apply cleanly any more. Looks good and passes for me - fixed patch attached. Was I meant to still be looking at mtimport or threadimp, or have both of those been applied? -- Added file: http://bugs.python.org/file18605/issue9251_threadimp_py3k_head.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9251 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8403] dis.dis gives different results if Ctrl-C is pressed
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Fixed in r84256. Don't think this needs to be backported. -- resolution: - fixed status: open - closed versions: +Python 3.2 -Python 2.6, Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8403 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1284670] Allow to restrict ModuleFinder to get direct dependencies
Nick Coghlan ncogh...@gmail.com added the comment: The generalist in me is inclined to suggest a depth parameter (with depth=1 equivalent to direct dependencies only, and depth = None meaning all dependencies), but I must admit I don't have a concrete use case for the extra generality. So the simpler, recurse/don't recurse approach is probably a better option (building a depth-limited search on top of the recursion flag wouldn't be difficult anyway). Aside from missing docs and unit test updates, the idea seems sound. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1284670 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1284670] Allow to restrict ModuleFinder to get direct dependencies
Nick Coghlan ncogh...@gmail.com added the comment: Although I do find it a little concerning that there is no mention of sys.path_hooks or sys.meta_path in the modulefinder source code. I suspect this module only works correctly with vanilla filesystem based imports and can't handle anything imported via PEP 302. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1284670 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9396] Standardise (and publish?) cache handling in standard library
Éric Araujo mer...@netwok.org added the comment: Raymond, out of curiosity, can you tell why you removed lfu_cache? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9396 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1346874] httplib simply ignores CONTINUE
Changes by Éric Araujo mer...@netwok.org: -- assignee: - orsenthil nosy: +orsenthil ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1346874 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1462440] socket and threading: udp multicast setsockopt fails
Mark Lawrence breamore...@yahoo.co.uk added the comment: I can't reproduce this on Windows Vista can someone please confirm my findings. -- nosy: +BreamoreBoy versions: +Python 2.7, Python 3.1, Python 3.2 -Python 2.6, Python 3.0 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1462440 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1465646] test_grp test_pwd fail
Mark Lawrence breamore...@yahoo.co.uk added the comment: Can this be closed? -- nosy: +BreamoreBoy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1465646 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1466065] base64 module ignores non-alphabet characters
Mark Lawrence breamore...@yahoo.co.uk added the comment: Attached patches against 2.7 and 3.2 contain doc and unit test changes so can someone please review and commit if acceptable. -- nosy: +BreamoreBoy stage: unit test needed - patch review versions: +Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1466065 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1467619] Header.decode_header eats up spaces
Mark Lawrence breamore...@yahoo.co.uk added the comment: Would someone like to comment on Georg's patch. -- nosy: +BreamoreBoy stage: unit test needed - patch review versions: +Python 3.2 -Python 2.6, Python 3.0 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1467619 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1467929] %-formatting and dicts
Changes by Mark Lawrence breamore...@yahoo.co.uk: -- stage: - needs patch versions: +Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1467929 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9657] Add circular imports test
Nick Coghlan ncogh...@gmail.com added the comment: It would be good if the test timed out rather than deadlocking in the face of a broken import lock. I suggest: 1. Make the two test threads daemon threads 2. Specify a timeout to the join() calls 3. Use self.assertFalse(t1.is_alive()) and self.assertFalse(t2.is_alive()) to check the calls actually finished For your #9260 testing, this looks like it may be a little probabilistic. I think you can make the deadlock a near certainty by defining your test modules and threads as follows: # Create a circular import structure: A - C - B - D - A circular_imports_modules = { 'A': if 1: import ev ev.evA.wait() import time time.sleep(%(delay)s) x = 'a' import C , 'B': if 1: import ev ev.evB.wait() import time time.sleep(%(delay)s) x = 'b' import D , 'C': import B, 'D': import A, 'ev': if 1: import threading; evA = threading.Event() evB = threading.Event() , } def import_ab(): import ev ev.evB.set() import A results.append(getattr(A, 'x', None)) def import_ba(): import ev ev.evA.set() import B results.append(getattr(B, 'x', None)) (I've done a trick along these lines before, and the above doesn't look quite right. Maybe the details will come back to me if I sit on it for a while) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9657 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1469629] __dict__ = self in subclass of dict causes a memory leak?
Mark Lawrence breamore...@yahoo.co.uk added the comment: I've reproduced this problem with 2.7, 3.1 and 3.2. -- nosy: +BreamoreBoy stage: unit test needed - patch review type: behavior - resource usage versions: +Python 2.7, Python 3.1, Python 3.2 -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1469629 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1470548] Bugfix for #1470540 (XMLGenerator cannot output UTF-16)
Mark Lawrence breamore...@yahoo.co.uk added the comment: The are no unit test or doc changes with the patch. Can anyone answer Georg's question on msg66684? -- nosy: +BreamoreBoy versions: +Python 2.7, Python 3.1, Python 3.2 -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1470548 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1471934] Python libcrypt build problem on Solaris 8, 9, 10 and OpenSolaris
Changes by Mark Lawrence breamore...@yahoo.co.uk: -- stage: unit test needed - patch review versions: +Python 3.1, Python 3.2 -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1471934 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1475692] replacing obj.__dict__ with a subclass of dict
Changes by Mark Lawrence breamore...@yahoo.co.uk: -- versions: -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1475692 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1479255] Fix building with SWIG's -c++ option set in setup.py
Mark Lawrence breamore...@yahoo.co.uk added the comment: Is this still a problem? -- assignee: - tarek nosy: +BreamoreBoy, tarek stage: - needs patch type: - behavior versions: +Python 2.7, Python 3.1, Python 3.2 -Python 2.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1479255 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9657] Add circular imports test
Antoine Pitrou pit...@free.fr added the comment: It would be good if the test timed out rather than deadlocking in the face of a broken import lock. I could do that indeed. I'm not sure it would be much better, though, because the lock will still be held and posterior tests may freeze mysteriously. For your #9260 testing, this looks like it may be a little probabilistic It always freezes here (with the per-module lock). I guess on modern machines, 0.5s is more than enough to launch a thread and parse a nearly empty Python module. I should add a comment explaining a purpose of the test, though. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9657 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1481032] patch smtplib:when SMTPDataError, rset crashes with sslerror
Mark Lawrence breamore...@yahoo.co.uk added the comment: The change to the encode_plain method in the patch was done via #1075928 on 2004-12-06. The try/except change around a call to self.rset() was never implemented. -- nosy: +BreamoreBoy versions: +Python 2.7, Python 3.1, Python 3.2 -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1481032 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1481347] parse_makefile doesn't handle $$ correctly
Changes by Mark Lawrence breamore...@yahoo.co.uk: -- assignee: - tarek ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1481347 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1483545] Wave.py support for ulaw and alaw audio
Changes by Mark Lawrence breamore...@yahoo.co.uk: -- stage: - unit test needed versions: +Python 3.2 -Python 2.7, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1483545 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9251] Test for the import lock
Antoine Pitrou pit...@free.fr added the comment: Was I meant to still be looking at mtimport or threadimp, or have both of those been applied? threadimp has already been committed. As for mtimport, I'll try to refactor it into a proper unit test. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9251 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1486713] HTMLParser : A auto-tolerant parsing mode
Mark Lawrence breamore...@yahoo.co.uk added the comment: I think this should be closed as have other similar requests in the last few days. -- nosy: +BreamoreBoy, fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1486713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1487481] Could BIND_FIRST be removed on HP-UX?
Mark Lawrence breamore...@yahoo.co.uk added the comment: Is this still valid? -- nosy: +BreamoreBoy versions: +Python 2.7, Python 3.1, Python 3.2 -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1487481 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1489246] 2.4.3 fails to find Tcl/Tk on Solaris 10 x86_64
Mark Lawrence breamore...@yahoo.co.uk added the comment: Closed in reply to msg83914. -- nosy: +BreamoreBoy resolution: - works for me status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1489246 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9251] Test for the import lock
Antoine Pitrou pit...@free.fr added the comment: The new patch was committed in r84258, thanks Nick. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9251 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9251] Test for the import lock
Changes by Antoine Pitrou pit...@free.fr: Removed file: http://bugs.python.org/file17995/threadimp.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9251 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9251] Test for the import lock
Changes by Antoine Pitrou pit...@free.fr: Removed file: http://bugs.python.org/file18003/threadimp2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9251 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9251] Test for the import lock
Changes by Antoine Pitrou pit...@free.fr: Removed file: http://bugs.python.org/file18605/issue9251_threadimp_py3k_head.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9251 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1490929] urllib.retrieve's reporthook called with non-helpful value
Changes by Mark Lawrence breamore...@yahoo.co.uk: -- versions: +Python 3.2 -Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1490929 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1492240] Socket-object convenience function: getpeercred().
Mark Lawrence breamore...@yahoo.co.uk added the comment: No reply to msg111039, also see comments on msg50314. -- resolution: - rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1492240 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1492704] distinct error type from shutil.move()
Mark Lawrence breamore...@yahoo.co.uk added the comment: @Zooko are you interested in taking this forward? -- nosy: +BreamoreBoy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1492704 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1495488] make altinstall installs pydoc
Mark Lawrence breamore...@yahoo.co.uk added the comment: Fixed on #1590. -- nosy: +BreamoreBoy resolution: - duplicate status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1495488 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1495802] cygwin: popen3 lock up
Mark Lawrence breamore...@yahoo.co.uk added the comment: Any Cygwin/Windows people interested in this, or can it be closed? -- nosy: +BreamoreBoy versions: +Python 2.7, Python 3.1, Python 3.2 -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1495802 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1502517] crash in expat when compiling with --enable-profiling
Mark Lawrence breamore...@yahoo.co.uk added the comment: Closed in reply to msg92323. -- nosy: +BreamoreBoy resolution: - out of date status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1502517 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1504333] sgmllib should allow angle brackets in quoted values
Mark Lawrence breamore...@yahoo.co.uk added the comment: sgmllib has been deprecated since 2.6 and has been removed from py3k. -- nosy: +BreamoreBoy resolution: - out of date status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1504333 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue849097] Request: getpos() for sgmllib
Mark Lawrence breamore...@yahoo.co.uk added the comment: sgmllib has been deprecated since 2.6 and has been removed from py3k. -- resolution: - out of date status: open - closed versions: +Python 3.2 -Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue849097 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1459279] sgmllib.SGMLparser and hexadecimal numeric character refs
Mark Lawrence breamore...@yahoo.co.uk added the comment: sgmllib has been deprecated since 2.6 and has been removed from py3k. -- resolution: - out of date status: open - closed versions: +Python 3.2 -Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1459279 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com