[ANN] Leipzig Python User Group - Meeting, February 12, 2013, 08:00 p.m.
=== Leipzig Python User Group === We will meet on Tuesday, February 12 at 8:00 p.m. at the training center of Python Academy in Leipzig, Germany ( http://www.python-academy.com/center/find.html ). Mike Müller (me ;)) will talk about IPython [1] and especially the new IPython notebook. IPython is a greatly enhanced alternative to the interactive Python prompt. The notebook allows to create interactive documents in a browser with markdown, Python code and matplotlib graphics. Even though IPython is traditionally only widely used among scientists, it offers interesting opportunities for all Python users. Everybody who uses Python, plans to do so or is interested in learning more about the language is encouraged to participate. While the meeting language will be mainly German, we will provide English translation if needed. Food and soft drinks are provided. Please send a short confirmation mail to i...@python-academy.de, so we can prepare appropriately. Current information about the meetings are at http://www.python-academy.com/user-group . Mike == Leipzig Python User Group === Wir treffen uns am Dienstag, 12.02.2013 um 20:00 Uhr im Schulungszentrum der Python Academy in Leipzig ( http://www.python-academy.de/Schulungszentrum/anfahrt.html ). Mike Müller (das bin ich ;)) stellt IPython [1] und insbesondere das neue IPython-Notebook vor. IPython bietet eine stark erweiterte Alternative zum interaktiven Python-Prompt. Mit dem neuen Notebook lassen sich im Browser interaktive Dokumente mit Markdown, Python-Code und Matplotlib-Grafiken anlegen. Obwohl IPython vor allem im wissenschaftlichen Umfeld verbreitet ist, bietet es interessante Möglichkeiten für alle Python-Nutzer. Weitere Infos: http://www.python-academy.de/User-Group/index.html Willkommen ist jeder, der Interesse an Python hat, die Sprache bereits nutzt oder nutzen möchte. Für das leibliche Wohl wird gesorgt. Eine Anmeldung unter i...@python-academy.de wäre nett, damit wir genug Essen besorgen können. Aktuelle Informationen zu den Treffen sind unter http://www.python-academy.de/User-Group zu finden. Viele Grüße Mike [1] http://ipython.org/ -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Can you help me???
Are you traveling abroad on holiday??? Does the resort have enough information on the internet??? Would you like to ask local people information about attractions, good places to eat, nice places, that is, just about anything??? For this site, I have asked people around the world to join and tell the tourists information about their own country / city. Similarly, when they themselves are traveling somewhere, they can get here also interesting information about the destination. A similar service has not to my knowledge found on the internet and I would hope that you decide to join as a free member and you will help other people to make their holiday a successful :) And I also hope that if you are a self-help / information requirements, hopefully my site will also help you http://theworldismy.webs.com/ -- http://mail.python.org/mailman/listinfo/python-list
Coercing one object to type of another
Hi Inside a function i get a two arguments, say arg1 and arg2, how can i convert arg2 to same type as arg1 ? I dont know type of arg1 or arg2 for that matter, I just want to convert arg2 to type of arg1 if possible and handle the exception if raised. Also: int('2') 2 float('2.0') 2.0 coerce(2,2.0) (2.0,2.0) but coerce('2',2) fails.If int('2') equals 2, why should it fail ? -- http://mail.python.org/mailman/listinfo/python-list
Re: Coercing one object to type of another
On Sat, Feb 9, 2013 at 9:29 PM, Vijay Shanker deont...@gmail.com wrote: Hi Inside a function i get a two arguments, say arg1 and arg2, how can i convert arg2 to same type as arg1 ? I dont know type of arg1 or arg2 for that matter, I just want to convert arg2 to type of arg1 if possible and handle the exception if raised. Also: int('2') 2 float('2.0') 2.0 coerce(2,2.0) (2.0,2.0) but coerce('2',2) fails.If int('2') equals 2, why should it fail ? You can get the type of any object, and call that: def coerce(changeme,tothis): return type(tothis)(changeme) ChrisA -- http://mail.python.org/mailman/listinfo/python-list
python3 binascii.hexlify ...
This seems to return a bytes object in Python 3.3.0. I was expecting a string. The documentation here: http://docs.python.org/3/library/binascii.html#binascii.hexlify also keeps me expecting a string. Am I missing something? Example: [hg/css-venti-bytes+utf8]fleet*2 python3 Python 3.3.0 (default, Nov 11 2012, 08:47:42) [GCC 4.2.1 Compatible Apple Clang 4.0 ((tags/Apple/clang-421.0.60))] on darwin Type help, copyright, credits or license for more information. import binascii binascii.hexlify(b'abc') b'616263' I'm on a Mac but am hoping that is irrelevant. Cheers, -- Cameron Simpson c...@zip.com.au You can fool too many of the people too much of the time. - James Thurber -- http://mail.python.org/mailman/listinfo/python-list
string.replace doesn't removes :
Hi *Monte-Pythons*, x = this is a simple : text: that has colon s = x.replace(string.punctuation, ); OR s = x.replace(string.punctuation, ); print x # 'this is a simple : text: that has colon' # The colon is still in the text Is this a bug or am I doing something wrong ? Py.Version: 2.7 OS: Ubuntu 12.10 (64 bits) Cheers, -Joshua -- http://mail.python.org/mailman/listinfo/python-list
Re: python3 binascii.hexlify ...
Cameron Simpson wrote: This seems to return a bytes object in Python 3.3.0. I was expecting a string. The documentation here: http://docs.python.org/3/library/binascii.html#binascii.hexlify also keeps me expecting a string. Am I missing something? Return the hexadecimal representation of the binary data. Every byte of data is converted into the corresponding 2-digit hex representation. makes it pretty clear that the function is operating on bytes, not str. The following sentence The resulting string... is likely a leftover from Python 2 and should be fixed. If you need str instead of bytes it's easy enough to do the encoding/decoding yourself: import binascii as ba ba.hexlify(äöü.encode()) b'c3a4c3b6c3bc' ba.unhexlify(_).decode() 'äöü' -- http://mail.python.org/mailman/listinfo/python-list
Re: string.replace doesn't removes :
On Sat, Feb 9, 2013 at 10:04 PM, Joshua Robinson shooki.robin...@gmail.com wrote: Hi Monte-Pythons, x = this is a simple : text: that has colon s = x.replace(string.punctuation, ); OR s = x.replace(string.punctuation, ); print x # 'this is a simple : text: that has colon' # The colon is still in the text Is this a bug or am I doing something wrong ? str.replace() replaces whole strings, not the individual characters. You probably want str.translate(): s = x.translate(string.maketrans(,),string.punctuation) You'll then want to print s, rather than x, to see the difference. Note that it's a little different in Python 3, and you would instead use: s = x.translate(str.maketrans(,,string.punctuation)) ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Python3 curses behavior
Hello. I found strange behavior of curses module, that i can't understand. I initialize screen with curses.initscr(), then i create subwin of screen with screen.subwin(my_subwin_sizes). After that i fill subwin with my_char in for-loop. On last char in last line subwin.addch() raises exception. This is my problem. Why? How to fix it? (If i will ignore exception, then last char will be displayed) Here simple example: http://pastebin.com/SjyMsHZB Thank You! -- http://mail.python.org/mailman/listinfo/python-list
Re: Coercing one object to type of another
On Saturday, February 9, 2013 4:13:28 PM UTC+5:30, Chris Angelico wrote: On Sat, Feb 9, 2013 at 9:29 PM, Vijay Shanker deont...@gmail.com wrote: Hi Inside a function i get a two arguments, say arg1 and arg2, how can i convert arg2 to same type as arg1 ? I dont know type of arg1 or arg2 for that matter, I just want to convert arg2 to type of arg1 if possible and handle the exception if raised. Also: int('2') 2 float('2.0') 2.0 coerce(2,2.0) (2.0,2.0) but coerce('2',2) fails.If int('2') equals 2, why should it fail ? You can get the type of any object, and call that: def coerce(changeme,tothis): return type(tothis)(changeme) ChrisA well it will always return me this: type 'str' what i want is if i know arg1 is of string type(and it can be of any type, say list, int,float) and arg2 is of any type, how can i convert it to type of arg1, if arg1='hello world', type(arg1).__name__ will give me 'str', can i use this to convert my arg2 to this type, w/o resorting to if-elif conditions as there will be too many if-elif-else and it doesn really sounds a great idea ! thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: python3 binascii.hexlify ...
On Sat, Feb 9, 2013 at 10:10 PM, Peter Otten __pete...@web.de wrote: Return the hexadecimal representation of the binary data. Every byte of data is converted into the corresponding 2-digit hex representation. makes it pretty clear that the function is operating on bytes, not str. That doesn't necessarily mean it has to return bytes, though. It's taking binary data and producing something that's plausibly either bytes or str. It's human-readable and would definitely make sense to be str (for instance, hex() returns a str), so imo this should be made very clear in the docs. Maybe: Return the hexadecimal representation of the binary data. Every byte of data is converted into two bytes with the corresponding hex representation in ASCII. or somesuch? ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Python3 curses behavior
On Sat, Feb 9, 2013 at 10:23 PM, Vlasov Vitaly vnig...@gmail.com wrote: Hello. I found strange behavior of curses module, that i can't understand. I initialize screen with curses.initscr(), then i create subwin of screen with screen.subwin(my_subwin_sizes). After that i fill subwin with my_char in for-loop. On last char in last line subwin.addch() raises exception. This is my problem. Why? How to fix it? (If i will ignore exception, then last char will be displayed) Here simple example: http://pastebin.com/SjyMsHZB What exception is being raised? That's kinda the most important part here :) ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Coercing one object to type of another
On Sat, Feb 9, 2013 at 10:23 PM, Vijay Shanker deont...@gmail.com wrote: well it will always return me this: type 'str' what i want is if i know arg1 is of string type(and it can be of any type, say list, int,float) and arg2 is of any type, how can i convert it to type of arg1, if arg1='hello world', type(arg1).__name__ will give me 'str', can i use this to convert my arg2 to this type, w/o resorting to if-elif conditions as there will be too many if-elif-else and it doesn really sounds a great idea ! Oh, okay. Then switch the order of the arguments in what I posted: def coerce(target,convertme): return type(target)(convertme) You don't need to worry about the actual name of the type. It's telling you that it's type 'str'; that's an actual callable object (the same as the builtin name str, in this case). You can then call that to coerce the other argument to that type. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Alternatives to Splunk?
Are there any opensource alternatives to Splunk? Need tool to analyze the log files.. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python3 curses behavior
суббота, 9 февраля 2013 г., 15:28:51 UTC+4 пользователь Chris Angelico написал: On Sat, Feb 9, 2013 at 10:23 PM, Vlasov Vitaly vnig...@gmail.com wrote: Hello. I found strange behavior of curses module, that i can't understand. I initialize screen with curses.initscr(), then i create subwin of screen with screen.subwin(my_subwin_sizes). After that i fill subwin with my_char in for-loop. On last char in last line subwin.addch() raises exception. This is my problem. Why? How to fix it? (If i will ignore exception, then last char will be displayed) Here simple example: http://pastebin.com/SjyMsHZB What exception is being raised? That's kinda the most important part here :) ChrisA curses.error -- all curses-related exception Exception text: curses.error: 'addch() returned ERR' -- http://mail.python.org/mailman/listinfo/python-list
Re: Jinja2 installation help
Here is the fucked up thing that I learned from all the hours of reading from different websites and documentation. To install Pip I need to install Easy_Install-- To install Easy_install I need to install Setup Tools whitch is NOT compatible with Python 3.XX ... If PIP is a replacement for Easy-install why does it require IT? What is going on? PS: I am a Windows 7 user. -- http://mail.python.org/mailman/listinfo/python-list
Re: Jinja2 installation help
On Sat, Feb 9, 2013 at 1:55 PM, Robert Iulian robert.iulia...@gmail.com wrote: Here is the fucked up thing that I learned from all the hours of reading from different websites and documentation. To install Pip I need to install Easy_Install-- To install Easy_install I need to install Setup Tools whitch is NOT compatible with Python 3.XX ... If PIP is a replacement for Easy-install why does it require IT? What is going on? PS: I am a Windows 7 user. -- http://mail.python.org/mailman/listinfo/python-list It doesn’t require easy_install, nor setuptools (only distribute). http://www.pip-installer.org/en/latest/installing.html#using-get-pip -- Kwpolska http://kwpolska.tk | GPG KEY: 5EAAEA16 stop html mail| always bottom-post http://asciiribbon.org| http://caliburn.nl/topposting.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Jinja2 installation help
Ah...Must have slipped that. It worked! Thank you all for the support ! Be well ! Robert -- http://mail.python.org/mailman/listinfo/python-list
Re: Alternatives to Splunk?
On Sat, Feb 9, 2013 at 7:27 AM, sssdevelop sssdeve...@gmail.com wrote: Are there any opensource alternatives to Splunk? Need tool to analyze the log files.. This is highly off topic, however I'm using logstash + kibana for my log analysis. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7
On 02/09/2013 09:27 AM, Morten Engvoldsen wrote: Hi Team, I Have saved my output in .doc file and want to format the output with *Start the File Some data here ***End of File* Can you let me know how can i do that using Python? Just add an output statement right after creating the file, and another just before closing it. This is assuming that this is a text file. By explicitly telling us it has a .doc extension, you may be trying to tell us it's in some proprietary file format whose type we have to guess. BTW, if you actually wanted *code*, you might have considered including some more information about your environment. For example a print statement is an output statement in Python 2.x, while the print function in Python 3.x looks quite different, at least when directed to a file. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7
On Sat, 9 Feb 2013 15:27:16 +0100 Morten Engvoldsen mortene...@gmail.com wrote: I Have saved my output in .doc file and want to format the output with *Start the File Some data here ***End of File* Can you let me know how can i do that using Python? Seems pretty simple. Open the file, read it into a variable, print the header, print the data and then print the footer. Which part are you struggling with? Show us your code so far. Or is the issue with the .doc file? Is it a Word document or simple text? -- D'Arcy J.M. Cain da...@druid.net | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416 425 1212 (DoD#0082)(eNTP) | what's for dinner. IM: da...@vex.net, VOIP: sip:da...@vex.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7
Hi Cain, Thanks for your reply. I am stroning all the contents in batchdate and then, data = base64.encodestring(batchdata) and then writing data in doc file. I know i can append ***Start file*** in the batchdata, but is there a better python code like multiply * into 10 times -- any python code i can add the formatting in dynamic way instead of hardcoding with ***Start file*** line. Thanks for your reply again. On Sat, Feb 9, 2013 at 3:38 PM, D'Arcy J.M. Cain da...@druid.net wrote: On Sat, 9 Feb 2013 15:27:16 +0100 Morten Engvoldsen mortene...@gmail.com wrote: I Have saved my output in .doc file and want to format the output with *Start the File Some data here ***End of File* Can you let me know how can i do that using Python? Seems pretty simple. Open the file, read it into a variable, print the header, print the data and then print the footer. Which part are you struggling with? Show us your code so far. Or is the issue with the .doc file? Is it a Word document or simple text? -- D'Arcy J.M. Cain da...@druid.net | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416 425 1212 (DoD#0082)(eNTP) | what's for dinner. IM: da...@vex.net, VOIP: sip:da...@vex.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7
Morten Engvoldsen wrote: I know i can append ***Start file*** in the batchdata, but is there a better python code like multiply * into 10 times -- any python code i can add the formatting in dynamic way instead of hardcoding with ***Start file*** line. print Start file .center(40, *) ** Start file ** -- http://mail.python.org/mailman/listinfo/python-list
Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7
Hi Davea, I am using Python 2.7. -- http://mail.python.org/mailman/listinfo/python-list
Logwatch python
Hello, I am trying to run this code, but I get an answer incorrect arguments numbers. someone could put an example of arguments for me to use in the / var / log? Thank you. import os, sys from optparse import OptionParser def main(): usage = %prog [options] args parser = OptionParser(usage) parser.add_option(-l, --logfile, dest=logfile, help=Logfile to read data) parser.add_option(-p, --logpos, dest=logpos, help=File to store last log line read position) parser.add_option(-f, --find, dest=findstring, help=String to find in Logfile) (options, args) = parser.parse_args() if options.logfile is None or options.findstring is None or options.logpos is None: print(Incorrect arguments numbers.\n) parser.print_help() sys.exit(-1) else: logfile = options.logfile tofind = options.findstring logpos = options.logpos pos = 0 count = 0 if os.path.isfile(logpos): pos = int(open(logpos).readline() or 0) file = open(logfile) file.seek(pos) for line in file: if line.find(tofind) != -1: count += 1 pos = file.tell() file.close() file = open(logpos, 'w') file.write(str(pos)) file.close() print count if __name__ == '__main__': main() -- http://mail.python.org/mailman/listinfo/python-list
Re: Logwatch python
In article 1de56e5b-4f9b-477d-a1d4-71e7222a2...@googlegroups.com, Cleuson Alves cleuso...@gmail.com wrote: Hello, I am trying to run this code, but I get an answer incorrect arguments numbers. someone could put an example of arguments for me to use in the / var / log? Since the first cave man tried to sort his rock collection into descending order of mastodon kills, people have been inventing really awesome debugging tools. One of the earliest, and still near the top of most people's toolkits is the print statement. You've got: if options.logfile is None or options.findstring is None or options.logpos is None: print(Incorrect arguments numbers.\n) Start by printing out the values of options.logfile, options.findstring, and options.logpos. Then at least you will know which of those three is causing the problem. -- http://mail.python.org/mailman/listinfo/python-list
Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7
On Feb 9, 7:27 pm, Morten Engvoldsen mortene...@gmail.com wrote: Hi Team, I Have saved my output in .doc file and want to format the output with *Start the File Some data here ***End of File* Can you let me know how can i do that using Python? If it were not for the doc file type, its a couple of lines of code to do what you are asking. With doc files however its a bit of a headache. MSOffice doesn't script with python (as far as I know). Best to use whatever it allows -- VBA I guess Libreoffice allows a number of different scripting options including python -- all poorly documented and obsolete. eg http://www.openoffice.org/udk/python/scriptingframework/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7
On 02/09/2013 10:01 AM, Morten Engvoldsen wrote: Hi Davea, I am using Python 2.7. Sorry, I should have noticed the python version in the subject line, but didn't until this reply. How about print outfile, Start the File.center(55, *) after creating the file, and print outfile, Start the File.center(55, *) just before closing it ? -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Alternatives to Splunk?
Yup - its off topic. I was triggered to write here because Splunk is written in Python. And Python is good at Parsing/Regex. Thank you for your response about logstash, kibana. I was looking for such tools only - thank you so much. ---sss On Saturday, February 9, 2013 7:05:57 PM UTC+5:30, Rodrick Brown wrote: On Sat, Feb 9, 2013 at 7:27 AM, sssdevelop sssde...@gmail.com wrote: Are there any opensource alternatives to Splunk? Need tool to analyze the log files.. This is highly off topic, however I'm using logstash + kibana for my log analysis. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Alternatives to Splunk?
Look up any nosql database. At it's heart that is what splunk is built on. Or, if you're working with less than 500mb of data a day, just use the free version of splunk. On Sat, Feb 9, 2013 at 12:09 PM, sssdevelop sssdeve...@gmail.com wrote: Yup - its off topic. I was triggered to write here because Splunk is written in Python. And Python is good at Parsing/Regex. Thank you for your response about logstash, kibana. I was looking for such tools only - thank you so much. ---sss On Saturday, February 9, 2013 7:05:57 PM UTC+5:30, Rodrick Brown wrote: On Sat, Feb 9, 2013 at 7:27 AM, sssdevelop sssde...@gmail.com wrote: Are there any opensource alternatives to Splunk? Need tool to analyze the log files.. This is highly off topic, however I'm using logstash + kibana for my log analysis. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7
On 09/02/2013 14:27, Morten Engvoldsen wrote: Hi Team, I Have saved my output in .doc file and want to format the output with *Start the File Some data here ***End of File* Can you let me know how can i do that using Python? Assuming the .doc file is MS Word see here http://sourceforge.net/projects/pywin32/ as a starter? If you're talking plain text others have already replied. -- Cheers. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Python3 curses behavior
On 2/9/2013 6:23 AM, Vlasov Vitaly wrote: Hello. I found strange behavior of curses module, that i can't understand. I initialize screen with curses.initscr(), then i create subwin of screen with screen.subwin(my_subwin_sizes). After that i fill subwin with my_char in for-loop. On last char in last line subwin.addch() raises exception. I have never used curses but I have used text screens. I suspect that addch moves the cursor to the position beyond where the character is added, but there is no such position. I remember having problems writing to the last char of a 24x80 screen without getting either a scroll or beep if scrolling was disabled. This is my problem. Why? How to fix it? Perhaps this will help: window.leaveok(yes) If yes is 1, cursor is left where it is on update, instead of being at “cursor position.” This reduces cursor movement where possible. If possible the cursor will be made invisible. (If i will ignore exception, then last char will be displayed) Otherwise, just catch the exception, as you already discovered. Here simple example: http://pastebin.com/SjyMsHZB -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7
On 2/9/2013 11:21 AM, rusi wrote: On Feb 9, 7:27 pm, Morten Engvoldsen mortene...@gmail.com wrote: Hi Team, I Have saved my output in .doc file and want to format the output with *Start the File Some data here ***End of File* Can you let me know how can i do that using Python? If it were not for the doc file type, its a couple of lines of code to do what you are asking. With doc files however its a bit of a headache. MSOffice doesn't script with python (as far as I know). It can be with the pythonwin extensions. Best to use whatever it allows -- VBA I guess Libreoffice allows a number of different scripting options including python -- all poorly documented and obsolete. eg http://www.openoffice.org/udk/python/scriptingframework/ LibreOffice 4.0.0, released 2 days ago, upgrades the bundled Python from 2.6 (itself an upgrade) to 3.3! https://www.libreoffice.org/download/4-0-new-features-and-fixes/ One new addition, also from the above ''' LibreLogo vector graphics language: Logo toolbar and interpreter Logoposter en.jpg Turtlegraphics.png Logochessboard.png The lightweight implementation (1400 lines in Python-PyUNO) uses the embedded Python to give a simplified programming interface to the excellent vector graphics of LibreOffice for graphic design and education (including teaching of word processing). ... ''' I am hoping the PyUNO doc will see improvement. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: python3 binascii.hexlify ...
On 09Feb2013 22:26, Chris Angelico ros...@gmail.com wrote: | On Sat, Feb 9, 2013 at 10:10 PM, Peter Otten __pete...@web.de wrote: | Return the hexadecimal representation of the binary data. Every byte of | data is converted into the corresponding 2-digit hex representation. | | | makes it pretty clear that the function is operating on bytes, not str. Well of course. I want a hexadecimal string representation of a chunk of bytes. It should be producing a string. | That doesn't necessarily mean it has to return bytes, though. It's | taking binary data and producing something that's plausibly either | bytes or str. It's human-readable and would definitely make sense to | be str (for instance, hex() returns a str), so imo this should be made | very clear in the docs. Maybe: | | Return the hexadecimal representation of the binary data. Every byte of | data is converted into two bytes with the corresponding hex | representation in ASCII. | | | or somesuch? Only if returning a string would break something relying on hexlify returning bytes. The natural way to write this function is to have it return a string. _If_ there's some dependency in the stdlib, maybe a doc fix would do. But otherwise IMO the function should be returning a string. What is the use case for returning bytes that just _look_ like a string? It is returning a textual representation; without a good reason, that should be a string. -- Cameron Simpson c...@zip.com.au Because of its special customs, crossposting between alt.peeves and normal newsgroups is discouraged. - Cameron Spitzer -- http://mail.python.org/mailman/listinfo/python-list
Re: Alternatives to Splunk?
sssdevelop wrote: Are there any opensource alternatives to Splunk? Need tool to analyze the log files.. Is Google blocked where you are? How about other search engines like DuckDuckGo, Bling, Yahoo, etc? Surely *some* search engine must work. If not, I suggest asking on a mailing list for system administration, not programming languages. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Coercing one object to type of another
Vijay Shanker wrote: Hi Inside a function i get a two arguments, say arg1 and arg2, how can i convert arg2 to same type as arg1 ? I dont know type of arg1 or arg2 for that matter, I just want to convert arg2 to type of arg1 if possible and handle the exception if raised. How do you propose to handle the exception? If arg1 is a dict, and arg2 is an int, what do you think should happen? convert({}, 45) = returns what? If arg1 is a HTTP connection object, and arg2 is a function object, what do you think should happen? import urllib2 conn = urllib2.urlopen(http://www.python.com/;) convert(conn, lambda x: len(x) + 1) = returns what? You cannot convert arbitrary objects of one type into some other arbitrary type, it simply doesn't make sense. So first of all you need to decide: - what kinds of objects do you care about? - when given some other kind of object, how do you propose to deal with it? The usual answer to the second question is raise an exception. Also: int('2') 2 float('2.0') 2.0 coerce(2,2.0) (2.0,2.0) but coerce('2',2) fails.If int('2') equals 2, why should it fail ? Because '2' is a string, not a number, and coerce only operates on numbers. What would you expect coerce(three, 2) to return? How about coerce(apple, 2)? Why do you think you need coerce? What are you actually trying to accomplish? If you have two numbers, normally you would just do arithmetic on them and let Python do any coercion needed. And if you have a number and something else, you can't magically turn non-numbers into numbers. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Is Python programming language?
Grant Edwards invalid@invalid.invalid wrote: IMO, a scripting language is used to automate tasks that would otherwise be done by a human sitting at a keyboard typing commands. [Perhaps that definition should be extended to include tasks that would otherwise by done by a human sitting and clicking on a GUI.] I think that definition is a little too neat and clean. Most people would call bash a scripting language, but it is also clearly a programming language. It has syntax, variables and expressions. I suspect it is Turing-complete, although I haven't seen a proof of that. I would assert that scripting languages are a proper subset of programming languages, not a separate category. -- Tim Roberts, t...@probo.com Providenza Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is Python programming language?
On 02/09/2013 04:26 PM, Tim Roberts wrote: Most people would call bash a scripting language, but it is also clearly a programming language. It has syntax, variables and expressions. I suspect it is Turing-complete, although I haven't seen a proof of that. I would assert that scripting languages are a proper subset of programming languages, not a separate category. I'm pretty sure Bash is turing complete. I know it's been shown that sed is turing complete, and awk probably is too! If I recall, the way to show a language is turing complete is to implement a turing machine in it. I'm pretty sure bash could handle that, though maybe with help from a standard set of unix tools one always finds used in conjunction with the shell. Here's one implementation: https://github.com/thulsadum/bash-turing-machine/blob/master/turing.sh I would say that scripting language isn't a definition of a type of language, but rather a description of how a language is put to use in a particular case. For example, when embedded in a game, lua is used as a scripting language to automate and extend the game in certain ways, by exposing game objects to the lua engine and allowing interpreted lua code to manipulate (script) them. Javascript is the same thing in other programs. But whether you call javascript a scripting language in firefox, or something much more (as it's actualy required for firefox to function at all), is a matter of personal preference really. I've seen python embedded in apps to act as a scripting language before. I've also seen full-blown apps written in python. So yes, the distinction, as made by the original poster, isn't really necessary. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is Python programming language?
On 2/9/2013 6:53 PM, Michael Torrie wrote: On 02/09/2013 04:26 PM, Tim Roberts wrote: Most people would call bash a scripting language, but it is also clearly a programming language. It has syntax, variables and expressions. I suspect it is Turing-complete, although I haven't seen a proof of that. I would assert that scripting languages are a proper subset of programming languages, not a separate category. I'm pretty sure Bash is turing complete. I know it's been shown that sed is turing complete, and awk probably is too! If I recall, the way to show a language is turing complete is to implement a turing machine If the language has arrays, conditional execution, and explicit (while) loops or recursion, you can be pretty sure it is Turing complete. I presume this covers awk and bash. Something like the game of Life, where the looping in implicit in the operation, is much harder to show Turing complete. I suspect sed is non-trivial also. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Is Python programming language?
On 2/9/2013 6:26 PM, Tim Roberts wrote: Grant Edwards invalid@invalid.invalid wrote: IMO, a scripting language is used to automate tasks that would otherwise be done by a human sitting at a keyboard typing commands. [Perhaps that definition should be extended to include tasks that would otherwise by done by a human sitting and clicking on a GUI.] I think that definition is a little too neat and clean. Most people would call bash a scripting language, but it is also clearly a programming language. It has syntax, variables and expressions. I suspect it is Turing-complete, although I haven't seen a proof of that. I would assert that scripting languages are a proper subset of programming languages, not a separate category. To me, 'scripting languages' include some non-Turing-complete languages and I would not call those 'programming languages'. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Is Python programming language?
On 02/09/2013 07:40 PM, Terry Reedy wrote: If the language has arrays, conditional execution, and explicit (while) loops or recursion, you can be pretty sure it is Turing complete. I presume this covers awk and bash. Something like the game of Life, where the looping in implicit in the operation, is much harder to show Turing complete. I suspect sed is non-trivial also. All you have to do to show a language is turing complete is to implement a turing machine in it. Here's one in sed that I found: http://www.catonmat.net/blog/proof-that-sed-is-turing-complete/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Spawn a process, then exit, whilst leaving process running?
On Fri, 08 Feb 2013 21:04:33 -0800, Victor Hooi wrote: I have a Python script that I'd like to spawn a separate process (SSH client, in this case), and then have the script exit whilst the process continues to run. I looked at Subprocess, however, that leaves the script running, and it's more for spawning processes and then dealing with their output. Somebody mentioned multiprocessing, however, I'm not sure quite sure how that would work here. What's the most Pythontic way of achieving this purpose? On Unix, the os.exec* functions might be appropriate, depending upon whether the script needs to do anything afterwards. Otherwise, use subprocess.Popen(). -- http://mail.python.org/mailman/listinfo/python-list
Re: LangWart: Method congestion from mutate multiplicty
On Friday, February 8, 2013 9:36:52 PM UTC-6, Steven D'Aprano wrote: Rick Johnson wrote: The solution is simple. Do not offer the copy-mutate methods and force all mutation to happen in-place: py l = [1,2,3] py l.reverse py l [3,2,1] If the user wants a mutated copy he should explicitly create a new object and then apply the correct mutator method: py a1 = [1,2,3] py a2 = list(a1).reverse() Oh wow, Rick has re-discovered programming in Python during the mid to late 1990s! [...snip: long-winded, rambling, and sarcastic response simply to convey that Python lists have had a reversed method for some time...] Steven, i am quite aware of the Python list method reversed --which returns a copy of the current list object in reversed order--, my point is that these types of copy-mutate methods superfluously pollute the object namespace. Do you really want method pairs like these: sort, sorted reverse, reversed Hell, why stop there: append, appended flatten, flattened insert, inserted map, mapped filter, filtered reduce, reduced extend, extended freeze, frozen set, sat|setted unique, uniqued Is this really what you prefer? Where does the madness end Steven? At what point do you say enough is enough? And what happens if you fail to catch the infection early enough? Steven, this is a /real/ problem which has the potential to go viral! My point was this: All mutate methods should mutate in-place, if the programmer wishes to create a mutated copy of the object, then the programmer should /explicitly/ create a copy of the object and then apply the correct mutator method to the copy. NO: reversed = lst.reversed() # Python YES: reversed = list(lst).reverse() # Python NO: reversed = a.reverse() # Ruby YES: reversed = Array.new(a).reverse!() # Ruby This is about consistency and keeping the number of methods from spiraling out of control because we feel the need to automate /every/ task for the programmer, when in actuality, we are doing more harm than good. -- http://mail.python.org/mailman/listinfo/python-list
Re: LangWart: Method congestion from mutate multiplicty
On Sun, Feb 10, 2013 at 2:54 PM, Rick Johnson rantingrickjohn...@gmail.com wrote: My point was this: All mutate methods should mutate in-place, if the programmer wishes to create a mutated copy of the object, then the programmer should /explicitly/ create a copy of the object and then apply the correct mutator method to the copy. I agree. And we can go further and declare that there is only one data type, the simple integer; you have an infinite number of them, and all you can do is mutate them in place. You don't need variable names either; just have one single array that represents your whole namespace, and work with positions in that array. And don't bother with actual positions, even - with a single pointer, you could manage everything. Forget this silly mess of data types, methods, global functions, and so on. Let's simplify things massively! Ook. Ook! ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Implicit conversion to boolean in if and while statements
On Friday, February 8, 2013 11:01:00 PM UTC-6, Chris Angelico wrote: [...] Another advantage of using two characters: There's no conflict between set and dict literals. How do you notate an empty set in Python? {} means an empty dict. What makes you believe that a language must provide literal syntax for EACH and EVERY type? And BTW, if you don't already know, this is how you notate an empty set in Python: py set([]) set([]) IMO Set Types should only exists as a concequence of freezing an array, and should have NO literal syntax avaiable. -- http://mail.python.org/mailman/listinfo/python-list
Re: Implicit conversion to boolean in if and while statements
On Sun, Feb 10, 2013 at 3:26 PM, Rick Johnson rantingrickjohn...@gmail.com wrote: On Friday, February 8, 2013 11:01:00 PM UTC-6, Chris Angelico wrote: [...] Another advantage of using two characters: There's no conflict between set and dict literals. How do you notate an empty set in Python? {} means an empty dict. What makes you believe that a language must provide literal syntax for EACH and EVERY type? And BTW, if you don't already know, this is how you notate an empty set in Python: py set([]) set([]) Or omit the argument, to avoid working with a pointless empty list. But what happens if you first execute: set = tuple ? This is not a set literal, it's an expression that usually returns a set. IMO Set Types should only exists as a concequence of freezing an array, and should have NO literal syntax avaiable. I don't understand. Wouldn't freezing an array (list) result in a tuple? And, why should there be no literal syntax for them? Having a convenient literal notation for every basic type is extremely handy. You can work with integers 1, 2, 3, or floats 1.0, 2.0, 3.0. C gives you those. In Python, you can work with lists, too, and C doesn't give you those (you have array *initializer* syntax, but that's not the same thing). It's perfectly plausible to dereference a literal: dow = [Sun, Mon, Tue, Wed, Thu, Fri, Sat][day%7] Of course, it's perfectly plausible to do that with a function, too. You could define something like this: def agg(*args): return args dow = agg(Sun, Mon, Tue, Wed, Thu, Fri, Sat)[day%7] But the question is, why? Why call a function when the interpreter can do the work directly at compile stage? There's absolutely no value in forcing things to be done at run-time. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: LangWart: Method congestion from mutate multiplicty
On Sat, Feb 9, 2013 at 8:20 PM, Chris Angelico ros...@gmail.com wrote: On Sun, Feb 10, 2013 at 2:54 PM, Rick Johnson rantingrickjohn...@gmail.com wrote: My point was this: All mutate methods should mutate in-place, if the programmer wishes to create a mutated copy of the object, then the programmer should /explicitly/ create a copy of the object and then apply the correct mutator method to the copy. I agree. And we can go further and declare that there is only one data [sarcasm] I have to agree with Rick, I think requiring the user to explicitly create a new object, which is already a good and widely-used practice, should be the Only One Way to Do It. Guessing method names is far suboptimal to this simple, easy idiom. As for the point Chris was making as to making all types one, I actually agree there too, it's just that in order to do that, python would need a unified object model and it doesn't have one yet. Mark -- http://mail.python.org/mailman/listinfo/python-list
Re: Implicit conversion to boolean in if and while statements
On Friday, February 8, 2013 7:17:26 PM UTC-6, Chris Angelico wrote: On Sat, Feb 9, 2013 at 11:49 AM, Rick Johnson nested_list = array(array(string)) Actually, that's not a declaration, that's an assignment; and in Pike, a 'type' is a thing, same as it is in Python (though not quite). If I were to declare it in Pike, it would be: array(array(string)) nested_list; Though the part inside the parens can be omitted, in which case the array can contain anything, rather than being restricted to strings. In actual fact, Rick, despite your complaints about the syntax, it's able to achieve exactly what you were thinking Python should do: declare an array/list that contains only numbers. Well Chris i have wonderful news for you! Python /does/ have homogenous arrays, and they're called, wait for it. arrays! Imagine that! py import array py intSeq = array.array('i') py intSeq.append(1) py intSeq.append(2) py intSeq.append(5000) py intSeq.append(5000.333) TypeError: integer argument expected, got float py intSeq.append('5000.333') TypeError: an integer is required -- http://mail.python.org/mailman/listinfo/python-list
Re: Implicit conversion to boolean in if and while statements
On Sun, Feb 10, 2013 at 3:54 PM, Rick Johnson rantingrickjohn...@gmail.com wrote: Well Chris i have wonderful news for you! Python /does/ have homogenous arrays, and they're called, wait for it. arrays! Imagine that! That's not a built-in. But you were the one who complained about the way sum() could be applied to a list that contains a non-integer; maybe your solution is simply to ignore sum() and work with array.array? Nice how you can complain about Python for not having something, then heap scorn on me for not being aware that it's there in the stdlib. (Which, by the way, I freely admit to being less than fully familiar with. Even less familiar with what's on PyPI.) ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Implicit conversion to boolean in if and while statements
On Friday, February 8, 2013 7:06:34 PM UTC-6, Ian wrote: On Fri, Feb 8, 2013 at 12:58 PM, Rick Johnson wrote: I'm a bit unnerved by the sum function. Summing a sequence only makes sense if the sequence in question contains /only/ numeric types. For that reason i decided to create a special type for holding Numerics. [...] Of course someone could probably find a legitimate reason to apply a sum method to non-numeric values; if so, then inherit from NumericSequence and create your custom type! Are you aware that the approach you're advocating here is bad OOP design? If you declare a class NumericSequence with the property that it contains only numeric types, and then you declare a subclass NonnumericSequence that does not share that property, then guess what? You've just violated the Liskov Substitution Principle. I totally agree! Really, no sarcasm here O:-) Not only because we would be attempting to bend a numeric type into something it is not, but even more foolishly because the very method we hope to gain (sum) would need to be completely re-written anyway. I must have lost myself in the rant because that was a foolish thing to say. Thanks for pointing this out. The goal you're trying to achieve here is nonsensical anyway. Ask yourself what the semantic meaning of the sum() function is, what purpose it is meant to serve. My answer: it is the reduction of the addition operator. I think that for Numeric Types your answer is spot on! And i'll bet if we ruminated long enough we could probably find a few more transformations of the word sum into unique contexts. But i digress, we'll have to save that synergy for a time when you are buying the beer! ;-) The implication of this is that the input type of the sum() function is not numbers, but rather things that can be added. Indeed. Contrary to what a few folks have stated in this thread, if two different objects have methods named sum, that does NOT mean that we have broken the fine principles of code reuse, no. Why? Because two methods named sum can contain completely different code! Yes, i know that's difficult for some to believe, but it's the truth! Consider a sum method of a Numeric Type compared to the sum method of a Sequence Type. Not only is the algorithm different, but the result is different. Summing N numerics requires utilizing the strict rules of mathematical addition, keeping a running total, and returning a type (Integer) that is different from the input type, whereas summing sequences requires expanding the first sequence with the values of the second sequence (all whilst maintaining linear order) and returning a new instance of the same type (f.e. list). Of course you could write a single monolithic function that can operate on multiple types transparently (*cough* saum!) however: * Nobody can predict the future (at least not yet) so you will eventually encounter a new type that breaks the god @#$% function. * Your language will rely on magic, thereby confusing it's users, with well, magic! * But most disappointing of all: you will break the accepted OOP convention of encapsulation, whereby the object /itself/ should operate on the data, not some outside god @#$% function! But let's dig a little deeper here so we might understand /why/ encapsulation is /so/ gawd @#$%ed important to OOP. Why do we prefer objects to operate on their own data rather than some magical-all-knowing-god-like-creature-from-another-planet-who-thinks-his-bowel-movements-smell-like-bakery-fresh-cinnamon-rolls? Is it because we want objects to feel a sense of belonging or importance? ...OF COURSE NOT! Objects neither think nor feel! We employ encapsulation because by doing so we keep all the relevant code under one class, one module, one package. By doing so we create a hierarchy; and since hierarchies are much easier to search than random sequences, we will thank ourselves later! If you want a fine example of this consider a list and a dict object. If you want to find a value in a list you are forced to search the entire list item-by-item until you find a match; there are NO shortcuts here! However, when we have data in a dict all we need is a key, and voila!, we have a direct path to the item! Same applies to code. RR: GOOD paradigms solve problems when /writing/ code, GREAT paradigms solve problems when writing and /maintaining/ code! That includes numbers, but since I see from your proposed class hierarchy that you are retaining the __add__ method on sequences, it also includes sequences. Are you really going to tell the user that (1, 2, 3) + (4, 5, 6) is perfectly fine, but that the semantic equivalent sum([(1, 2, 3), (4, 5, 6)]) is nonsense? Yes. Because if the user has a problem understanding /why/ adding two sequences together results in a new sequence and /not/ a number, he can simply open the source for the Sequence object, locate the sum method,
Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7
Hi Dave, This sounds great, thanks for your help :) On Sat, Feb 9, 2013 at 6:13 PM, Dave Angel da...@davea.name wrote: On 02/09/2013 10:01 AM, Morten Engvoldsen wrote: Hi Davea, I am using Python 2.7. Sorry, I should have noticed the python version in the subject line, but didn't until this reply. How about print outfile, Start the File.center(55, *) after creating the file, and print outfile, Start the File.center(55, *) just before closing it ? -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
[issue17166] Fix the suggested usage of _dummy_thread module
New submission from Berker Peksag: The dummy_thread module has been renamed to _dummy_thread in Python 3: import dummy_thread Traceback (most recent call last): File stdin, line 1, in module ImportError: No module named 'dummy_thread' -- assignee: docs@python components: Documentation files: _dummy_thread-usage.diff keywords: patch messages: 181721 nosy: berker.peksag, docs@python priority: normal severity: normal status: open title: Fix the suggested usage of _dummy_thread module versions: Python 3.2, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file29015/_dummy_thread-usage.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17166 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17167] python man page contains $Date$ in page footer
New submission from Ned Deily: The center footer in the source for the python man page, specifically the .th macro in Misc/python.man, contains an unexpanded $Date$ left over from the days of svn keyword expansions. Since hg does not support such expansions, either the source should be edited to remove the keyword or the date should be expanded during builds. One possibility would be to add sed edit steps to the altmaninstall makefile target and to release.py --export. -- components: Build messages: 181722 nosy: benjamin.peterson, georg.brandl, ned.deily priority: normal severity: normal stage: needs patch status: open title: python man page contains $Date$ in page footer versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17167 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16686] audioop overflow issues
Roundup Robot added the comment: New changeset 6add6ac6a802 by Serhiy Storchaka in branch '2.7': Issue #16686: Fixed a lot of bugs in audioop module. http://hg.python.org/cpython/rev/6add6ac6a802 New changeset 104b17f8316b by Serhiy Storchaka in branch '3.2': Issue #16686: Fixed a lot of bugs in audioop module. http://hg.python.org/cpython/rev/104b17f8316b New changeset 63b164708e60 by Serhiy Storchaka in branch '3.3': Issue #16686: Fixed a lot of bugs in audioop module. http://hg.python.org/cpython/rev/63b164708e60 New changeset 48747ef5f65b by Serhiy Storchaka in branch 'default': Issue #16686: Fixed a lot of bugs in audioop module. http://hg.python.org/cpython/rev/48747ef5f65b -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16686 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16686] audioop overflow issues
Serhiy Storchaka added the comment: I fixed yet one bug in avgpp() and remove my XXX comment. *All* audioop functions are unsafe regarding unaligned access. I'll open a new issue for this. -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16686 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16686] audioop overflow issues
Serhiy Storchaka added the comment: *All* audioop functions are unsafe regarding unaligned access. Actually this is not true because currently audioop functions work only with bytes (and str, see issue16685) and not with arbitrary memoryview. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16686 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17147] BytesIO should be mentioned in SpooledTemporaryFile documentation
Roundup Robot added the comment: New changeset fb4ed16f35bd by Serhiy Storchaka in branch '3.2': Issue #17147. Mention BytesIO in SpooledTemporaryFile documentation. http://hg.python.org/cpython/rev/fb4ed16f35bd New changeset 8f772825029f by Serhiy Storchaka in branch '3.3': Issue #17147. Mention BytesIO in SpooledTemporaryFile documentation. http://hg.python.org/cpython/rev/8f772825029f New changeset c75d065a6bc2 by Serhiy Storchaka in branch 'default': Issue #17147. Mention BytesIO in SpooledTemporaryFile documentation. http://hg.python.org/cpython/rev/c75d065a6bc2 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17147 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17147] BytesIO should be mentioned in SpooledTemporaryFile documentation
Serhiy Storchaka added the comment: Thank you for corrections Éric. -- assignee: docs@python - serhiy.storchaka resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17147 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10355] SpooledTemporaryFile's name property is broken
Roundup Robot added the comment: New changeset 5c2ff6e64c47 by Serhiy Storchaka in branch '2.7': Issue #10355: SpooledTemporaryFile properties and xreadline method now work for unrolled files. http://hg.python.org/cpython/rev/5c2ff6e64c47 New changeset dfc6902b63d7 by Serhiy Storchaka in branch '3.2': Issue #10355: SpooledTemporaryFile properties now work for unrolled files. http://hg.python.org/cpython/rev/dfc6902b63d7 New changeset f36d8ba4eeef by Serhiy Storchaka in branch '3.3': Issue #10355: SpooledTemporaryFile properties now work for unrolled files. http://hg.python.org/cpython/rev/f36d8ba4eeef New changeset f1a13191f0c8 by Serhiy Storchaka in branch 'default': Issue #10355: SpooledTemporaryFile properties now work for unrolled files. http://hg.python.org/cpython/rev/f1a13191f0c8 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10355 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17168] test.support 3.x docs mentions stringio.stringio
New submission from Ramchandra Apte: StringIO.StringIO has been renamed to io.StringIO in 3.x. Attached is a patch with the corrected version which mentions io.StringIO. -- assignee: docs@python components: Documentation files: issue.patch keywords: patch messages: 181729 nosy: docs@python, ramchandra.apte priority: normal severity: normal status: open title: test.support 3.x docs mentions stringio.stringio Added file: http://bugs.python.org/file29016/issue.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17168 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17157] issubclass() should accept iterables in 2nd arg
Ramchandra Apte added the comment: Just so you know, I'm neutral on this idea. I think it should at least accept sequences though. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17157 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17156] Tools/i18n/pygettext.py doesn't parse unicode string.
Serhiy Storchaka added the comment: Default encoding on Python 3 is UTF-8. You should declare your encoding at the top of file if it differs from UTF-8 or ASCII (i.e. # -*- coding: euc-jp -*-). Otherwise Python will reject your file (for Shift_JIS and EUC-JP) or produce incorrect result (for ISO-2022-JP). $ python3 konnichiha.Shift_JIS.py File konnichiha.Shift_JIS.py, line 5 SyntaxError: Non-UTF-8 code starting with '\x82' in file konnichiha.Shift_JIS.py on line 5, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details $ python3 konnichiha.ISO-2022-JP.py konnichiha B$3$s$K$A$O -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17156 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10355] SpooledTemporaryFile's name property is broken
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10355 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17152] Array module should support boolean natively
Mark Dickinson added the comment: There's already a fairly well known 3rd-party library for this: http://pypi.python.org/pypi/bitarray/ I'd be -1 on putting something like this in the standard library: the array module doesn't get enough maintenance as it is, and a packed bit array sounds like a specialist need. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17152 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7358] cStringIO not 64-bit safe
Roundup Robot added the comment: New changeset a025b04332fe by Serhiy Storchaka in branch '2.7': Issue #7358: cStringIO.StringIO now supports writing to and reading from http://hg.python.org/cpython/rev/a025b04332fe -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7358 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17136] ctypes tests fail with clang on non-OS X
Dirkjan Ochtman added the comment: libffi now has this fix: https://github.com/atgreen/libffi/commit/6a790129427121f7db2d876e7218a3104e6d2741 Can someone test with that? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17136 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17168] test.support 3.x docs mentions stringio.stringio
Ramchandra Apte added the comment: Please commit or review. This is *very* trivial. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17168 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17166] Fix the suggested usage of _dummy_thread module
Ramchandra Apte added the comment: LGTM. -- nosy: +ramchandra.apte ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17166 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17157] issubclass() should accept iterables in 2nd arg
Franck Michea added the comment: I am neutral on this too, it just felt odd and this is why the question raised. Yesterday I tried to add sequences and iterables (only to issubclass but indeed it would need better testing and all) and came to a problem with sequences. The current implementation authorizes (A, (B, (C, D))) (why?) so issubclass is recursive, but if we add sequences, they could create infinite recursions if seq[0] == seq (it's the case for strings for example, where 'a' is still a sequence and 'a'[0] == 'a'). So I don't know if it's really interesting. Anyone can use tuple() on an iterable to build its tuple value, though the value is built in memory. It basically just felt odd to take only tuples but I don't know. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17157 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17168] test.support 3.x docs mentions stringio.stringio
Roundup Robot added the comment: New changeset 474296d6d4a1 by Benjamin Peterson in branch '3.3': StringIO.StringIO - io.StringIO (closes #17168) http://hg.python.org/cpython/rev/474296d6d4a1 New changeset 87e95b853be2 by Benjamin Peterson in branch 'default': merge 3.3 (#17168) http://hg.python.org/cpython/rev/87e95b853be2 -- nosy: +python-dev resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17168 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17169] Restore errno in tempfile exceptions
New submission from Serhiy Storchaka: Before 3.3 if not able to create the name of the temporary file then an OSError with meaninful errno (ENOENT or EEXIST) was raised. Now subclass of OSError raised with errno=None. This is an incompatible change because old user code can catch OSError exception and then test its errno. Here is a patch which restores errno attribute in these exceptions. -- components: Library (Lib) files: tempfile_errno.patch keywords: 3.3regression, patch messages: 181739 nosy: flox, georg.brandl, ncoghlan, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Restore errno in tempfile exceptions type: behavior versions: Python 3.3, Python 3.4 Added file: http://bugs.python.org/file29017/tempfile_errno.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17169 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17156] Tools/i18n/pygettext.py doesn't parse unicode string.
umedoblock added the comment: python3 output translate Japanese with pygettext.install(). EVERYTHING IS OK! please check to use a konnichiha.2.tar.gz. == please do below shell command. $ for f in `find . -name 'konnichiha.*.py'` ; do echo f=$f ; python3 $f ; echo -- ; done f=./konnichiha.Shift_JIS.py HELLO ハローで、今日は 日本語をUTF8にしてコンニチハ -- f=./konnichiha.UTF-8.py HELLO ハローで、今日は 日本語をUTF8にしてコンニチハ -- f=./konnichiha.ISO-2022-JP.py HELLO ハローで、今日は 日本語をUTF8にしてコンニチハ -- f=./konnichiha.EUC-JP.py HELLO ハローで、今日は 日本語をUTF8にしてコンニチハ -- == konnichiha script encoding is OK! $ nkf -g ./konnichiha.*.py ./konnichiha.EUC-JP.py: EUC-JP ./konnichiha.ISO-2022-JP.py: ISO-2022-JP ./konnichiha.Shift_JIS.py: Shift_JIS ./konnichiha.UTF-8.py: UTF-8 == also coding: is OK! $ head -2 konnichiha.*.py == konnichiha.EUC-JP.py == # coding: euc-jp import gettext == konnichiha.ISO-2022-JP.py == # coding: iso-2022-jp import gettext == konnichiha.Shift_JIS.py == # coding: shift-jis import gettext == konnichiha.UTF-8.py == # coding: utf-8 import gettext == THANK YOU serhiy.storchaka ! -- Added file: http://bugs.python.org/file29018/konnichiha.2.tar.gz ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17156 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7358] cStringIO not 64-bit safe
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7358 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17170] string replace is too slow
New submission from Guido van Rossum: I'm trying to speed up a web template engine and I find that the code needs to do a lot of string replacements of this form: name = name.replace('_', '-') Characteristics of the data: the names are relatively short (1-10 characters usually), and the majority don't contain a '_' at all. For this combination I've found that the following idiom is significantly faster: if '_' in name: name = name.replace('_', '-') I'd hate for that idiom to become popular. I looked at the code (in the default branch) briefly, but it is already optimized for this case. So I am at a bit of a loss to explain the speed difference... Some timeit experiments: bash-3.2$ ./python.exe -m timeit -s a = 'hundred' 'x' in a ./python.exe -m timeit -s a = 'hundred' 'x' in a bash-3.2$ ./python.exe -m timeit -s a = 'hundred' a.replace('x', 'y') ./python.exe -m timeit -s a = 'hundred' a.replace('x', 'y') bash-3.2$ ./python.exe -m timeit -s a = 'hundred' if 'x' in a: a.replace('x', 'y') ./python.exe -m timeit -s a = 'hundred' if 'x' in a: a.replace('x', 'y') bash-3.2$ ./python.exe -m timeit -s a = 'hunxred' a.replace('x', 'y') ./python.exe -m timeit -s a = 'hunxred' a.replace('x', 'y') bash-3.2$ ./python.exe -m timeit -s a = 'hunxred' if 'x' in a: a.replace('x', 'y') ./python.exe -m timeit -s a = 'hunxred' if 'x' in a: a.replace('x', 'y') -- components: Interpreter Core messages: 181741 nosy: gvanrossum priority: normal severity: normal status: open title: string replace is too slow type: performance versions: Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17170 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17170] string replace is too slow
Antoine Pitrou added the comment: Characteristics of the data: the names are relatively short (1-10 characters usually) $ ./python -m timeit -s a = 'hundred' 'x' in a 1000 loops, best of 3: 0.0431 usec per loop $ ./python -m timeit -s a = 'hundred' a.find('x') 100 loops, best of 3: 0.206 usec per loop $ ./python -m timeit -s a = 'hundred' a.replace('x', 'y') 1000 loops, best of 3: 0.198 usec per loop Basically, it's simply the overhead of method calls over operator calls. You only see it because the strings are very short, and therefore the cost of finding / replacing is tiny. -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17170 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17170] string method lookup is too slow
Guido van Rossum added the comment: Hm, you seem to be right. Changing the bug title. So, can we speed up method lookup? It's a shame that I have to start promoting this ugly idiom. There's a similar issue where s[:5]=='abcde' is faster than s.startswith('abcde'): ./python.exe -m timeit -s a = 'hundred' a.startswith('foo') 100 loops, best of 3: 0.281 usec per loop ./python.exe -m timeit -s a = 'hundred' a[:3] == 'foo' 1000 loops, best of 3: 0.158 usec per loop -- title: string replace is too slow - string method lookup is too slow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17170 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17170] string method lookup is too slow
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti, serhiy.storchaka versions: +Python 3.4 -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17170 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17170] string method lookup is too slow
Serhiy Storchaka added the comment: There are two overheads: an attribute lookup and a function call. $ ./python -m timeit -s a = 'hundred' 'x' in a 1000 loops, best of 3: 0.0943 usec per loop $ ./python -m timeit -s a = 'hundred' a.__contains__('x') 100 loops, best of 3: 0.271 usec per loop $ ./python -m timeit -s a = 'hundred' a.__contains__ 1000 loops, best of 3: 0.135 usec per loop Time of a.__contains__('x') is greater than the sum of times of a.__contains__ and 'x' in a. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17170 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16038] ftplib: unlimited readline() from connection
Michał Jastrzębski added the comment: Hello, I've set up maxline limit to 8192. Also I've add some changes Antoine suggested earlier. -- Added file: http://bugs.python.org/file29019/ftplib_maxline.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16038 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17169] Restore errno in tempfile exceptions
Senthil Kumaran added the comment: The patch looks good and it is correct thing to do IMO. thanks. -- nosy: +orsenthil ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17169 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16564] email.generator.BytesGenerator fails with bytes payload
Roundup Robot added the comment: New changeset 30f92600df9d by R David Murray in branch '2.7': #16564: test to confirm behavior that regressed in python3. http://hg.python.org/cpython/rev/30f92600df9d New changeset a1a04f76d08c by R David Murray in branch '3.2': #16564: Fix regression in use of encoders.encode_noop with binary data. http://hg.python.org/cpython/rev/a1a04f76d08c New changeset 2b1edefc1e99 by R David Murray in branch '3.3': Merge: #16564: Fix regression in use of encoders.encode_noop with binary data. http://hg.python.org/cpython/rev/2b1edefc1e99 New changeset 5a0478bd5f11 by R David Murray in branch 'default': Merge: #16564: Fix regression in use of encoders.encode_noop with binary data. http://hg.python.org/cpython/rev/5a0478bd5f11 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16564 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17171] email.encoders.encode7or8bit does not work with binary data
New submission from R. David Murray: Reported by Serhiy in issue 16564: import io, email bytesdata = b'\xfa\xfb\xfc\xfd\xfe\xff' msg = email.mime.application.MIMEApplication(bytesdata, _encoder=encoders.encode_7or8bit) s = io.BytesIO() g = email.generator.BytesGenerator(s) g.flatten(msg) Traceback (most recent call last): File stdin, line 1, in module File /home/serhiy/py/cpython3.2/Lib/email/generator.py, line 91, in flatten self._write(msg) File /home/serhiy/py/cpython3.2/Lib/email/generator.py, line 137, in _write self._dispatch(msg) File /home/serhiy/py/cpython3.2/Lib/email/generator.py, line 163, in _dispatch meth(msg) File /home/serhiy/py/cpython3.2/Lib/email/generator.py, line 393, in _handle_text if _has_surrogates(msg._payload): TypeError: can't use a string pattern on a bytes-like object -- components: email messages: 181748 nosy: barry, r.david.murray priority: normal severity: normal stage: needs patch status: open title: email.encoders.encode7or8bit does not work with binary data versions: Python 3.2, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17171 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16564] email.generator.BytesGenerator fails with bytes payload
R. David Murray added the comment: I've opened issue 17171 for the similar encode7or8bit problem. -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16564 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13555] cPickle MemoryError when loading large file (while pickle works)
Serhiy Storchaka added the comment: Here is an updated patch. Fixed two bugs found by Antoine (an inappropriate format and a memory error in bigmemtest), fixed resizing of marks array and one possible integer overflow in write_other(). Used workaround to bypass limitations of cStringIO API. -- assignee: - serhiy.storchaka stage: needs patch - patch review Added file: http://bugs.python.org/file29020/pickle_overflow-3.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13555 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17166] Fix the suggested usage of _dummy_thread module
Roundup Robot added the comment: New changeset 6af3afbc7211 by R David Murray in branch '3.2': #17166: fix _dummy_thread import example. http://hg.python.org/cpython/rev/6af3afbc7211 New changeset dfefae8df4f7 by R David Murray in branch '3.3': Merge: #17166: fix _dummy_thread import example. http://hg.python.org/cpython/rev/dfefae8df4f7 New changeset c4512797b879 by R David Murray in branch 'default': Merge: #17166: fix _dummy_thread import example. http://hg.python.org/cpython/rev/c4512797b879 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17166 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17166] Fix the suggested usage of _dummy_thread module
R. David Murray added the comment: Thanks, Berker. -- nosy: +r.david.murray resolution: - fixed stage: - committed/rejected status: open - closed type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17166 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17170] string method lookup is too slow
Antoine Pitrou added the comment: Indeed the function call cost actually dominates: $ ./python -m timeit -s a = 'hundred' a.find('x') 100 loops, best of 3: 0.206 usec per loop $ ./python -m timeit -s a = 'hundred'; f=a.find f('x') 1000 loops, best of 3: 0.176 usec per loop $ ./python -m timeit -s a = 'hundred' 'x' in a 1000 loops, best of 3: 0.0431 usec per loop -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17170 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17170] string method lookup is too slow
Antoine Pitrou added the comment: Some crude C benchmarking on this computer: - calling PyUnicode_Replace is 35 ns (per call) - calling hundred.replace is 125 ns - calling PyArg_ParseTuple with the same signature as hundred.replace is 80 ns Therefore, most of the overhead (125 - 35 = 90 ns) is in calling PyArg_ParseTuple() to unpack the method arguments. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17170 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16956] Allow signed line number deltas in the code object's line number table
Changes by Xavier de Gaye xdeg...@gmail.com: -- nosy: +xdegaye ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16956 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17170] string method lookup is too slow
Serhiy Storchaka added the comment: And PyArg_ParseTupleAndKeywords() is even more slow. $ ./python -m timeit str(b'', 'utf-8', 'strict') 100 loops, best of 3: 0.554 usec per loop $ ./python -m timeit str(object=b'', encoding='utf-8', errors='strict') 100 loops, best of 3: 1.74 usec per loop -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17170 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17169] Restore errno in tempfile exceptions
Roundup Robot added the comment: New changeset 11eaa61124c2 by Serhiy Storchaka in branch '3.3': Issue #17169: Restore errno in tempfile exceptions. http://hg.python.org/cpython/rev/11eaa61124c2 New changeset fd3e3059381a by Serhiy Storchaka in branch 'default': Issue #17169: Restore errno in tempfile exceptions. http://hg.python.org/cpython/rev/fd3e3059381a -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17169 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17172] Add turtledemo to IDLE menu
New submission from Raymond Hettinger: The turtledemo is an on-ramp for younger programmers and we should make it easy to launch. -- components: IDLE keywords: easy messages: 181757 nosy: rhettinger priority: normal severity: normal stage: needs patch status: open title: Add turtledemo to IDLE menu type: enhancement versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17172 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17156] Tools/i18n/pygettext.py doesn't parse unicode string.
Roundup Robot added the comment: New changeset 49b1fde510a6 by Serhiy Storchaka in branch '2.7': Issue #17156: pygettext.py now correctly escapes non-ascii characters. http://hg.python.org/cpython/rev/49b1fde510a6 New changeset cd59b398907d by Serhiy Storchaka in branch '3.2': Issue #17156: pygettext.py now uses an encoding of source file and correctly http://hg.python.org/cpython/rev/cd59b398907d New changeset 062406c06cc1 by Serhiy Storchaka in branch '3.3': Issue #17156: pygettext.py now uses an encoding of source file and correctly http://hg.python.org/cpython/rev/062406c06cc1 New changeset 99795d711a40 by Serhiy Storchaka in branch 'default': Issue #17156: pygettext.py now uses an encoding of source file and correctly http://hg.python.org/cpython/rev/99795d711a40 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17156 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17156] Tools/i18n/pygettext.py doesn't parse unicode string.
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17156 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17169] Restore errno in tempfile exceptions
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17169 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17043] Invalid read in test_codecs
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17043 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17173] uses of locale-dependent ctype functions
New submission from Antoine Pitrou: Grepping through the code reveals we are still using a number of locale-dependent C library functions: Python/mystrtoul.c:102:while (*str isspace(Py_CHARMASK(*str))) Python/mystrtoul.c:141:while (isspace(Py_CHARMASK(*str))) Python/mystrtoul.c:269:while (*str isspace(Py_CHARMASK(*str))) Python/formatter_unicode.c:404:while (posend isdigit(PyUnicode_READ_CHAR(s, pos))) Python/ast.c:3764:if (isalpha(quote)) { Python/dynload_aix.c:144:while (isdigit(Py_CHARMASK(*message[i]))) message[i]++ ; Objects/longobject.c:2011:while (*str != '\0' isspace(Py_CHARMASK(*str))) Objects/longobject.c:2255:while (*str isspace(Py_CHARMASK(*str))) Modules/getaddrinfo.c:228:if (! isdigit(*q)) Modules/_sre.c:153:#define SRE_LOC_IS_DIGIT(ch) (!((ch) ~255) ? isdigit((ch)) : 0) Modules/_sre.c:154:#define SRE_LOC_IS_SPACE(ch) (!((ch) ~255) ? isspace((ch)) : 0) Modules/_sre.c:156:#define SRE_LOC_IS_ALNUM(ch) (!((ch) ~255) ? isalnum((ch)) : 0) Modules/binascii.c:1138:if (isdigit(c)) Modules/_decimal/libmpdec/io.c:153:if (!isdigit((uchar)*s)) Modules/_decimal/libmpdec/io.c:157:if (!isdigit((uchar)*(s+1))) Modules/_decimal/libmpdec/io.c:159: isdigit((uchar)*(s+2 Modules/_decimal/libmpdec/io.c:185:while (isdigit((uchar)*s)) Modules/_decimal/libmpdec/io.c:825:if (isdigit((uchar)*cp)) { Modules/_decimal/libmpdec/io.c:847:if (!isdigit((uchar)*cp)) { Modules/_decimal/libmpdec/io.c:1087:assert(isdigit((uchar)*dp)); Modules/_decimal/libmpdec/io.c:1089:while (isdigit((uchar)*dp)) { Modules/_decimal/libmpdec/io.c:1244:if (isupper((uchar)type)) { Modules/_struct.c:1273:if (isspace(Py_CHARMASK(c))) Modules/_struct.c:1338:if (isspace(Py_CHARMASK(c))) Include/pyctype.h has locale-agnostic counterpart (a bit faster probably, too). -- components: Extension Modules, Interpreter Core messages: 181759 nosy: mark.dickinson, pitrou, serhiy.storchaka, skrah priority: normal severity: normal status: open title: uses of locale-dependent ctype functions type: behavior versions: Python 3.2, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17173 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17173] uses of locale-dependent ctype functions
Raymond Hettinger added the comment: +1 for fixing this everywhere. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17173 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17170] string method lookup is too slow
Antoine Pitrou added the comment: Here is a patch yielding a decent speedup (~ 40%) on PyArg_ParseTuple itself. More generally though, this would be improved by precompiling some of the information (like Argument Clinic does, perhaps). (note: PyArg_ParseTupleAndKeywords is a completely separate implementation...) -- keywords: +patch Added file: http://bugs.python.org/file29021/getargs_freelist.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17170 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17170] string method lookup is too slow
Changes by Serhiy Storchaka storch...@gmail.com: -- stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17170 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com