Nagare web framework 0.4.0
Hi all, Version 0.4.0 of the Nagare web framework is now released! About Nagare Nagare is a components based framework: a Nagare application is a composition of interacting components each one with its own state and workflow kept on the server. Each component can have one or several views that are composed to generate the final web page. This enables the developers to reuse or write highly reusable components easily and quickly. Thanks to Stackless Python, Nagare is also a continuation aware web framework which enables to code a web application like a desktop application, with no need to split its control flow in a multitude of controllers and with the automatic handling of the back, fork and refresh actions from the browser. Its component model and use of the continuation come from the famous Seaside Smalltalk framework. Furthermore Nagare integrates the best tools and standard from the Python world. For example: - WSGI: binds the application to several possible publishers, - lxml: generates the DOM trees and brings to Nagare the full set of XML features (XSL, XPath, Schemas ...), - setuptools: installs, deploys and extends the Nagare framework and the Nagare applications too, - PEAK Rules: generic methods are heavily used in Nagare, to associate views to components, to define security rules, to translate Python code to Javascript ... - WebOb: for its Request and Response Objects. To read more about its features: http://www.nagare.org/trac/wiki/NagareFeatures Release info and download page: http://pypi.python.org/pypi/nagare Release info and download page of the examples: http://pypi.python.org/pypi/nagare.examples Release info and download page of the pure web IDE: http://www.nagare.org/trac/wiki/NagareIde http://pypi.python.org/pypi/nagare.ide Source and documentation available at the website: http://www.nagare.org Mailing lists - the place to ask questions: http://groups.google.com/group/nagare-users Examples A complete guess a number game to taste how easy web coding becomes using continuations: import random from nagare import component, util class Number(component.Task): A little game to guess a number def go(self, comp): The game algorithm, using continuation for a pure linear Python code In: - ``comp`` -- this component self.attempt = 1 number = random.randint(1, 20) comp.call(util.Confirm('I choose a number between 1 and 20. Try to guess it')) while True: x = comp.call(util.Ask('Try #%d: ' % self.attempt)) if not x.isdigit(): continue x = int(x) if x number: comp.call(util.Confirm('Choose a lower number')) if x number: comp.call(util.Confirm('Choose a greater number')) if x == number: comp.call(util.Confirm('You guessed the number in %d attempts' % self.attempt)) break self.attempt += 1 A simple todo list, illustrating the programmatic HTML generation, the association of view(s) to Python objects and the direct association of callbacks to HTML form elements and links: from nagare import presentation from nagare.namespaces import xhtml # A plain Python ``TodoList`` class class TodoList(object): def __init__(self): self.todo = [] def add_todo(self, msg): self.todo.append(msg) # The default HTML view, generated in programmatic HTML @presentation.render_for(TodoList) def render(self, h, comp, model): # ``h`` is a (X)HTML renderer (http://www.nagare.org/trac/wiki/RendererObjects) with h.div: for msg in self.todo: h h.blockquote(msg) h.hr with h.form: h 'New todo:' h.br h h.textarea.action(self.add_todo) h.br h h.input(type='submit', value='Add') return h.root Enjoy! A. Poirier -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
MailingLogger 3.7.0 Released!
I'm pleased to announce a new release of Mailinglogger. Mailinglogger provides two handlers for the standard python logging framework that enable log entries to be emailed either as the entries are logged or as a summary at the end of the running process. The handlers have the following features: - customisable and dynamic subject lines for emails sent - emails sent with a configurable headers for easy filtering - flood protection to ensure the number of emails sent is not excessive - support for SMTP servers that require authentication - fully documented and tested This release fixes a long standing bug that occurred when logging unicode messages. It also provides support for sending colourised HTML emails: http://packages.python.org/mailinglogger/html.html Full docs can be found here: http://packages.python.org/mailinglogger/ For more information, please see: http://www.simplistix.co.uk/software/python/mailinglogger or http://pypi.python.org/pypi/mailinglogger cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Re: sys.argv as a list of bytes
Olive wrote: In Unix the operating system pass argument as a list of C strings. But C strings does corresponds to the bytes notions of Python3. Is it possible to have sys.argv as a list of bytes ? What happens if I pass to a program an argumpent containing funny character, for example (with a bash shell)? python -i ./test.py $'\x01'$'\x05'$'\xFF' Python has a special errorhandler, surrogateescape to deal with bytes that are not valid UTF-8. If you try to print such a string you get an error: $ python3 -c'import sys; print(repr(sys.argv[1]))' $'\x01'$'\x05'$'\xFF' '\x01\x05\udcff' $ python3 -c'import sys; print(sys.argv[1])' $'\x01'$'\x05'$'\xFF' Traceback (most recent call last): File string, line 1, in module UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 2: surrogates not allowed It is still possible to get the original bytes: $ python3 -c'import sys; print(sys.argv[1].encode(utf-8, surrogateescape))' $'\x01'$'\x05'$'\xFF' b'\x01\x05\xff' -- http://mail.python.org/mailman/listinfo/python-list
MailingLogger 3.7.0 Released!
I'm pleased to announce a new release of Mailinglogger. Mailinglogger provides two handlers for the standard python logging framework that enable log entries to be emailed either as the entries are logged or as a summary at the end of the running process. The handlers have the following features: - customisable and dynamic subject lines for emails sent - emails sent with a configurable headers for easy filtering - flood protection to ensure the number of emails sent is not excessive - support for SMTP servers that require authentication - fully documented and tested This release fixes a long standing bug that occurred when logging unicode messages. It also provides support for sending colourised HTML emails: http://packages.python.org/mailinglogger/html.html Full docs can be found here: http://packages.python.org/mailinglogger/ For more information, please see: http://www.simplistix.co.uk/software/python/mailinglogger or http://pypi.python.org/pypi/mailinglogger cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk -- http://mail.python.org/mailman/listinfo/python-list
subprocess.Popen strange bhaviour
Hi, I am using subprocess.Popen to start a movie ripping command HandBrakeCLI. My server is 64bit ubuntu server and has 8 cores. When the command starts it uses all 8 cores upto 80%-100% and works fine, but after 270 seconds the cpu usage of all the cores drops to 0% - 1%. I tried this many time this happens exactly after 270 seconds. Is there some predefined timeout?? -- Mac -- http://mail.python.org/mailman/listinfo/python-list
Re: subprocess.Popen strange bhaviour
On Wed, 18 Jan 2012 14:44:37 +0530, Mac Smith wrote: Hi, I am using subprocess.Popen to start a movie ripping command HandBrakeCLI. My server is 64bit ubuntu server and has 8 cores. When the command starts it uses all 8 cores upto 80%-100% and works fine, but after 270 seconds the cpu usage of all the cores drops to 0% - 1%. I tried this many time this happens exactly after 270 seconds. Is there some predefined timeout?? I think you have misunderstood subprocess.Popen. It launches the new process (HandBrakeCLI) then what happens in that new process is independent of Python and Popen. How are you calling HandBrakeCLI? Is it ripping directly from a device or file, or is it reading from stdin? If reading from stdin, possibly it is waiting for more data from you. Or perhaps it has simply finished ripping and there's nothing else for it to do and the process ends. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: sys.argv as a list of bytes
On Wed, 18 Jan 2012 09:05:42 +0100 Peter Otten __pete...@web.de wrote: Olive wrote: In Unix the operating system pass argument as a list of C strings. But C strings does corresponds to the bytes notions of Python3. Is it possible to have sys.argv as a list of bytes ? What happens if I pass to a program an argumpent containing funny character, for example (with a bash shell)? python -i ./test.py $'\x01'$'\x05'$'\xFF' Python has a special errorhandler, surrogateescape to deal with bytes that are not valid UTF-8. If you try to print such a string you get an error: $ python3 -c'import sys; print(repr(sys.argv[1]))' $'\x01'$'\x05'$'\xFF' '\x01\x05\udcff' $ python3 -c'import sys; print(sys.argv[1])' $'\x01'$'\x05'$'\xFF' Traceback (most recent call last): File string, line 1, in module UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 2: surrogates not allowed It is still possible to get the original bytes: $ python3 -c'import sys; print(sys.argv[1].encode(utf-8, surrogateescape))' $'\x01'$'\x05'$'\xFF' b'\x01\x05\xff' But is it safe even if the locale is not UTF-8? I would like to be able to pass a file name to a script. I can use bytes for file names in the open function. If I keep the filename as bytes everywhere it will work reliably whatever the locale or strange character the file name may contain. Olive -- http://mail.python.org/mailman/listinfo/python-list
Re: replacing __dict__ with an OrderedDict
Am 06.01.2012 12:44, schrieb Peter Otten: [running unit tests in the order of their definition] class Loader(unittest.TestLoader): def getTestCaseNames(self, testCaseClass): Return a sequence of method names found within testCaseClass sorted by co_firstlineno. def first_lineno(name): method = getattr(testCaseClass, name) return method.im_func.__code__.co_firstlineno function_names = super(Loader, self).getTestCaseNames(testCaseClass) function_names.sort(key=first_lineno) return function_names After using this a bit, it works great. I have up to now only found a single problem, and that is that with decorated functions it doesn't even get at the actual line number of the real code, so sorting by that number doesn't work. An example for this is @unittest.expectedFailure(...). I can easily ignore this though, just wanted to give this feedback Thanks again! Uli -- http://mail.python.org/mailman/listinfo/python-list
Re: sys.argv as a list of bytes
Olive wrote: On Wed, 18 Jan 2012 09:05:42 +0100 Peter Otten __pete...@web.de wrote: Olive wrote: In Unix the operating system pass argument as a list of C strings. But C strings does corresponds to the bytes notions of Python3. Is it possible to have sys.argv as a list of bytes ? What happens if I pass to a program an argumpent containing funny character, for example (with a bash shell)? python -i ./test.py $'\x01'$'\x05'$'\xFF' Python has a special errorhandler, surrogateescape to deal with bytes that are not valid UTF-8. If you try to print such a string you get an error: $ python3 -c'import sys; print(repr(sys.argv[1]))' $'\x01'$'\x05'$'\xFF' '\x01\x05\udcff' $ python3 -c'import sys; print(sys.argv[1])' $'\x01'$'\x05'$'\xFF' Traceback (most recent call last): File string, line 1, in module UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 2: surrogates not allowed It is still possible to get the original bytes: $ python3 -c'import sys; print(sys.argv[1].encode(utf-8, surrogateescape))' $'\x01'$'\x05'$'\xFF' b'\x01\x05\xff' But is it safe even if the locale is not UTF-8? I would like to be able to pass a file name to a script. I can use bytes for file names in the open function. If I keep the filename as bytes everywhere it will work reliably whatever the locale or strange character the file name may contain. I believe you need not convert back to bytes explicitly, you can open the file with open(sys.argv[i]). I don't know if there are cornercases where that won't work; maybe http://www.python.org/dev/peps/pep-0383/ can help you figure it out. -- http://mail.python.org/mailman/listinfo/python-list
unzip function?
python has builtin zip, but not unzip A bit of googling found my answer for my decorate/sort/undecorate problem: a, b = zip (*sorted ((c,d) for c,d in zip (x,y))) That zip (*sorted... does the unzipping. But it's less than intuitively obvious. I'm thinking unzip should be a builtin function, to match zip. -- http://mail.python.org/mailman/listinfo/python-list
Plot square wave
Hi all, I am trying to generate a pseudo pwm signal, low-high transition will take place when screen goes from black to white and high-low transition when white to black. As a result I am trying to plot the signal. Here is my code; import time, pylab, numpy, scipy, pygame def _func1(): global end global white global k global t global i k = numpy.arange(4) t = numpy.arange(4) i = 0 f = open(test.txt, w) white = True start = time.time() end = time.time() - start screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN) timer = pygame.time.Clock() test = repr(time.time()) while(end8.00): end = time.time() - start if white: screen.fill((255, 255, 255)) time.sleep(1) k[i] = 0 t[i] = end f.write(str(t[i]) + \t + str(k[i]) + \n) i = i + 1 print repr(end) else: screen.fill((0, 0, 0)) time.sleep(1) k[i] = 1 t[i] = end f.write(str(t[i]) + \t + str(k[i]) + \n) i = i+ 1 print repr(end) white = not white pygame.display.update() pygame.quit() if __name__ == __main__: _func1() time,data = numpy.loadtxt('test.txt', unpack=True) print k print t print i pylab.plot(time,data) pylab.show() Problem is I get a sawtooth instead of a square wave. I know that I need to define points between 0,1,2 time integer values to achieve this. But I hope there is a python trick that will yield this time,data plot to a square wave? -- http://mail.python.org/mailman/listinfo/python-list
Re: unzip function?
http://docs.python.org/library/zipfile.html ZipFile.extractall([path[, members[, pwd]]]) -- http://mail.python.org/mailman/listinfo/python-list
Re: unzip function?
http://docs.python.org/library/functions.html x = [1, 2, 3] y = [4, 5, 6] zipped = zip(x, y) zipped [(1, 4), (2, 5), (3, 6)] x2, y2 = zip(*zipped) x == list(x2) and y == list(y2) True -- http://mail.python.org/mailman/listinfo/python-list
Re: unzip function?
On Wed, Jan 18, 2012 at 10:27 AM, Alec Taylor alec.tayl...@gmail.comwrote: http://docs.python.org/library/functions.html x = [1, 2, 3] y = [4, 5, 6] zipped = zip(x, y) zipped [(1, 4), (2, 5), (3, 6)] x2, y2 = zip(*zipped) x == list(x2) and y == list(y2) True Alec can you explain this behavior zip(*zipped)? -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: unzip function?
On Wed, 18 Jan 2012 09:33:34 -0500, Neal Becker wrote: python has builtin zip, but not unzip That's because zip is (almost) its own inverse. A bit of googling found my answer for my decorate/sort/undecorate problem: a, b = zip (*sorted ((c,d) for c,d in zip (x,y))) That does a lot of unnecessary work. a, b = zip(*sorted(zip(x,y))) That zip (*sorted... does the unzipping. But it's less than intuitively obvious. *shrug* If you understand what zip does, it should be obvious. I'm thinking unzip should be a builtin function, to match zip. Just create your own utility function. Not everything needs to be a built-in. def unzip(iterable): return zip(*iterable) Hardly seems worthwhile. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: unzip function?
On Wed, Jan 18, 2012 at 10:31 AM, Rodrick Brown rodrick.br...@gmail.com wrote: On Wed, Jan 18, 2012 at 10:27 AM, Alec Taylor alec.tayl...@gmail.com wrote: http://docs.python.org/library/functions.html x = [1, 2, 3] y = [4, 5, 6] zipped = zip(x, y) zipped [(1, 4), (2, 5), (3, 6)] x2, y2 = zip(*zipped) x == list(x2) and y == list(y2) True Alec can you explain this behavior zip(*zipped)? Zip is its own inverse. zip([1,2,3],[4,5,6]) [(1, 4), (2, 5), (3, 6)] zip((1,4),(2,5),(3,6)) [(1, 2, 3), (4, 5, 6)] If you're not sure of the *zipped part, it just means treat each element of zipped as a different argument to zip. So zip(*zipped) is calling zip(zipped[0], zipped[1]... zipped[-1]) -- http://mail.python.org/mailman/listinfo/python-list
Re: unzip function?
On Wed, Jan 18, 2012 at 7:31 AM, Rodrick Brown rodrick.br...@gmail.com wrote: On Wed, Jan 18, 2012 at 10:27 AM, Alec Taylor alec.tayl...@gmail.com wrote: http://docs.python.org/library/functions.html x = [1, 2, 3] y = [4, 5, 6] zipped = zip(x, y) zipped [(1, 4), (2, 5), (3, 6)] x2, y2 = zip(*zipped) x == list(x2) and y == list(y2) True Alec can you explain this behavior zip(*zipped)? It's just the application of the http://docs.python.org/tutorial/controlflow.html#unpacking-argument-lists feature to a zip() [http://docs.python.org/library/functions.html#zip ] call. zip(*zipped) === zip(*[(1, 4), (2, 5), (3, 6)]) === zip((1, 4), (2, 5), (3, 6)) === [(1, 2, 3), (4, 5, 6)] Cheers, Chris -- http://rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: subprocess.Popen strange bhaviour
On Wed, Jan 18, 2012 at 1:14 AM, Mac Smith macsmith...@gmail.com wrote: Hi, I am using subprocess.Popen to start a movie ripping command HandBrakeCLI. My server is 64bit ubuntu server and has 8 cores. When the command starts it uses all 8 cores upto 80%-100% and works fine, but after 270 seconds the cpu usage of all the cores drops to 0% - 1%. I tried this many time this happens exactly after 270 seconds. Is there some predefined timeout?? Please post the part of your code that uses subprocess.Popen(). Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list
Re: Plot square wave
Yigit Turgut wrote: Problem is I get a sawtooth instead of a square wave. I know that I need to define points between 0,1,2 time integer values to achieve this. But I hope there is a python trick that will yield this time,data plot to a square wave? There is no Python trick, pylab is showing the data you provide. To get a square wave you need two y values per x value, for example import pylab time = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4] data = [0, 1, 1, 0, 0, 1, 1, 0, 0, 1] pylab.plot(time, data) pylab.ylim(-.1, 1.1) # so you see the horizontal lines of the graph pylab.xlim(-.1, 4.1) pylab.show() A general advice: try the individual aspects of your script (plotting, pygame flicker, data i/o) separately to make sure you understand them well enough before putting them together in the final version of your code. -- http://mail.python.org/mailman/listinfo/python-list
Re: unzip function?
On Wed, Jan 18, 2012 at 10:31 AM, Rodrick Brown rodrick.br...@gmail.com wrote: Alec can you explain this behavior zip(*zipped)? Here's one way to think about it: If A is a matrix, zip(*A) returns the transpose of A. That is, the columns become rows, and the rows become columns. If you swap rows and columns, and then swap them back, you're left with the original. -- Devin -- http://mail.python.org/mailman/listinfo/python-list
Re: unzip function?
On Wed, Jan 18, 2012 at 10:27 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: That zip (*sorted... does the unzipping. But it's less than intuitively obvious. *shrug* If you understand what zip does, it should be obvious. Nobody likes to be told the thing they're confused about is trivial. It's especially bad if nobody ever actually explains what's so simple about it. Saying it's almost its own inverse is just restating the original question -- yes, that's what it is, but why? (I have put my own interpretation in a separate reply. ) -- Devin -- http://mail.python.org/mailman/listinfo/python-list
+= does not work correct all alogn
Hello Pythons, attached to this email is a pdf-file which shows, that += does not work well all along. Mybe somebody of you is able to explain my observations in this respect. I will be glad about an answer. Best regards Wilfried BugInPython.pdf Description: Adobe PDF document -- http://mail.python.org/mailman/listinfo/python-list
in the middle of web ,there is a problem,how to parse
here is my code: import urllib import lxml.html down= http://sc.hkex.com.hk/gb/www.hkex.com.hk/chi/market/sec_tradinfo/stockcode/eisdeqty_c.htm file=urllib.urlopen(down).read() root=lxml.html.document_fromstring(file) data1 = root.xpath('//tr[@class=tr_normal and .//img]') print the row which contains img : for u in data1: print u.text_content() data2 = root.xpath('//tr[@class=tr_normal and not(.//img)]') print the row which do not contain img : for u in data2: print u.text_content() the output is :(i omit many lines ) the row which contains img : 00329 the row which do not contain img : 1长江实业1,000#HOF many lines omitted 00327百富环球1,000#H 00328ALCO HOLDINGS2,000# i wondered why there are so many lines i can't get such as : (you can see in the web http://sc.hkex.com.hk/gb/www.hkex.com.hk/chi/market/sec_tradinfo/stockcode/eisdeqty_c.htm ) 00330思捷环球http://sc.hkex.com.hk/gb/www.hkex.com.hk/chi/invest/company/profile_page_c.asp?WidCoID=00330WidCoAbbName=Month=langcode=c 100#HOF00331春天百货http://sc.hkex.com.hk/gb/www.hkex.com.hk/chi/invest/company/profile_page_c.asp?WidCoID=00331WidCoAbbName=Month=langcode=c 2,000#H 00332NGAI LIK INDhttp://sc.hkex.com.hk/gb/www.hkex.com.hk/chi/invest/company/profile_page_c.asp?WidCoID=00332WidCoAbbName=Month=langcode=c 4,000# ...many lines ommitted i want to know how can i get these ?? -- http://mail.python.org/mailman/listinfo/python-list
Re: += does not work correct all alogn
On 18 January 2012 09:52, Wilfried Falk w_h_f...@yahoo.de wrote: Hello Pythons, attached to this email is a pdf-file which shows, that += does not work well all along. Mybe somebody of you is able to explain my observations in this respect. I will be glad about an answer. I think you are more likely to get answers if you post your code in the body of your message rather than attach it in a pdf, which is quite an unusual thing to do! 1.) For identifier += 1 you sometimes getprint(); identifier = identifier + 1 What means that there is a prior print(). I could not find out a rule for when this happens --- but it does. By replaceing identifier += 1 with identifier = identifier + 1the malfunction (print()) allways disappears I can't comment on this as you don't provide any code. 2.) Another mystery is shown by the code below. There _list += [something]is not the same as _list = _list + [something]. def conc1(a, _list = []): _list = _list + [a] return _list def conc2(a, _list = []): _list += [a] return _list # Main Program for i in range(4): _list = conc1(i) print(_list) print() for i in range(4): _list = conc2(i) print(_list) In the first case the result of print(_list) is: [0] [1] [2] [3] In the second case the result of print(_list) is: [0] [0, 1] [0, 1, 2] [0, 1, 2, 3] This behaviour is not a bug, it is a consequence of two things: 1. The way mutable default arguments work in Python. Your misunderstanding is a very common one for Python beginners. There's a good explanation of the behaviour here: http://effbot.org/zone/default-values.htm 2. The difference between lst += [a] and lst = lst + [a] The first one mutates the list object named 'lst' by appending 'a' at its end, whereas the second one creates a new list made of the items of lst with 'a' appended at the end. So your function conc1 does not mutate _list, whereas your function conc2 does. HTH -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list
Re: += does not work correct all alogn
def conc1(a, _list = []): _list = _list + [a] return _list for i in range(4): _list = conc1(i) ## - list not passed You don't pass the list to the conc1 function, so you start with the default, an empty list, each time. -- http://mail.python.org/mailman/listinfo/python-list
Installing Python on CentOS 6 - a big pain
It turns out that installing Python 2.7.2 on CentOS 6.0 is a lot of work. Here are the official CentOS install instructions: http://www.centos.org/modules/newbb/viewtopic.php?topic_id=34515forum=41 Not only do you have to build Python from source, you have to install a lot of stuff before you can even build it. Then you have to install various Python packages from multiple sources. Python doesn't work with yum; you have to do it the hard way. I know how to do all this, but it takes hours. I'm bringing up a bare dedicated server remotely, which is a routine operation. Python does not just work. I should be able to command yum install python27. (And not clobber the Python 2.6 that comes with CentOS.) This sort of thing is why Python is losing market share. John Nagle -- http://mail.python.org/mailman/listinfo/python-list
Re: unzip function?
Neal Becker ndbeck...@gmail.com writes: python has builtin zip, but not unzip A bit of googling found my answer for my decorate/sort/undecorate problem: a, b = zip (*sorted ((c,d) for c,d in zip (x,y))) That zip (*sorted... does the unzipping. But it's less than intuitively obvious. I'm thinking unzip should be a builtin function, to match zip. zip and unzip are one and the same since zip is inverse to itself: [(1, 2, 3), (4, 5, 6)] [(1, 2, 3), (4, 5, 6)] zip(*_) [(1, 4), (2, 5), (3, 6)] zip(*_) [(1, 2, 3), (4, 5, 6)] zip(*_) [(1, 4), (2, 5), (3, 6)] What you seem to call unzip is simply zip with a different signature, taking a single argument: def unzip(x): ... return zip(*x) ... [(1, 2, 3), (4, 5, 6)] [(1, 2, 3), (4, 5, 6)] unzip(_) [(1, 4), (2, 5), (3, 6)] unzip(_) [(1, 2, 3), (4, 5, 6)] unzip(_) [(1, 4), (2, 5), (3, 6)] -- http://mail.python.org/mailman/listinfo/python-list
Re: += does not work correct all alogn
On Wed, Jan 18, 2012 at 4:52 AM, Wilfried Falk w_h_f...@yahoo.de wrote: Hello Pythons, attached to this email is a pdf-file which shows, that += does not work well all along. Mybe somebody of you is able to explain my observations in this respect. I will be glad about an answer. Best regards Wilfried Please do not send attachments to the list. Besides the fact that it's annoying and there's no reason to do it, the list is also available as a Usenet group and I'm pretty sure the gateway doesn't keep attachments. Also, it makes it more difficult for us to respond to you. Common courtesy on this (and many other) groups is to quote the relevant text that we're responding to. It makes it easier for people to follow the conversation, especially when threads get bigger. Hello Pythons, my Python is a download of your Python3.2.2 Windows x86 MSI Installer. What I want to report is, that += does not work correct all along. 1.) For identifier += 1 you sometimes get print(); identifier = identifier + 1 What means that there is a prior print(). I could not find out a rule for when this happens --- but it does. By replaceing identifier += 1 with identifier = identifier + 1 the malfunction (print()) allways disappears. If this was an actual bug in Python, a lot of other people would have noticed it. Since you're the only one with the problem, it probably has something to do with your code and not with Python. Please post an example showing the problem. 2.) Another mystery is shown by the code below. There _list += [something] is not the same as _list = _list + [something]. def conc1(a, _list = []): _list = _list + [a] return _list def conc2(a, _list = []): _list += [a] return _list # Main Program for i in range(4): _list = conc1(i) print(_list) print() for i in range(4): _list = conc2(i) print(_list) In the first case the result of print(_list) is: [0] [1] [2] [3] In the second case the result of print(_list) is: [0] [0, 1] [0, 1, 2] [0, 1, 2, 3]. a += b and a = a + b are not the same thing. In Python, a += b is the same thing as a = a.__iadd_(b) while a = a + b is a = a.__add__(b). Like in many other languages, += on objects is an in place operation- it mutates the original object (except in cases of immutable objects like ints). On the other hand, a + b creates a new object with the value of a + b. So in the case of conc1, you're generating a new list each time and leaving the original list (stored in conc1.func_defaults[0] but you shouldn't touch that) alone. In conc2, you're modifying the list so the changed list is shared between calls of the function. -- http://mail.python.org/mailman/listinfo/python-list
Please don't use setuptools, the rotten .egg install system.
Please don't use setuptools, the so-called easy installation system in your packages. It just makes things more complicated, adds dependencies, and needs too many weird options if things aren't exactly where it wants them. Since setuptools is non-standard, it has to be installed before installing other things. In particular, if you're using somepython setup.py install don't require setuptools. Setuptools isn't doing anything for anybody at that point. egg files are usually more trouble than they're worth. John Nagle -- http://mail.python.org/mailman/listinfo/python-list
Re: Installing Python on CentOS 6 - a big pain
On Wed, Jan 18, 2012 at 1:00 PM, John Nagle na...@animats.com wrote: It turns out that installing Python 2.7.2 on CentOS 6.0 is a lot of work. Here are the official CentOS install instructions: http://www.centos.org/modules/newbb/viewtopic.php?topic_id=34515forum=41 Not only do you have to build Python from source, you have to install a lot of stuff before you can even build it. Then you have to install various Python packages from multiple sources. Python doesn't work with yum; you have to do it the hard way. I know how to do all this, but it takes hours. I'm bringing up a bare dedicated server remotely, which is a routine operation. Python does not just work. I should be able to command yum install python27. (And not clobber the Python 2.6 that comes with CentOS.) This sort of thing is why Python is losing market share. John Nagle -- What does this have to do with Python? It's CentOS (and Red Hat's) decision not to provide a package for Python 2.7. It's not feasible for the Python community to provide a repository for each of the 200+ Linux distributions. The instructions for building Python are exactly the same as to build any other large project and there is absolutely nothing that we can do about that- you can't compile a program without a compiler and you can't link to other programs without the development headers. You'll have the exact same problems if you want to install gcc 4.6.2 unless some 3rd party has decided to build the rpm for you. -- http://mail.python.org/mailman/listinfo/python-list
Re: scientific notation in legend (pylab)
thank you, I am trying to learn python, but I am having a hard to find a good introduction to it. On Jan 15, 3:27 am, Jason Friedman ja...@powerpull.net wrote: Not sure why legend annotations makes the problem different, but perhaps this is a start: -- http://mail.python.org/mailman/listinfo/python-list
Re: Installing Python on CentOS 6 - a big pain
John Nagle wrote: It turns out that installing Python 2.7.2 on CentOS 6.0 is a lot of work. Here are the official CentOS install instructions: http://www.centos.org/modules/newbb/viewtopic.php?topic_id=34515forum=41 Don't see any official about the post, it's just another forum member who posts what he did to install a later version of Python than the default 2.6 that comes with RedHat EL (and those comes with CentOS). Not only do you have to build Python from source, you have to install a lot of stuff before you can even build it. To build a car, you need a lot of parts, and you need to build the engine too. If you are building something yourself, you need header files and gcc, no matter if it's python or something else you want, you need those things and lucky you that you don't have something like ms-windows, then you don't have a package manager which will install most of the things you need, you would need to hunt down everything yourself (I know ms-win has already compiled versions, but we are talking about compiling yourself). Then you have to install various Python packages from multiple sources. Python doesn't work with yum; you have to do it the hard way. That's the life when you don't want to use what you are given for free, I'm sure someone would put up a repo for you if you paid them to compile python and all the modules for it. I know how to do all this, but it takes hours. I'm bringing up a bare dedicated server remotely, which is a routine operation. If you build your own RPMs, you can do that on your desktop machine, no need to do it on the underpowered VPS or really, you should have picked a distribution which gives you python 2.7 by default instead, just visit distrowatch.com and you can find at least one within two minutes. Python does not just work. I should be able to command yum install python27. (And not clobber the Python 2.6 that comes with CentOS.) This sort of thing is why Python is losing market share. It's not Python developers fault that some distributions choose to stay with older versions of Python instead of switching to 3.2 at once, or that ms-win don't have python at all. If you want CentOS to have a newer python by default, then contact RedHat, but before they listen to you, you may need to get some RedHat licenses. -- //Aho -- http://mail.python.org/mailman/listinfo/python-list
Re: Please don't use setuptools, the rotten .egg install system.
On Jan 18, 12:24 pm, John Nagle na...@animats.com wrote: Please don't use setuptools, the so-called easy installation system in your packages. It just makes things more complicated, adds dependencies, and needs too many weird options if things aren't exactly where it wants them. Since setuptools is non-standard, it has to be installed before installing other things. In particular, if you're using somepython setup.py install don't require setuptools. Setuptools isn't doing anything for anybody at that point. egg files are usually more trouble than they're worth. BIG PLUS ONE ON THIS! +1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Please don't use setuptools, the rotten .egg install system.
On Wed, Jan 18, 2012 at 1:24 PM, John Nagle na...@animats.com wrote: Please don't use setuptools, the so-called easy installation system in your packages. It just makes things more complicated, adds dependencies, and needs too many weird options if things aren't exactly where it wants them. Since setuptools is non-standard, it has to be installed before installing other things. Please don't use any projects that are built with setuptools or easy installation systems. Problem solved. -- Jerry -- http://mail.python.org/mailman/listinfo/python-list
from PyQt4 import QtWebKit ImportError: DLL load failed
Hi, Using WinXP I installed PyQt from http://www.riverbankcomputing.co.uk/software/pyqt/download installation file: PyQt-Py2.7-x86-gpl-4.9-1 then tried: Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32 Type copyright, credits or license() for more information. from PyQt4 import QtWebKit Traceback (most recent call last): File pyshell#0, line 1, in module from PyQt4 import QtWebKit ImportError: DLL load failed: The specified procedure could not be found. This is a common problem when I google it but I don't see a clear procedure for a fix. Any help appreciated. -- http://mail.python.org/mailman/listinfo/python-list
Re: python logging filter limitation, looks intentional?
On 17/01/2012 10:48, Vinay Sajip wrote: From: Chris Withersch...@simplistix.co.uk How breaking code? Configuration, maybe, but I can't see anyone being upset that filtering would begin working the same as everything else. This just feels like a bug... Well, it means that filters that don't get called now would get called - and that's a change in behaviour. How about an option that defaults to backwards compatibility mode for Python 2.7, flipped the other way in 3.3? It's not a bug, because it's like that by design. I understand that you don't agree with that particular design decision, but it's out there now. What you're asking for isn't unreasonable, but not achievable without a change in behaviour. See above ;-) I don't want people to have to code differently for Python 3.3 and for older versions. I must stress again, we're talking about a configuration change, not a code change, given the massive changes people are going to have to make between 2 and 3 anyway, I don't think that's unreasonable... True, but as I said earlier, you can attach a filter to your handlers. It's rather unlikely that you would have more than half-a-dozen handlers (since handlers ~= potential audiences for log events), Yeah, just feels a bit icky... Both use cases are valid, and a DelegatingHandler just feels like a hack to work around a deficiency in the framework... Rather, the approach I've taken is not to assume I'll meet everyone's needs out of the box, but that the right pieces are in place for people to use logging in useful ways in scenarios that I haven't thought of - which shortcomings might well be termed deficiencies according to your point of view - by deriving and overriding classes, or by composing using filters, or setting module-level flags. A module-level flag would be ideal :-) cheers, Chris -- Simplistix - Content Management, Batch Processing Python Consulting - http://www.simplistix.co.uk -- http://mail.python.org/mailman/listinfo/python-list
GOZERBOT 1.0 RELEASED
I am proud ! Version 1.0 of GOZERBOT is here in the world. 7 years of evolutionary code development. The eagle has landed, the egg is layed See http://gozerbot.org - WELCOME TO GOZERBOT — GOZERBOT v1.0.1 FINAL documentation WELCOME TO GOZERBOT¶. I am pleased to present to you version 1.0 of GOZERBOT, a IRC and Jabber(XMPP) bot. This is the final and last release of GOZERBOT, new development will continue with the JSONBOT... -- http://mail.python.org/mailman/listinfo/python-list
Re: unzip function?
On Wed, 18 Jan 2012 11:20:00 -0500, Devin Jeanpierre wrote: On Wed, Jan 18, 2012 at 10:27 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: That zip (*sorted... does the unzipping. But it's less than intuitively obvious. *shrug* If you understand what zip does, it should be obvious. Nobody likes to be told the thing they're confused about is trivial. Nobody likes to be told to brush their teeth, eat their vegetables or clean their room. Then they grow up and learn that life is full of things that you do because you have to, not because you want to. Learning that some things that they are confused about are trivial is one of those things. It's especially bad if nobody ever actually explains what's so simple about it. Saying it's almost its own inverse is just restating the original question -- yes, that's what it is, but why? (I have put my own interpretation in a separate reply. ) Because that's the nature of the Universe. That's just the way the zip operation works. It is a little more complicated, but no more mysterious, than the idea that you don't need separate reverse() and unreverse() methods. If you reverse a list, and then reverse it again, you get back the original order. The only complication is that you can't just pass the result of zip back to zip directly, you have to use the unpack operator * to split the result one sequence of N subsequences into N separate arguments. But apart from that complication, if you zip a bunch of sequences, then zip it again, you get back the original order. You describe that as taking the transpose of a matrix, which is correct, but that just puts a name to it, it doesn't explain *why* taking the transpose twice gives you the original matrix. If you have a function that zips up items from multiple sequences, it takes the first item from each sequence and puts them together, then does the same thing with the second item from each sequence, the third item, and so forth: zip([a1, a2, a3, ...], [b1, b2, b3, ...], [c1, c2, c3, ...], ...) = [(a1, b1, c1, ...), (a2, b2, c2, ...), (a3, b3, c3, ...), ...] If you take that resulting list-of-sequences, expand it to separate arguments, and pass them to zip again: zip((a1, b1, c1, ...), (a2, b2, c2, ...), (a3, b3, c3, ...), ...) the zip function will zip the items up exactly in the same way, giving: [(a1, a2, a3, ...), (b1, b2, b3, ...), (c1, c2, c3, ...), ...] which naturally reverses the process. (Except that it returns a list of tuples instead of a list of lists.) -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Installing Python on CentOS 6 - a big pain
On Wed, 18 Jan 2012 10:00:47 -0800, John Nagle wrote: This sort of thing is why Python is losing market share. Only on Planet Nagle. Do you have any evidence that Python actually *is* losing market share, or are you just trolling? -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Installing Python on CentOS 6 - a big pain
On Wed, 2012-01-18 at 10:00 -0800, John Nagle wrote: Python does not just work. I should be able to command yum install python27. (And not clobber the Python 2.6 that comes with CentOS.) This sort of thing is why Python is losing market share. Or — and this is the more likely scenario — it could be that this has nothing to do with the Python language per sé and you are just playing the whiny snot-nosed kid. -- http://mail.python.org/mailman/listinfo/python-list
Re: python logging filter limitation, looks intentional?
On 1/18/2012 4:02 PM, Chris Withers wrote: On 17/01/2012 10:48, Vinay Sajip wrote: How about an option that defaults to backwards compatibility mode for Python 2.7, flipped the other way in 3.3? 2.7 only gets bug fixes, and this does not seem to be one. It's not a bug, because it's like that by design. I understand that you don't agree with that particular design decision, but it's out there now. What you're asking for isn't unreasonable, but not achievable without a change in behaviour. See above ;-) I don't want people to have to code differently for Python 3.3 and for older versions. This is not a general policy, else we would never add new features ;-) Do you plan to keep logging feature-frozen forever, or just for another release? (I actually think is a good idea to fix bugs, tests, and docs first.) -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Installing Python on CentOS 6 - a big pain
On Jan 19, 4:00 am, John Nagle na...@animats.com wrote: It turns out that installing Python 2.7.2 on CentOS 6.0 is a lot of work. There must have been some radical changes between Centos 5 6, then, as building Python 2.7 from scratch took all of 10 minutes. Here are the official CentOS install instructions: The person who posted that has the forum designation Newbie. Those aren't the official anything. Not only do you have to build Python from source, you have to install a lot of stuff before you can even build it. Then you have to install various Python packages from multiple sources. Python doesn't work with yum; you have to do it the hard way. I know how to do all this, but it takes hours. So you're of course building an rpm as you go to prevent the need for you or anyone else having to do this again, right? You're not some selfish asshole who expects The Python Community to do everything for him, are you? Python does not just work. I should be able to command yum install python27. (And not clobber the Python 2.6 that comes with CentOS.) If only someone had just recently boasted about being able to do just this and had built an rpm to prove it... This sort of thing is why Python is losing market share. If Python is losing anything it's from the endless FUD spouted by yourself and others. -- http://mail.python.org/mailman/listinfo/python-list
Re: scientific notation in legend (pylab)
thank you, I am trying to learn python, but I am having a hard to find a good introduction to it. Try this: http://docs.python.org/py3k/tutorial/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Installing Python on CentOS 6 - a big pain
On Wed, 18 Jan 2012 19:10:43 -0800, alex23 wrote: On Jan 19, 4:00 am, John Nagle na...@animats.com wrote: It turns out that installing Python 2.7.2 on CentOS 6.0 is a lot of work. There must have been some radical changes between Centos 5 6, then, as building Python 2.7 from scratch took all of 10 minutes. Reading between the lines, I guess that John has set up his Centos boxes without development tools. I've known sys admins like that: in an effort to increase security they take away dev tools so that anybody breaking in can't install anything underhanded, at least in theory. With all the tools installed, it's a matter of a few minutes effort to build from scratch: download the tar ball extract the contents of the file cd into the source directory run ./configure run make optionally run make test run sudo make altinstall As a total n00b who'd never used make before, it took me 25 minutes effort on my first attempt, including reading the entire README file (twice!). Now I have the whole process down to about 30 seconds effort, and six minutes elapsed time, on my laptop. But obviously you can't build from source without a compiler. So under those circumstances, it would be very difficult to build from source, as you need to install make, gcc, and who knows what other tools, and fight with the cryptic error messages generated until eventually it all Just Works. I hate to imagine how much effort would be involved. And I can't fathom why John imagines that this is Python's fault. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: sys.argv as a list of bytes
On Wed, 18 Jan 2012 09:05:42 +0100, Peter Otten wrote: Python has a special errorhandler, surrogateescape to deal with bytes that are not valid UTF-8. On Wed, 18 Jan 2012 11:16:27 +0100, Olive wrote: But is it safe even if the locale is not UTF-8? Yes. Peter's reference to UTF-8 is misleading. The surrogateescape mechanism is used to represent anything which cannot be decoded according to the locale's encoding. E.g. in the C locale, any byte = 128 will be encoded as a surrogate. On Wed, 18 Jan 2012 09:05:42 +0100, Peter Otten wrote: It is still possible to get the original bytes: python3 -c'import sys; print(sys.argv[1].encode(utf-8, surrogateescape))' Except, it isn't. Because the Python dev's can't make up their mind which encoding sys.argv uses, or even document it. AFAICT: On Windows, there never was a bytes version of sys.argv to start with (the OS supplies the command line using wide strings). On Mac OS X, the command line is always decoded using UTF-8. On Unix, the command line is decoded using mbstowcs(). There isn't a Python function to query which encoding this used (if there even _is_ a corresponding Python encoding). Except on Windows (where OS APIs take wide string parameters), if a library function needs to pass a Unicode string to an API function, it will normally decode it using sys.getfilesystemencoding(), which isn't guaranteed to be the encoding which was used to fabricate sys.argv in the first place. In short: if you need to write system scripts on Unix, and you need them to work reliably, you need to stick with Python 2.x. -- http://mail.python.org/mailman/listinfo/python-list
Python Descriptor as Instance Attribute
Hi all, Currently descriptors only work as class attribute, and doesn't work as a descriptor when it is an instance attribute. e.g. if we have descriptor class DescriptorTest, class Dummy(object): d = DescriptorTest() class Dummy2(object): def __init__(self): self.d = DescriptorTest() The instance of Dummy2 does not invoke the descriptor protocols on d. Whereas Dummy() instances all share the same descriptor d. Yes I know d.__get__() have an instance parameter which can be used to store per-instance values, but sometimes it is just not enough (or it is that I do not know a better approach exists). Suppose the below scenario, I want to model a Register. A register is consist of some fields, which have different number of bits. e.g. a 32 bit register divided into 3 field, bit[0] to bit[7] is called M, bit[8] to bit[15] is called N, and bit[16] to bit[31] is called Z. I want to model a register that, when instantiated as reg, reg.M/N/Z can directly reference each field, calling a descriptor protocol to verify and return the values. Yes, I know I can use metaclass to create a different class for different registers, but that's not seems to be a very smart approach here, as I want all register instances be of type Register. But the default python protocol will not run descriptor protocols if a descriptor is an instance attribute. I'm sure I should not be the only one that facing this issue and I googled around and found a solution to redefine the __setattr__ and __getattribute__ to look up the descriptor protocols first: 107 def __getattribute__(self, name): 108 value = object.__getattribute__(self, name) 109 if hasattr(value, '__get__'): 110 value = value.__get__(self, self.__class__) 111 return value 112 113 def __setattr__(self, name, value): 114 try: 115 obj = object.__getattribute__(self, name) 116 except AttributeError: 117 pass 118 else: 119 if hasattr(obj, '__set__'): 120 return obj.__set__(self, value) 121 return object.__setattr__(self, name, value) This works like a charm and each instance of Register now invoke the descriptors properly. I just do not understand, why such behavior is not a default in python. Or, is there a better design pattern here? Thanks Best Regards, Hua Yanghao -- http://mail.python.org/mailman/listinfo/python-list
Make never ends when compiling from source
I'm trying to install Python 2.7 from source on Centos 6.0. When running make after first running ./configure successfully on the source directory, it performs the checks done by the configure step again in a loop, i.e: the checks are done infinitely many times, so the compiling process never starts. Does anyone know the cause of this behaviour and how to solve it? - Lucas -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Descriptor as Instance Attribute
On Wed, Jan 18, 2012 at 10:55 PM, Hua Yanghao huayang...@gmail.com wrote: I just do not understand, why such behavior is not a default in python. Or, is there a better design pattern here? The behavior is by design. First, keeping object behavior in the class definition simplifies the implementation and also makes instance checks more meaningful. To borrow your Register example, if the M descriptor is defined by some instances rather than by the class, then knowing that the object reg is an instance of Register does not tell me anything about whether reg.M is a valid attribute or an error. As a result, I'll need to guard virtually every access of reg.M with a try-except construct just in case reg is the wrong kind of register. Second, the separation of class from instance also helps you keep object behavior separate from object data. Consider the following class: class ObjectHolder(object): def __init__(self, obj): self.obj = obj Don't worry about what this class might be useful for. Just know that it's meant to hold and provide unrestricted access to arbitrary Python objects: holder = ObjectHolder(42) print(holder.obj) 42 holder.obj = range(5) print(holder.obj) [0, 1, 2, 3, 4] Since the class is meant to hold arbitrary objects, it's even valid that somebody might want to store a descriptor object there: holder.obj = property(lambda x: x.foo) print(holder.obj) property object at 0x02415AE0 Now suppose that Python invoked the descriptor protocol for descriptors stored in instance attributes: holder = ObjectHolder(None) holder.obj = property(lambda x: x.foo) print(holder.obj) Traceback (most recent call last): File stdin, line 1, in module AttributeError: 'ObjectHolder' object has no attribute 'foo' In this case, the ObjectHolder would fail to simply hold the property object as data. The mere act of assigning the property object, a descriptor, to an instance attribute would *change the behavior* of the ObjectHolder. Instead of treating holder.obj as a simple data attribute, it would start invoking the descriptor protocol on accesses to holder.obj and ultimately redirect them to the non-existent and meaningless holder.foo attribute, which is certainly not what the author of the class intended. For the above reasons, I would probably implement your Register class as a set of related class sharing a common metaclass. The solution you came up with is probably fine to solve your specific problem, though. Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list
Re: Make never ends when compiling from source
Just found that the issue was that the clock was not set properly on the server. 2012/1/19 Lucas Moauro lage...@gmail.com I'm trying to install Python 2.7 from source on Centos 6.0. When running make after first running ./configure successfully on the source directory, it performs the checks done by the configure step again in a loop, i.e: the checks are done infinitely many times, so the compiling process never starts. Does anyone know the cause of this behaviour and how to solve it? - Lucas -- http://mail.python.org/mailman/listinfo/python-list
[issue13695] type specific to type-specific
Boštjan Mejak bostjan.me...@gmail.com added the comment: Shut up, Georg! Ezio, please fix this two additional typos to close this bug report for good. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13695 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13811] In str.format an incorrect alignment option doesn't make fill char and onself absent
Eric V. Smith e...@trueblade.com added the comment: I'm not sure what you're saying here. Is it that 'xx' should be ignored? The documentation says that 'xx' isn't fill and alignment, not that they don't exist. If they're not fill and alignment, then the format string is in error. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13811 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9208] SMTPHandler in the logging module does not handle unicode strings
Chris Withers ch...@simplistix.co.uk added the comment: Just as a post-fix to this, the email handlers for the python logging framework that I maintain as a package on PyPI now handle unicode email correctly: http://pypi.python.org/pypi/mailinglogger/3.7.0 I'd suggest people looking for fully-featured email log handlers use mailinglogger... -- nosy: +cjw296 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9208 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13811] In str.format an incorrect alignment option doesn't make fill char and onself absent
Boštjan Mejak bostjan.me...@gmail.com added the comment: Please fix the error message to invalid format specifier -- nosy: +Retro ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13811 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13804] Python library structure creates hard to read code when using higher order functions
Martin Häcker spamfaen...@gmx.de added the comment: @stutzbach: I believe you got me wrong, as the example topic.questions is meant to return a list of questions that need concatenating - thus you can't save the second step. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13804 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13807] logging.Handler.handlerError() may raise AttributeError in traceback.print_exception()
Changes by Austin Bingham austin.bing...@gmail.com: -- nosy: +abingham ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13807 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6531] atexit_callfuncs() crashing within Py_Finalize() when using multiple interpreters.
Graham Dumpleton graham.dumple...@gmail.com added the comment: What are the intentions with respect to atexit and sub interpreters? The original report was only about ensuring that the main interpreter doesn't crash if an atexit function was registered in a sub interpreter. So, was not expecting a change to sub interpreters in submitting this report, in as much as atexit callbacks for sub interpreters are never invoked in Python 2.X. That said, for mod_wsgi I have extended sub interpreter destruction so that atexit callbacks registered in sub interpreters are called. For mod_wsgi though, sub interpreters are only destroyed on process shutdown. For the general case, a sub interpreter could be destroyed at any time during the life of the process. If one called atexit callbacks on such sub interpreter destruction, it notionally changes the meaning of atexit, which is in process exit and not really sub interpreter exit. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6531 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13703] Hash collision security issue
STINNER Victor victor.stin...@haypocalc.com added the comment: I like what you've done in #13704 better than what I see in random-8.patch so far. see the code review comments i've left on both issues. I didn't write 3106cc0a2024.diff patch attached to #13704, I just clicked on the button to generate a patch from the repository. Christian Heimes wrote the patch. I don't really like 3106cc0a2024.diff, we don't need Mersenne Twister to initialize the hash secret. The patch doesn't allow to set a fixed secret if you need the same secret for a group of processes. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13703 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13810] refer people to Doc/Makefile when not using 'make' to build main documentation
Sandro Tosi sandro.t...@gmail.com added the comment: The outdated command is addressed in issue#12415, and I think it's better to provide a precise command in devguide, so that if you don't use make you don't even need to understand where to grab the information to checkout third-party tools. Additionally, the whole way we're fetching those tools will be revisited soon. -- nosy: +sandro.tosi resolution: - duplicate stage: - committed/rejected status: open - closed superseder: - Missing: How to checkout the Doc sources ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13810 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13814] Generators as context managers.
New submission from Arkadiusz Wahlig arkadiusz.wah...@gmail.com: Generators should support the with statement with __exit__ calling self.close(). with genfunc() as g: for item in g: print(item) -- messages: 151530 nosy: yak priority: normal severity: normal status: open title: Generators as context managers. type: enhancement versions: Python 2.7, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13814 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6531] atexit_callfuncs() crashing within Py_Finalize() when using multiple interpreters.
Antoine Pitrou pit...@free.fr added the comment: That said, for mod_wsgi I have extended sub interpreter destruction so that atexit callbacks registered in sub interpreters are called. For mod_wsgi though, sub interpreters are only destroyed on process shutdown. For the general case, a sub interpreter could be destroyed at any time during the life of the process. If one called atexit callbacks on such sub interpreter destruction, it notionally changes the meaning of atexit, which is in process exit and not really sub interpreter exit. Well the atexit docs say Functions thus registered are automatically executed upon normal interpreter termination. My reasoning is: - atexit functions are already called at interpreter destruction (*), not at process shutdown. If you call Py_Initialize and Py_Finalize several times in a row, you will have several atexit calls. - registering a function in an interpreter and calling it in another is undefined and potentially dangerous. That function can for example refer to global objects which are different from the calling interpreter's global objects. These objects or their internal structures could have become invalid when the sub-interpreter was shut down. I expect uses of sub-interpreters to be quite rare apart from mod_wsgi, so following mod_wsgi makes sense IMO. (*) note atexit functions are even called *before* module globals are garbage collected. It's quite early in the cleanup phase. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6531 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13814] Generators as context managers.
Ezio Melotti ezio.melo...@gmail.com added the comment: If you want to call .close() automatically on something you can use contextlib.closing(): http://docs.python.org/library/contextlib.html#contextlib.closing -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13814 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10109] itertools.product with infinite iterator cause MemoryError.
Sumudu Fernando sumu...@gmail.com added the comment: I don't agree with the response to this. It is true that as implemented (at least in 2.7, I don't have 3.x handy to check) itertools.product requires finite iterables. However this seems to be simply a consequence of the implementation and not part of the spirit of the function, which as falsetru pointed out is stated to be equivalent to nested for-loops in a generator expression. Indeed, implementing product in Python (in a recursive way) doesn't have this problem. Perhaps a more convincing set of testcases to show why this could be considered a problem: import itertools itertools.product(xrange(100)) itertools.product object at 0xb7ed334c itertools.product(xrange(100)) itertools.product object at 0xb7ed620c itertools.product(xrange(10)) Traceback (most recent call last): File stdin, line 1, in module MemoryError Note that I'm not even using an infinite iterable, just a really big one. The issue is that creating the iterator fails with a MemoryError, before I've even asked for any values. Consider the following: for (i, v) in enumerate(itertools.product(a, b, c)): if i 1000: print v else: break When a, b, and c are relatively small, finite iterables, this code works fine. However, if *any* of them are too large (or infinite), we see a MemoryError before the loop even starts, even though only 1000 elements are required. I think it's conceivable that we might want something like a = itertools.cycle(xrange(5)), and even that will break this loop. That said, in all such cases I could think of, we can always either truncate big iterators before passing them to product, or use zip/comprehensions to add their values into the tuple (or some combination of those). So maybe it isn't a huge deal. I've attached my implementation of product which deals with infinite iterators by leveraging enumerate and itertools.cycle, and is pretty much a direct translation of the odometer idea. This doesn't support the repeat parameter (but probably could using itertools.tee). One thing that should be changed is itertools.cycle shouldn't be called / doesn't need to be called on infinite iterators, but I couldn't figure out how to do that. Maybe there is some way to handle it in the C implementation?) In summary: the attached implementation of product can accept any mix of infinite / finite iterators, returning a generator intended for partial consumption. The existing itertools.product doesn't work in this case. -- nosy: +Sumudu.Fernando Added file: http://bugs.python.org/file24270/product.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10109 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13796] use 'text=...' to define the text attribute of and xml.etree.ElementTree.Element
Pedro Andres Aranda Gutierrez paag...@gmail.com added the comment: Thanks a lot again :-) We have a saying here: you'll never go to sleep without having learnt something new :-) On Tue, Jan 17, 2012 at 4:11 PM, patrick vrijlandt rep...@bugs.python.org wrote: patrick vrijlandt patrick.vrijla...@gmail.com added the comment: Hi, Did you look at lxml (http://lxml.de)? from lxml.builder import E from lxml import etree tree = etree.ElementTree( E.Hello( Good morning!, E.World(How do you do, humour = excellent), Fine, E.Goodbye(), ), ) print(etree.tostring(tree, pretty_print=True).decode()) # output, even more prettified Hello Good morning! World humour=excellent How do you do /World Fine Goodbye/ /Hello By the way, your Element enhancement is buggy, because all newly create elements will share the same attrib dictionary (if attrib is not given). Notice that Donald Duck will be sad; by the time we print even Hello is sad. import xml.etree.ElementTree as etree class Element(etree.Element): def __init__(self, tag, attrib={}, **extra): super().__init__(tag) self.tag = tag self.attrib = attrib self.attrib.update(extra) self.text = self.attrib.pop('text', None) self.tail = self.attrib.pop('tail', None) self._children = [] if __name__ == '__main__': test = Element('Hello',) test2 = Element('World',{'humour':'excelent'},text = 'How do you do', tail=Fine) test3 = Element('Goodbye', humour='sad') test4 = Element('Donaldduck') test.append(test2) test.append(test3) test.append(test4) tree = etree.ElementTree(test) print(etree.tostring(test, encoding=utf-8, method=xml)) Hello humour=sad World humour=excelentHow do you do/WorldFine Goodbye humour=sad / Donaldduck humour=sad / /Hello' The correct idiom would be: def __init__(self, tag, attrib=None, **extra): if attrib is None: attrib = {} super().__init__(tag) Cheers, Patrick 2012/1/16 Pedro Andres Aranda Gutierrez rep...@bugs.python.org Pedro Andres Aranda Gutierrez paag...@gmail.com added the comment: Touché :-) I was just frustrated because my XMLs never have tail or text as attributes and I wanted to have more compact code... On Mon, Jan 16, 2012 at 12:14 PM, patrick vrijlandt rep...@bugs.python.org wrote: patrick vrijlandt patrick.vrijla...@gmail.com added the comment: I agree the Element syntax is sometimes awkward. But how would you represent text or tail attributes within this enhanced element? animal name=cat tail=yes comes to mind ... -- nosy: +patrick.vrijlandt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13796 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13796 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13796 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13796 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5689] Support xz compression in tarfile module
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset b86b54fcb5c2 by Lars Gustäbel in branch 'default': Issue #5689: Avoid excessive memory usage by using the default lzma preset. http://hg.python.org/cpython/rev/b86b54fcb5c2 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5689 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13815] tarfile.ExFileObject can't be wrapped using io.TextIOWrapper
New submission from Colin Watson cjwat...@users.sourceforge.net: The file-like object returned by TarFile.extractfile can't be wrapped in an io.TextIOWrapper (which would be rather convenient in some cases to get something that reads str rather than bytes). The attached patch demonstrates the problem by way of a test case, and fixes it. It's just a matter of adding a no-op flush method so that TextIOWrapper.close is happy with it. -- components: Library (Lib) files: tarfile-exfileobject-flush.patch keywords: patch messages: 151536 nosy: cjwatson priority: normal severity: normal status: open title: tarfile.ExFileObject can't be wrapped using io.TextIOWrapper versions: Python 3.3 Added file: http://bugs.python.org/file24271/tarfile-exfileobject-flush.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13815 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)
Stefan Krah stefan-use...@bytereef.org added the comment: Revisiting memoryview.size: I foresee problems for NumPy users, since array.size has a different meaning there: x = array([[1,2,3], [4,5,6]], dtype='q') x.shape (2, 3) x.itemsize 8 len(x) 2 x.size 6 x.nbytes 48 So here we have: x.nbytes == product(shape) * itemsize == Py_buffer.len == (virtual!) byte length x.size == product(shape) == number of elements My suggestion is to use memoryview.nbytes as well. memoryview.size would have the additional problem that Py_buffer.len is always the byte size of the logical structure (e.g. after slicing) and not necessarily the byte size of the physical memory area. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10181 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)
Nick Coghlan ncogh...@gmail.com added the comment: nbytes sounds reasonable to me, given the unfortunate ambiguity of both size and len. As far as #12834 goes, I'm happy to go along with whatever you think is best. You've spent a lot more time down in the guts of the implementation than I have, and the approach you describe seems to make sense :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10181 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)
Nick Coghlan ncogh...@gmail.com added the comment: Err, make that #12384 (oops) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10181 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)
Changes by Nick Coghlan ncogh...@gmail.com: -- Removed message: http://bugs.python.org/msg151539 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10181 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13803] Under Solaris, distutils doesn't include bitness in the directory name
Éric Araujo mer...@netwok.org added the comment: Final code looks OK to me. -- type: enhancement - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13803 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13813] sysconfig.py and distutils/util.py redundancy
Éric Araujo mer...@netwok.org added the comment: I am afraid the distutils feature freeze prevents us from doing this, even in 3.3. Remember that Tarek initially moved sysconfig from distutils to the top level, and the removal was reverted alongside other improvements when there was outcry at the distutils changes and distutils2 was started. We are aware of the discrepancies between distutils.sysconfig and syconfig; for example, the Mac framework stuff for --user (PEP 371) is different, and the docs for sysconfig misleadingly says that the paths are used by distutils. These will get fixed when I get a chance. distutils2/packaging exclusively uses sysconfig, no more duplication. -- assignee: tarek - eric.araujo resolution: - wont fix stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13813 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13813] sysconfig.py and distutils/util.py redundancy
Éric Araujo mer...@netwok.org added the comment: s/PEP 371/PEP 370/ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13813 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11805] package_data only allows one glob per-package
Éric Araujo mer...@netwok.org added the comment: I figured it would let people comment on the syntax I propose more easily if I extracted it from the patch. Here’s the example: package_data = cheese = data/templates/* doc/* doc/images/*.png We have a package name, equals sign, then specs/globs separated by whitespace, including newlines (without any indent rules for the continuation lines, the code just adds them to the last seen package name if there is no equals sign in the lign). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11805 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1785] inspect gets broken by some descriptors
Vincent Pelletier plr.vinc...@gmail.com added the comment: This change causes the following behaviour: import inspect class B(object): ... def f(self): ... pass ... inspect.getmembers(B, inspect.ismethod) [] While I would expect the result to contain f: inspect.ismethod(B.f) True Isn't this a regression ? Regards, Vincent Pelletier -- nosy: +vpelletier ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1785 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1785] inspect gets broken by some descriptors
Vincent Pelletier plr.vinc...@gmail.com added the comment: Sorry, I forgot to mention I'm using python2.7 . -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1785 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13815] tarfile.ExFileObject can't be wrapped using io.TextIOWrapper
Changes by Barry A. Warsaw ba...@python.org: -- nosy: +barry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13815 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13695] type specific to type-specific
Changes by Boštjan Mejak bostjan.me...@gmail.com: -- nosy: -georg.brandl resolution: remind - ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13695 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13695] type specific to type-specific
Boštjan Mejak bostjan.me...@gmail.com added the comment: I am closing this issue report and opening another issue report with the two new doc typos that were not reported here before the commit of Ezio Melotti. -- nosy: -docs@python, ezio.melotti, python-dev, rhettinger resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13695 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13816] Two typos in the docs
New submission from Boštjan Mejak bostjan.me...@gmail.com: There's a typo in the docs for cmp_to_key() function. Fix the first sentence Transform an old-style comparison function to a key-function. to Transform an old-style comparison function to a key function. (delete the hyphen between words key and function) http://docs.python.org/library/functools.html#functools.cmp_to_key -- There's another typo in the docs lurking in http://docs.python.org/library/stdtypes.html#sequence-types-str-unicode-list-tuple-bytearray-buffer-xrange Look for the table with the columns Operation, Result, Notes (scroll down and you'll find it), and fix the text of the fifth cell under the Result column like this: i'th item of s, origin 0 -- i-th item of s, origin 0. Change that apostrophe into a hyphen, so i'th to i-th. Thanks, Ezio. -- assignee: docs@python components: Documentation messages: 151547 nosy: Retro, docs@python, ezio.melotti priority: normal severity: normal status: open title: Two typos in the docs type: enhancement versions: Python 2.7, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13816 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1785] inspect gets broken by some descriptors
Antoine Pitrou pit...@free.fr added the comment: Thanks for noticing. The doc for ismethod() says: “Return true if the object is a bound method written in Python.” and the docstring agrees with that: “Return true if the object is an instance method. [...]” So the change isn't properly a regression when reading the docs. On the other hand, it's true that some code may rely on the previous behaviour, and the discrepancy between getmembers() and a manual test can be confusing. By the way, Python 3 has ismethod() right: class B: ... def f(self): pass ... inspect.ismethod(B.f) False inspect.ismethod(B().f) True -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1785 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1785] inspect gets broken by some descriptors
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset f824744557ba by Antoine Pitrou in branch '2.7': Revert part of 13f56cd8dec1 (issue #1785) to avoid breaking getmembers() with unbound methods. http://hg.python.org/cpython/rev/f824744557ba -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1785 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1785] inspect gets broken by some descriptors
Antoine Pitrou pit...@free.fr added the comment: I've backed out the part of the changeset that fixed getmembers(), so the old behaviour is restored. Other parts of the changeset (that e.g. fixed pydoc) have not been reverted. -- versions: +Python 2.7, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1785 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13816] Two typos in the docs
Stefan Krah stefan-use...@bytereef.org added the comment: Just as a note: It is not acceptable to be rude on the tracker or to remove people from the nosy list as you did in #13695. -- nosy: +skrah ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13816 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13816] Two typos in the docs
Georg Brandl ge...@python.org added the comment: And not really working, as I get updates for all assignments to docs@python anyway. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13816 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13816] Two typos in the docs
Boštjan Mejak bostjan.me...@gmail.com added the comment: I am deeply and truly sorry. Can we now fix this? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13816 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11805] package_data only allows one glob per-package
Erik Bray erik.m.b...@gmail.com added the comment: This patch works for me, and I'm happy with the syntax. Thanks! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11805 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13804] Python library structure creates hard to read code when using higher order functions
Daniel Stutzbach stutzb...@google.com added the comment: Ah - in your first example (the one with 3 lines) did you mean to use .extend instead of .append? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13804 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13817] deadlock in subprocess while running several threads using Popen
New submission from Christoph Glaubitz chris...@chrigl.de: Starting several threads, each just starting a subprocess.Popen and use communicate cause a deadlock in subprocess. (see attached file) I can only reproduce this with python 2.7.2, not with any other versions. 2.6.5, 2.6.7 and 3.2.2 are working fine. Also 2.4.6 is working, with a problem fixed by http://bugs.python.org/issue1731717. The attached script does not dead lock all the time, but at least every second call. I am on a linux x86_64. The python's are compiled by hand, except of 2.6.5. -- files: subprocess_deadlock.py messages: 151556 nosy: glaubich priority: normal severity: normal status: open title: deadlock in subprocess while running several threads using Popen type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file24272/subprocess_deadlock.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13817 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13795] CDATA Element missing
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: Note that there is no need to emit CDATA section: it's just another method to write data, just like in Python \x41 and A are not distinct. The workaround there is a hack, since it redefines an internal method _write(). This function is an implementation detail, and changed in newer releases. I posted another hack on the stackoverflow page above, that works for python 3.2. -- nosy: +amaury.forgeotdarc resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13795 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13816] Two typos in the docs
Justin Wehnes jweh...@gmail.com added the comment: Removed the hyphen in function keys. Didn't really see a problem with using an apostrophe in 'ith' instead of a hyphen because I have seen it done both ways but changed it anyways. This is my first contribution so i needed the practice. Hope I did everything correctly. -- keywords: +patch nosy: +JWEH Added file: http://bugs.python.org/file24273/hyphen_removed_key_function.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13816 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13816] Two typos in the docs
Changes by Justin Wehnes jweh...@gmail.com: Added file: http://bugs.python.org/file24274/i_th_hyphen.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13816 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13704] Random number generator in Python core
Changes by Dave Malcolm dmalc...@redhat.com: -- nosy: +dmalcolm ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13704 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10278] add time.wallclock() method
Antoine Pitrou pit...@free.fr added the comment: There are some issue on the Windows buildbots: == FAIL: test_wallclock (test.test_time.TimeTestCase) -- Traceback (most recent call last): File D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_time.py, line 340, in test_wallclock self.assertAlmostEqual(t, 0.1, places=2) AssertionError: 0.09138312271531701 != 0.1 within 2 places -- -- assignee: - haypo status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10278 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13703] Hash collision security issue
Marc-Andre Lemburg m...@egenix.com added the comment: STINNER Victor wrote: Patch version 7: - Make PyOS_URandom() private (renamed to _PyOS_URandom) - os.urandom() releases the GIL for I/O operation for its implementation reading /dev/urandom - move _Py_unicode_hash_secret_t documentation into unicode_hash() I moved also fixes for tests in a separated patch: random_fix-tests.patch. Don't you think that the number of corrections you have to apply in order to get the tests working again shows how much impact such a change would have in real-world applications ? Perhaps we should start to think about a compromise: make both the collision counting and the hash seeding optional and let the user decide which option is best. BTW: The patch still includes the unnecessary _Py_unicode_hash_secret.suffix which needlessly complicates the code and doesn't any additional protection against hash value collisions. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13703 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13703] Hash collision security issue
Guido van Rossum gu...@python.org added the comment: On Wed, Jan 18, 2012 at 10:59 AM, Marc-Andre Lemburg rep...@bugs.python.org wrote: Marc-Andre Lemburg m...@egenix.com added the comment: STINNER Victor wrote: Patch version 7: - Make PyOS_URandom() private (renamed to _PyOS_URandom) - os.urandom() releases the GIL for I/O operation for its implementation reading /dev/urandom - move _Py_unicode_hash_secret_t documentation into unicode_hash() I moved also fixes for tests in a separated patch: random_fix-tests.patch. Don't you think that the number of corrections you have to apply in order to get the tests working again shows how much impact such a change would have in real-world applications ? Perhaps we should start to think about a compromise: make both the collision counting and the hash seeding optional and let the user decide which option is best. I like this, esp. if for old releases the collision counting is on by default and the hash seeding is off by default, while in 3.3 both should be on by default. Different env vars or flags should be used to enable/disable them. BTW: The patch still includes the unnecessary _Py_unicode_hash_secret.suffix which needlessly complicates the code and doesn't any additional protection against hash value collisions. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13703 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13703 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13818] argparse: -h listening required options under optional arguments
New submission from Miguel Godinho m...@miguelgodinho.com: Adding a 'required optional argument' as with: ``` app.add_argument('--dbsnp', required=True) ``` will still result on having that argument listed under the optional when the app is called with the help option (-h) Please note that the usage line is rendered ok (no square brackets around the 'required optional argument'). -- components: Library (Lib) messages: 151562 nosy: mgodinho priority: normal severity: normal status: open title: argparse: -h listening required options under optional arguments type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13818 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13815] tarfile.ExFileObject can't be wrapped using io.TextIOWrapper
Changes by Lars Gustäbel l...@gustaebel.de: -- assignee: - lars.gustaebel nosy: +lars.gustaebel ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13815 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13819] _warnings settings are process-wide
New submission from Antoine Pitrou pit...@free.fr: The settings in the C _warnings module are system-wide instead of being interpreter-wide. It seems the latter would be more desireable (and probably more compatible with the Python warnings module). -- components: Extension Modules, Interpreter Core messages: 151563 nosy: brett.cannon, pitrou priority: low severity: normal status: open title: _warnings settings are process-wide type: behavior versions: Python 2.7, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13819 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13763] Potentially hard to understand wording in devguide
Terry J. Reedy tjre...@udel.edu added the comment: I read 'program name' as referring to 'Mercurial', not 'hg'. Perhaps Tshepang did also. Read that way, it is not right. Reading it the intended way is not so obvious to one who has never typed 'hg' on a command line. It would be impossible for one who does not even know that hg is the executable name. Given that the intended audience is not limited to experienced hg users, I suggest changing (commonly abbreviated hg, after the program name) to the much clearer and explicit The Mercurial executable is named 'hg', and 'hg' is often used to refer to Mercurial itself. (This is just a slight rewording of what Éric said is meant to be said.) I agree that we should not discuss the origin of 'hg'. The chemical symbol is 'Hg', whereas 'hg' (normally) abbreviates 'hectogram'. My suggestion simply states two facts that beginning cpython developers need to know. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13763 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13819] _warnings settings are process-wide
Changes by Alex Gaynor alex.gay...@gmail.com: -- nosy: +alex ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13819 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com