Re: Finding the name of a function while defining it
Abhas Bhattacharya writes: [...] If i call one() and two() respectively, i would like to see one and two. I dont have much knowledge of lambda functions, neither am i going to use them, so that's something I cant answer. It's not about lambda. The following does not contain lambda. What should be name(one)? name(two)? name(foo)? name(fun(1))? name(fun(3))? def foo(): return 3 def fun(x): def foo(): return x return foo one = fun(1) two = one Note that fun(1)() is a valid call where fun(1) is not given any name outside fun. -- http://mail.python.org/mailman/listinfo/python-list
Re: email.message.Message - as_string fails
On Fri, 28 Dec 2012 20:57:46 -0500, Terry Reedy wrote: On 12/28/2012 7:22 AM, Helmut Jarausch wrote: Hi, I'm trying to filter an mbox file by removing some messages. For that I use Parser= FeedParser(policy=policy.SMTP) and 'feed' any lines to it. If the mbox file contains a white line followed by '^From ', I do Msg= Parser.close() (lateron I delete the Parser and create a new one by Parser= FeedParser(policy=policy.SMTP) ) I can access parts of the message by Msg['Message-ID'], e.g. but even for the very first message, trying to print it or convert it to a string by MsgStr=Msg.as_string(unixfrom=True) lets Python (3.3.1_pre20121209) die with Traceback (most recent call last): File Email_Parse.py, line 35, in module MsgStr=Msg.as_string(unixfrom=True) File /usr/lib64/python3.3/email/message.py, line 151, in as_string g.flatten(self, unixfrom=unixfrom) File /usr/lib64/python3.3/email/generator.py, line 112, in flatten self._write(msg) File /usr/lib64/python3.3/email/generator.py, line 171, in _write self._write_headers(msg) File /usr/lib64/python3.3/email/generator.py, line 198, in _write_headers self.write(self.policy.fold(h, v)) File /usr/lib64/python3.3/email/policy.py, line 153, in fold return self._fold(name, value, refold_binary=True) File /usr/lib64/python3.3/email/policy.py, line 176, in _fold (len(lines[0])+len(name)+2 maxlen or IndexError: list index out of range The only list index visible is 0 in lines[0]. If this raises, lines is empty. You could trace back to see where lines is defined. I suspect it is all or part of the Msg you started with. I believe that some of email was rewritten for 3.3, so it is possible that you found a bug based on an untrue assumption. It is also possible that you missed a limitation in the doc, or tripped over an intended but not written limitation. So I hope you do the tracing, so if doc or code need a fix, a tracker issue can be opened. Thanks Terry, I've debugged it and it smells like a bug. I have created http://bugs.python.org/issue16811 Helmut. -- http://mail.python.org/mailman/listinfo/python-list
Re: Facing issue with Python loggin logger for printing object value
Hi Dave, Thanks for reply. I will really appreciate if you reply to my mail id and keep python list in cc, since everytime you reply my query i need to search the reply in the forwarding message of python list. Using logger.setLevel(logging.DEBUG) will log only debug message in the log file and discard other message from log file. So that's not solving the issue of my problem. I am looking into code to find out the issue. Thanks again for your effort -- http://mail.python.org/mailman/listinfo/python-list
Re: Facing issue with Python loggin logger for printing object value
On Sat, Dec 29, 2012 at 11:39 PM, Morten Engvoldsen mortene...@gmail.com wrote: Hi Dave, Thanks for reply. I will really appreciate if you reply to my mail id and keep python list in cc, since everytime you reply my query i need to search the reply in the forwarding message of python list. The normal thing to do with a mailing list is, as I'm doing here, replying to the list. You'll get a copy of the email from the list (or the newsgroup, if you subscribe that way), and it's much easier for all concerned. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: PYTHON 3.3 + GUI + COMPILE
On Fri, Dec 28, 2012 at 3:08 AM, Dimitrios Xenakis gouzouna...@hotmail.com wrote: Morning, I have been looking for a library solution of both GUI and Compiler but for Python 3.3 and ofcourse i was hoping for a combination that would be most compatible between them. After searching i may have concluded to cx_Freeze (because it was the only one that noticed that currently supports version Python 3.3), but i do not know what GUI library should i combine it with. Does cx_Freeze alone put any kind of restriction to my choice of GUI? I would also be interested in using my programs for commercial purposes, so would this put again some other kind of limitations to my GUI choice? I have read many good stuff about PySide, but still i do not know wether this is the one that i should choose. Is PySide same as PyQT and PyQT4 and QT or which is the exact relationship between those? Disadvantages - advantages, capabilities, benefits, costs, etc. (What is the lowest possible cost of buying such a commercial license for my programming?. Are there different versions and should i be carefull to choose the best for me? Where could i get this from? PySide is total free for my commercial needs?) I need to be legit so i guess i should learn how to handle with the licencing thing. Please somebody clear things for me. Thanks 4 your time i really appreciate that. -- http://mail.python.org/mailman/listinfo/python-list cx_Freeze has nothing to do with GUIs, so it will work, no matter what. --- PySide is a newer Python binding for the Qt framework (version 4), developed by Openbossa, available under the LGPL license, meaning there is no licensing problem for your commercial needs. PyQt4 is an older binding by Riverbank Computing (Qt 4), available under GPL or a commercial license, meaning you need to (a) go open-source; or (b) pay a lot of money. PyQt is the general name for PyQt4 and PyQt3, and you should not use PyQt3. Qt is a GUI development framework for C++, with bindings for many languages, including Python. Also, the main difference for developers is the module name. That’s it. Now, I am a huge Qt advocate, but you may also want to look at other toolkits, such as wxWidgets, GTK+ or Tck/Tk. wxWidgets is a great multi-platform toolkit with a nice Python binding, Tcl/Tk is an ugly non-native toolkit, while GTK+ is a huge mess that I suggest to avoid for your own sanity. -- Kwpolska http://kwpolska.tk stop html mail | always bottom-post www.asciiribbon.org | www.netmeister.org/news/learn2quote.html GPG KEY: 5EAAEA16 -- http://mail.python.org/mailman/listinfo/python-list
Re: Confused about logger config from within Python (3)
In article 50de7a0a$0$29967$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: In Python 3.2 and 3.3, the message about no handlers is not printed, which is an interesting difference. (Somebody who knows more about the logging package than I do might be able to state why that difference.) I hope that means that http://bugs.python.org/issue994421 has finally been fixed :-) -- http://mail.python.org/mailman/listinfo/python-list
Re: noob can't install python modules/scripts
On Fri, Dec 28, 2012 at 11:40 PM, lostguru aznjedi...@gmail.com wrote: On Friday, December 28, 2012 11:12:19 PM UTC-5, Steven D'Aprano wrote: The website? There's more than one website on the Internet. Which website are you referring to? What .py script did you download? How did you run it? Details are important! sorry about that; I was using the setuptools package from pypi python [ http://pypi.python.org/pypi/setuptools ]; I downloaded the ez_setup.py file from under the 64-bit windows installation section and ran that (by double clicking on it, I hope this wasn't another noob mistake lol) It looks like you tried to run the easy_install command from inside the Python interactive interpreter, rather than from your system shell. The system shell (command.com or cmd.exe I guess) will have a $ or % sign as the prompt. Python usually has as the prompt, although if you are running ActivePython it may be something else. You need to run the easy_install BeautifulSoup4 command from the system shell, not Python. Try that, and if there's another error, please copy and paste the exact command you used, and the full error message. running easy_install from the command line worked and BeautifulSoup4 seems to have installed, thanks for pointing out my mistake the only problem I have now is that importing beautifulsoup into a .py file I wrote generates an error (I'm using ActiveState Komodo Edit 7, is there another program you would recommend to a beginner like me?) trying to run the script gives an import error: ImportError: No module named BeautifulSoup You should read the BeautifulSoup tutorial/documentation. If I remember correctly you do from bs4 import BeautifulSoup Look at this tutorial to get started: http://www.crummy.com/software/BeautifulSoup/bs4/doc/ importing other modules like os and urllib that came with the python installation work without problems looking online, all I've found were other accounts talking about a beautifulsoup.py that should be in the C:\Python27\Lib\site-packages directory, but I've found no such thing from the installation anywhere in the Python folder (funnily enough, I did a drive search with Everything and found a BeautifulSoup.py in my autodesk maya installation) am I somewhere near the mark? or am I off completely? -- http://mail.python.org/mailman/listinfo/python-list -- Joel Goldstick -- http://mail.python.org/mailman/listinfo/python-list
Re: noob can't install python modules/scripts
On Saturday, December 29, 2012 9:33:59 AM UTC-5, Joel Goldstick wrote: You should read the BeautifulSoup tutorial/documentation. If I remember correctly you do from bs4 import BeautifulSoup Look at this tutorial to get started: http://www.crummy.com/software/BeautifulSoup/bs4/doc/ ah got it, I was told to use import -modulename- for pretty much everything by a classmate; I'll definitely look into the documentation thanks again for the help guys -- http://mail.python.org/mailman/listinfo/python-list
Re: Facing issue with Python loggin logger for printing object value
On 12/29/2012 07:39 AM, Morten Engvoldsen wrote: Hi Dave, Thanks for reply. I will really appreciate if you reply to my mail id and keep python list in cc, since everytime you reply my query i need to search the reply in the forwarding message of python list. I won't be able to remember to special-case your account, but maybe for the next few days. Far too many others have complained when they get an email directly, either by sending me a request message, by using an address at the invalid domain, by hijacking some bogus email address, or by having an autoreply that says Please don't try to contact me at this address. For a while I considered adding all such people to a kill-file, but decided I'd miss too much. I suggest you get used to reading all messages, or to simply following the thread. (For example, Thunderbird can keep all messages together which are replies to each other) And while I've got you, it'd be nice if you used reply-list yourself, instead of starting a new thread each time. Using logger.setLevel(logging.DEBUG) will log only debug message in the log file and discard other message from log file. So that's not solving the issue of my problem. I am looking into code to find out the issue. That's not what setLevel() does. It's a = comparison, not an == one. http://docs.python.org/2/library/logging Logger.setLevel(lvl) Sets the threshold for this logger to lvl. Logging messages which are less severe than lvl will be ignored. Perhaps you should also read the page: http://docs.python.org/dev/howto/logging search for the phrase increasing order of severity where it lists the 5 levels, in order. The default level for the root logger is WARNING, so it ignores DEBUG and INFO messages. I suggested changing it to DEBUG, so those won't get ignored. You probably need to write a 10-line self-contained program to experiment with this, and run it outside of openerp. Chances are openerp is doing something special that you need to conform to. But I'm not going to be able to guess that. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Inserting Unicode chars in Entry widget
Hello Python experts, I want to insert Unicode chars in an Entry widget by pushing on buttons; one for each Unicode character I need. I have made the Unicode buttons. I just need a simple function that will send the Unicode character to the Entry widget. Is there a better approach? Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Facing issue with Python loggin logger for printing object value
Hi Dave, Thanks a lot for your reply. I have used logging.setLevel(logger.DEBUG) because of threshold as you said. I didn't copy paste the entire program since it was very huge. The batch which value i am trying to retrieve is in a a for loop : for payment in payment_line: but here payment_line has null value since it was not able to retrieve payment line value from the payment object. So i would like to know if payment_line has null value, will it be enter into for loop since i was able to log message which is before the for loop but the message inside the for loop i am not able to log. Thanks again... :) On Sat, Dec 29, 2012 at 5:41 PM, Dave Angel d...@davea.name wrote: On 12/29/2012 07:39 AM, Morten Engvoldsen wrote: Hi Dave, Thanks for reply. I will really appreciate if you reply to my mail id and keep python list in cc, since everytime you reply my query i need to search the reply in the forwarding message of python list. I won't be able to remember to special-case your account, but maybe for the next few days. Far too many others have complained when they get an email directly, either by sending me a request message, by using an address at the invalid domain, by hijacking some bogus email address, or by having an autoreply that says Please don't try to contact me at this address. For a while I considered adding all such people to a kill-file, but decided I'd miss too much. I suggest you get used to reading all messages, or to simply following the thread. (For example, Thunderbird can keep all messages together which are replies to each other) And while I've got you, it'd be nice if you used reply-list yourself, instead of starting a new thread each time. Using logger.setLevel(logging.DEBUG) will log only debug message in the log file and discard other message from log file. So that's not solving the issue of my problem. I am looking into code to find out the issue. That's not what setLevel() does. It's a = comparison, not an == one. http://docs.python.org/2/library/logging Logger.setLevel(lvl) Sets the threshold for this logger to lvl. Logging messages which are less severe than lvl will be ignored. Perhaps you should also read the page: http://docs.python.org/dev/howto/logging search for the phrase increasing order of severity where it lists the 5 levels, in order. The default level for the root logger is WARNING, so it ignores DEBUG and INFO messages. I suggested changing it to DEBUG, so those won't get ignored. You probably need to write a 10-line self-contained program to experiment with this, and run it outside of openerp. Chances are openerp is doing something special that you need to conform to. But I'm not going to be able to guess that. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Inserting Unicode chars in Entry widget
On Sun, Dec 30, 2012 at 3:43 AM, Alan Graham alan.l.gra...@gmail.com wrote: Hello Python experts, I want to insert Unicode chars in an Entry widget by pushing on buttons; one for each Unicode character I need. I have made the Unicode buttons. I just need a simple function that will send the Unicode character to the Entry widget. Is there a better approach? What GUI toolkit are you using? Whatever it is, there ought to be a simple method on the Entry widget that inserts a character. Poke around with it and you'll probably find it, though you may find it under a name you don't expect. (Happens a lot. GTK calls something sensitive when the rest of the world calls it enabled.) ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Facing issue with Python loggin logger for printing object value
On Sun, Dec 30, 2012 at 3:54 AM, Morten Engvoldsen mortene...@gmail.com wrote: but here payment_line has null value since it was not able to retrieve payment line value from the payment object. Specifically what value? Is it an empty string? An empty list? The singleton None? ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Facing issue with Python loggin logger for printing object value
On 12/29/2012 11:54 AM, Morten Engvoldsen wrote: Hi Dave, Thanks a lot for your reply. I have used logging.setLevel(logger.DEBUG) because of threshold as you said. I didn't copy paste the entire program since it was very huge. The batch which value i am trying to retrieve is in a a for loop : for payment in payment_line: but here payment_line has null value since it was not able to retrieve payment line value from the payment object. The closest thing Python has to null value is called None. If payment_line is None, then you'll get an exception on that loop. As I said a while ago, I have no idea how openerp handles exceptions. Maybe it's just doing a bare except, and ignoring anything that goes wrong in your functions. (Very bad practice) It could be that payment_line is an empty list. In that case, the loop will execute zero times. That would also explain the lack of output. So if openerp gives you no debugging aid, then you may have to fake it with the logger. How about logging a simple message just before the loop? logger.debug(value of payment_line is + repr(payment_line)) Did you ever fix the other things wrong with that create method? Like using log.debug when the object was called logger? Or incrementing line_counter when there was no such variable, and when it would vanish when you exited the method anyway? -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Inserting Unicode chars in Entry widget
On 29-12-2012 17:43, Alan Graham wrote: Hello Python experts, I want to insert Unicode chars in an Entry widget by pushing on buttons; one for each Unicode character I need. I have made the Unicode buttons. I just need a simple function that will send the Unicode character to the Entry widget. Is there a better approach? Alan Not sure what the question is. A better approach to doing what? I assuming you're doing tkinter (it is helpful if you mention the toolkit when posting a question). I'd create a function that you bind to all 'unicode buttons', and let the function insert the correct character depending on which button triggered it. A possible way to do that is to use a lambda with a different parameter for every button, like this: b1=Button(f, text='char1', command=lambda b=1: insert_char(b)) b2=Button(f, text='char2', command=lambda b=2: insert_char(b)) ...etc.. def insert_char(b): if b==1: entrywidget.insert(0, u\u20ac) # inserts € in the entry widget e elif b==2: entrywidget.insert(0, ...some other char...) ... Or simply define a different command function for every button, then you don't have to use the lambda. -irmen -- http://mail.python.org/mailman/listinfo/python-list
Re: Inserting Unicode chars in Entry widget
On Sun, Dec 30, 2012 at 4:11 AM, Irmen de Jong irmen.nos...@xs4all.nl wrote: b1=Button(f, text='char1', command=lambda b=1: insert_char(b)) b2=Button(f, text='char2', command=lambda b=2: insert_char(b)) ...etc.. def insert_char(b): if b==1: entrywidget.insert(0, u\u20ac) # inserts € in the entry widget e elif b==2: entrywidget.insert(0, ...some other char...) ... I'm not familiar with tkinter syntax, but why not: b1=Button(f, text='char1', command=lambda: insert_char(1)) b2=Button(f, text='char2', command=lambda: insert_char(2)) or even: b1=Button(f, text='char1', command=lambda: insert_char(u\u20ac)) b2=Button(f, text='char2', command=lambda: insert_char(... some other char...)) Seems weird to multiplex like that, but if there's a good reason for it, sure. I'm more of a GTK person than tkinter, and more of a command-line guy than either of the above. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: New to python, do I need an IDE or is vim still good enough?
On 12/27/2012 12:01 PM, mogul wrote: I'm new to python, got 10-20 years perl and C experience, all gained on unix alike machines hacking happily in vi, and later on in vim. Do I really need a real IDE, as the windows guys around me say I do, or will vim, git, make and other standalone tools make it the next 20 years too for me? If you've been using vi/vim happily, then I'd assume you're fully comfortable setting it up to do what ever you need. In that case... I'd say stick with what you know. Me, I have less 'invested' in any particular editor or environment, and I certainly don't 'need' a lot of the fancy extras that a lot of IDEs have... but setting up pydev/eclipse or spyder takes care of pretty much all that I need/want easily, and I can setup a fresh environment the way I want inside five minutes with a mouse, fairly intuitively, without having to go digging through config scripts and the web and books and such to figure out what does what. I'd rather spend that time working on projects, not 'programming' my text editor. It's neat and all if it works for you, but just doesn't turn my crank, personally. I know a lot is made of the speed with which things can be done with vim and similar pure text editors... which is all well and good, but somewhere in the not-so-distant past I saw a comment which hit home for me. Maybe its because I'm still just a hobbyist when it comes to coding, but I spend far more time 'thinking' about what I'm doing than typing things in... so shaving a few seconds here and there are less important to me. YMMV, Monte -- http://mail.python.org/mailman/listinfo/python-list
Re: New to python, do I need an IDE or is vim still good enough?
On Sun, Dec 30, 2012 at 4:44 AM, Monte Milanuk memila...@gmail.com wrote: Maybe its because I'm still just a hobbyist when it comes to coding, but I spend far more time 'thinking' about what I'm doing than typing things in... so shaving a few seconds here and there are less important to me. The value of a good editor isn't just in saving seconds. A couple of examples: * Bracket matching helps to catch errors. Especially helpful when combined with... * Language-sensitive auto-indentation. If the editor detects that the last line isn't complete (maybe you opened a parenthesis that you didn't close... ... like that...) and automatically indents, then you have instant feedback, before you even run the program. * Rapid location of relevant code. In SciTE, I can put the cursor on a word and hit Ctrl-F3 to search for other occurrences of it - for instance, put the cursor on a function name and find its definition. (A strict declare-before-use policy helps here, as you can be fairly sure that the first occurrence of that word will be the one you want.) * Highlighting of comments and quoted strings, including all the esoteric rules about line continuation and nesting. Several of these points are more important to the polyglot than to someone who uses only one language ever. For instance, in Python and C, this would show an error, but in bash and PHP, it's not: asdf qwer The difficulty of debugging varies directly with the time between making and discovering the error. Finding a problem by compiling, running, and using a program is good (better than it staying till production); finding that same problem while you're in the compilation stage is better; finding it right at that instant while you're typing makes the correction trivial. That's why spell-checkers have migrated from press Ctrl-Q to check this document to red squiggly lines underneath your text if the computer thinks it's wrong. (That said, the number of spelling errors in published documents hasn't gone down since red squigglies were invented, so instant feedback isn't a panacea!) Of course, editors are as much a matter of taste as they are science... ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Facing issue with Python loggin logger for printing object value
Hi Dev, Thanks a lot Dev for your reply. It is really a great help. Yes i have fixed what was wrong in the create method like log.debug. I have declared line_counter=1 before the for loop. i will try now to chcek the value of payment_line. Thanks again a lot. I am greateful be a member of this forum :) On Sat, Dec 29, 2012 at 6:10 PM, Dave Angel d...@davea.name wrote: On 12/29/2012 11:54 AM, Morten Engvoldsen wrote: Hi Dave, Thanks a lot for your reply. I have used logging.setLevel(logger.DEBUG) because of threshold as you said. I didn't copy paste the entire program since it was very huge. The batch which value i am trying to retrieve is in a a for loop : for payment in payment_line: but here payment_line has null value since it was not able to retrieve payment line value from the payment object. The closest thing Python has to null value is called None. If payment_line is None, then you'll get an exception on that loop. As I said a while ago, I have no idea how openerp handles exceptions. Maybe it's just doing a bare except, and ignoring anything that goes wrong in your functions. (Very bad practice) It could be that payment_line is an empty list. In that case, the loop will execute zero times. That would also explain the lack of output. So if openerp gives you no debugging aid, then you may have to fake it with the logger. How about logging a simple message just before the loop? logger.debug(value of payment_line is + repr(payment_line)) Did you ever fix the other things wrong with that create method? Like using log.debug when the object was called logger? Or incrementing line_counter when there was no such variable, and when it would vanish when you exited the method anyway? -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Keeping a Tkinter GUI alive during a long running process
On 2012-12-21, Kevin Walzer k...@codebykevin.com wrote: I maintain a Tkinter application that's a front-end to to a package manger, and I have never been able to find a way to keep the app from locking up at some point during the piping in of the package manager's build output into a text widget. At some point the buffer is overwhelmed and the app simply can't respond anymore, or writes data to the text widget after locking up for a period. I've long used the typical Tkinter design pattern of opening a pipe to the external command, and letting it do its thing. However, after a time, this locks up the app. If I try to throttle the buffer with some combination of update or after or update_idletasks, that keeps the data flowing, but it comes in too slowly and keeps flowing in long after the external process has terminated. Isn't there a way in Tkinter to have a file descriptor produce an event whenever it becomes readble? http://stackoverflow.com/questions/3348757/how-to-make-tkinter-repond-events-while-waiting-socket-data -- Grant Edwards grant.b.edwardsYow! ... he dominates the at DECADENT SUBWAY SCENE. gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: New to python, do I need an IDE or is vim still good enough?
On 2012-12-27, mogul morten.gulda...@gmail.com wrote: I'm new to python, got 10-20 years perl and C experience, all gained on unix alike machines hacking happily in vi, and later on in vim. Now it's python, and currently mainly on my kubuntu desktop. Do I really need a real IDE, as the windows guys around me say I do, No. or will vim, git, make and other standalone tools make it the next 20 years too for me? I've been writing Python programs for 10-12 years, and I use the same IDE I use for everything else: Emacs, svn/git/whatever and a command line. I do use the meld visual diff program quite a bit... -- Grant Edwards grant.b.edwardsYow! As President I have at to go vacuum my coin gmail.comcollection! -- http://mail.python.org/mailman/listinfo/python-list
Re: New to python, do I need an IDE or is vim still good enough?
On 12/29/2012 12:44 PM, Monte Milanuk wrote: Maybe its because I'm still just a hobbyist when it comes to coding, but I spend far more time 'thinking' about what I'm doing than typing things in... so shaving a few seconds here and there are less important to me. I think the general idea is that with editors like Vim you don't get distracted by having to do some kind of an editor task, letting you keep your full attention on the code logic. For instance, if I need to change a block inside parens, I type ci) (stands for change inside parens), while with a regular editor I'd have to do it manually and by the time I'm done, I'd forget the bigger picture of what I'm doing with the code. Another example: ap stands for indent a paragraph (separated by blank lines). And there are many dozens if not hundreds such commands that let you stay focused on the logic of your code. The trade-off, of course, is that you have to remember all (or most) of the commands, but I figured if I spend the next 20-30+ years programming in some version of Vim, it's well worth the initial investment. By the way, to help me remember the commands, I wrote a small script that lets me type in a few characters of a command or its description and filters out the list of matching commands. It really helps, especially when I change a lot of my mappings. - mitya -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Inserting Unicode chars in Entry widget
On 29-12-2012 18:23, Chris Angelico wrote: On Sun, Dec 30, 2012 at 4:11 AM, Irmen de Jong irmen.nos...@xs4all.nl wrote: b1=Button(f, text='char1', command=lambda b=1: insert_char(b)) b2=Button(f, text='char2', command=lambda b=2: insert_char(b)) ...etc.. def insert_char(b): if b==1: entrywidget.insert(0, u\u20ac) # inserts € in the entry widget e elif b==2: entrywidget.insert(0, ...some other char...) ... I'm not familiar with tkinter syntax, but why not: b1=Button(f, text='char1', command=lambda: insert_char(1)) b2=Button(f, text='char2', command=lambda: insert_char(2)) or even: b1=Button(f, text='char1', command=lambda: insert_char(u\u20ac)) b2=Button(f, text='char2', command=lambda: insert_char(... some other char...)) Seems weird to multiplex like that, but if there's a good reason for it, sure. I'm more of a GTK person than tkinter, and more of a command-line guy than either of the above. ChrisA You're right there's nothing special about tkinter there, I was copying some existing code a bit too literally. Simplify the lambdas as needed. :) Irmen -- http://mail.python.org/mailman/listinfo/python-list
Re: Py 3.3, unicode / upper()
Le mercredi 19 décembre 2012 16:33:50 UTC+1, Christian Heimes a écrit : I think Python 3.3+ is using uppercase mapping (uc) instead of simple upper case (suc). I think you are thinking correctly. This a clever answer. Note: I do not care about the uc / suc choice. As long there is consistency, I'm fine with the choice. Anyway, the only valid programming technique on that field is to create a dedicated lib for a given script (esp. French!) jmf Some background: The old German Fractur has three variants of the letter S: capital s: S long s: ſ round s: s. ß is a ligature of ſs. ſ is usually used at the beginning or middle of a syllable while s is used at the end of a syllable. Compare Wachſtube (Wach-Stube == guard room) to Wachstube (Wachs-Tube == tube of wax). :) Christian -- http://mail.python.org/mailman/listinfo/python-list
dict comprehension question.
Newbie question. I've googled a little and haven't found the answer. Given a list like: w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1] I would like to be able to do the following as a dict comprehension. a = {} for x in w: a[x] = a.get(x,0) + 1 results in a having the value: {1: 3, 2: 2, 3: 1, 4: 2, 5: 1, 6: 1} I've tried a few things eg a1 = {x:self.get(x,0)+1 for x in w} results in error messages. And a2 = {x:a2.get(x,0)+1 for x in w} also results in error messages. Trying to set a variable to a dict before doing the comprehension a3 = {} a3 = {x:a3.get(x,0)+1 for x in w} gets this result, which isn't what I wanted. {1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1} I'm not sure that it's possible to do this, and if not, perhaps the most obvious question is what instance does the get method bind to? TIA -- http://mail.python.org/mailman/listinfo/python-list
Re: New to python, do I need an IDE or is vim still good enough?
Monte Milanuk memila...@gmail.com wrote: Maybe its because I'm still just a hobbyist when it comes to coding, but I spend far more time 'thinking' about what I'm doing than typing things in... If more professional programmers spent more time thinking and less type typing, the world would be a better place. Keep doing what you're doing. Really. Chris Angelico ros...@gmail.com wrote: [regarding Bracket matching Language-sensitive auto-indentation and automatically indents Yeah, what he said, plus syntax coloring. And keyword highlighting. And autocompletion of variable names. And parsing of error messages. I'll pause a moment to let that sink in. Grok the fullness of just how awesome a feature it is. In emacs, for example. I'll do C-C M (which I have bound to M-X Compile). This runs a command and captures the output in a buffer. If the output happens to contain something like: Traceback (most recent call last): File /home/roy/production/python/local/lib/python2.7/site-packages/nose/case. py, line 197, in runTest self.test(*self.arg) File /home/roy/songza/api2/test_api2.py, line 16, in test_get_api data = requests.get(url('api/v2/')).json File /home/roy/songza/api2/test_common.py, line 13, in url assert route.startswith('/') AssertionError emacs will parse that, highlight the filenames and line numbers and if I type M-`, it'll take me to the line of the next error (including opening the file if it's not already open). I assume other smart editors have similar capabilities. Different tools have different combinations of these, or slightly different implementations. Find one you like and learn all of it's capabilities. It makes a huge difference in how productive you are. -- http://mail.python.org/mailman/listinfo/python-list
Re: dict comprehension question.
In article 724d4fea-606a-4503-b538-87442f6bc...@ci3g2000vbb.googlegroups.com, Quint Rankid qbr...@gmail.com wrote: Newbie question. I've googled a little and haven't found the answer. Given a list like: w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1] I would like to be able to do the following as a dict comprehension. a = {} for x in w: a[x] = a.get(x,0) + 1 Why are you trying to do this mind-blowing thing? Other than as an entry in an obfuscated code contest, what is this for? Anyway, I don't think this is possible with a dict comprehension. Entries in the dict depend on entries previously put into the dict. I don't see any way a dict comprehension can deal with this. -- http://mail.python.org/mailman/listinfo/python-list
Re: dict comprehension question.
On 12/29/2012 02:48 PM, Quint Rankid wrote: Newbie question. I've googled a little and haven't found the answer. Given a list like: w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1] I would like to be able to do the following as a dict comprehension. a = {} for x in w: a[x] = a.get(x,0) + 1 results in a having the value: {1: 3, 2: 2, 3: 1, 4: 2, 5: 1, 6: 1} I've tried a few things eg a1 = {x:self.get(x,0)+1 for x in w} results in error messages. And a2 = {x:a2.get(x,0)+1 for x in w} also results in error messages. Trying to set a variable to a dict before doing the comprehension a3 = {} a3 = {x:a3.get(x,0)+1 for x in w} gets this result, which isn't what I wanted. {1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1} I'm not sure that it's possible to do this, and if not, perhaps the most obvious question is what instance does the get method bind to? TIA Will this do?: w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1] {x: w.count(x) for x in w} {1: 3, 2: 2, 3: 1, 4: 2, 5: 1, 6: 1} - mitya -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ -- http://mail.python.org/mailman/listinfo/python-list
Re: dict comprehension question.
On 12/29/2012 03:01 PM, Mitya Sirenef wrote: On 12/29/2012 02:48 PM, Quint Rankid wrote: Newbie question. I've googled a little and haven't found the answer. Given a list like: w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1] I would like to be able to do the following as a dict comprehension. a = {} for x in w: a[x] = a.get(x,0) + 1 results in a having the value: {1: 3, 2: 2, 3: 1, 4: 2, 5: 1, 6: 1} I've tried a few things eg a1 = {x:self.get(x,0)+1 for x in w} results in error messages. And a2 = {x:a2.get(x,0)+1 for x in w} also results in error messages. Trying to set a variable to a dict before doing the comprehension a3 = {} a3 = {x:a3.get(x,0)+1 for x in w} gets this result, which isn't what I wanted. {1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1} I'm not sure that it's possible to do this, and if not, perhaps the most obvious question is what instance does the get method bind to? TIA Will this do?: w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1] {x: w.count(x) for x in w} {1: 3, 2: 2, 3: 1, 4: 2, 5: 1, 6: 1} - mitya I should probably add that this might be inefficient for large lists as it repeats count for each item. If you need it for large lists, profile against the 'for loop' version and decide if performance is good enough for you, for small lists it's a nice and compact solution. In a more general case, you can't refer to the list/dict/etc comprehension as it's being constructed, that's just not a design goal of comprehensions. -m -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ -- http://mail.python.org/mailman/listinfo/python-list
Re: dict comprehension question.
On Sat, Dec 29, 2012 at 3:09 PM, Mitya Sirenef msire...@lightbird.netwrote: On 12/29/2012 03:01 PM, Mitya Sirenef wrote: On 12/29/2012 02:48 PM, Quint Rankid wrote: Newbie question. I've googled a little and haven't found the answer. Given a list like: w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1] I would like to be able to do the following as a dict comprehension. a = {} for x in w: a[x] = a.get(x,0) + 1 results in a having the value: {1: 3, 2: 2, 3: 1, 4: 2, 5: 1, 6: 1} I've tried a few things eg a1 = {x:self.get(x,0)+1 for x in w} results in error messages. And a2 = {x:a2.get(x,0)+1 for x in w} also results in error messages. Trying to set a variable to a dict before doing the comprehension a3 = {} a3 = {x:a3.get(x,0)+1 for x in w} gets this result, which isn't what I wanted. {1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1} I'm not sure that it's possible to do this, and if not, perhaps the most obvious question is what instance does the get method bind to? TIA Will this do?: w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1] {x: w.count(x) for x in w} {1: 3, 2: 2, 3: 1, 4: 2, 5: 1, 6: 1} - mitya I should probably add that this might be inefficient for large lists as it repeats count for each item. If you need it for large lists, profile against the 'for loop' version and decide if performance is good enough for you, for small lists it's a nice and compact solution. In a more general case, you can't refer to the list/dict/etc comprehension as it's being constructed, that's just not a design goal of comprehensions. Would this help: w = [1,2,3,1,2,4,4,5,6,1] s = set(w) s set([1, 2, 3, 4, 5, 6]) {x:w.count(x) for x in s} {1: 3, 2: 2, 3: 1, 4: 2, 5: 1, 6: 1} -m -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ -- http://mail.python.org/**mailman/listinfo/python-listhttp://mail.python.org/mailman/listinfo/python-list -- Joel Goldstick -- http://mail.python.org/mailman/listinfo/python-list
Re: dict comprehension question.
Quint Rankid wrote: Newbie question. I've googled a little and haven't found the answer. Given a list like: w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1] I would like to be able to do the following as a dict comprehension. a = {} for x in w: a[x] = a.get(x,0) + 1 results in a having the value: {1: 3, 2: 2, 3: 1, 4: 2, 5: 1, 6: 1} I've tried a few things eg a1 = {x:self.get(x,0)+1 for x in w} results in error messages. And a2 = {x:a2.get(x,0)+1 for x in w} also results in error messages. Trying to set a variable to a dict before doing the comprehension a3 = {} a3 = {x:a3.get(x,0)+1 for x in w} gets this result, which isn't what I wanted. {1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1} I'm not sure that it's possible to do this, and if not, perhaps the most obvious question is what instance does the get method bind to? The name a3 will not be rebound until after the right side is evaluate. To spell it with a loop: a3 = {} _internal = {} # You have no access to this var. # Even if you can beat a particular # Python implementation -- you shouldn't for x in w: _internal[x] = a3.get(x, 0) + 1 a3 = _internal That should make it clear that x will be looked up in the old empty a3 dict. The closest you can get to a self-updating dict is probably w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1] a1 = {} a1.update((x, a1.get(x, 0)+1) for x in w) a1 {1: 3, 2: 2, 3: 1, 4: 2, 5: 1, 6: 1} but that it works doesn't mean it is a good idea. If your Python version supports it the obvious choice is from collections import Counter w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1] Counter(w) Counter({1: 3, 2: 2, 4: 2, 3: 1, 5: 1, 6: 1}) -- http://mail.python.org/mailman/listinfo/python-list
Re: dict comprehension question.
On 2012-12-29 19:48, Quint Rankid wrote: Newbie question. I've googled a little and haven't found the answer. Given a list like: w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1] I would like to be able to do the following as a dict comprehension. a = {} for x in w: a[x] = a.get(x,0) + 1 results in a having the value: {1: 3, 2: 2, 3: 1, 4: 2, 5: 1, 6: 1} I've tried a few things eg a1 = {x:self.get(x,0)+1 for x in w} results in error messages. And a2 = {x:a2.get(x,0)+1 for x in w} also results in error messages. Trying to set a variable to a dict before doing the comprehension a3 = {} a3 = {x:a3.get(x,0)+1 for x in w} gets this result, which isn't what I wanted. {1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1} I'm not sure that it's possible to do this, and if not, perhaps the most obvious question is what instance does the get method bind to? You can't do it with a comprehension. The best way is probably with the 'Counter' class: w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1] from collections import Counter Counter(w) Counter({1: 3, 2: 2, 4: 2, 3: 1, 5: 1, 6: 1}) If you want the result be a dict, then just the result to 'dict': dict(Counter(w)) {1: 3, 2: 2, 3: 1, 4: 2, 5: 1, 6: 1} -- http://mail.python.org/mailman/listinfo/python-list
new pipeline manager, feedback welcome
Hi all, I hope this post can be of interest to someone of you. I'm the developer of a pipeline management system called Leaf (the Python library is called pyleaf). While initially developed for internal use only at my dpt., we tried to make it a decent standalone tool for everyone interested. You can find it at www.neuronelab.dmi.unisa.it/leaf. Briefly, a pipeline manager is basically a system that helps you automating common tasks that arise in a pipes-and-filters processing context. That is: you have some data and want to process them through different series of cascading filters (python functions). Example: / filter1 - filter2 data \ filter3 The example above is actually in Leaf language and can be exploited directly in a Python environment thanks to the library pyleaf. Other nice pipeline managers exist, like Ruffus, but this ASCII-art approach is peculiar to Leaf. We use the tool on a daily basis and are quite happy with it, but feedback from different users would be of great help to improve its stability and usability. Pyleaf sources are available on git-hub, that also supports an issue tracker (empty at the moment): https://github.com/franapoli/pyleaf Thank you very much in advance for your interest. Any feedback appreciated. Cheers, Francesco. -- http://mail.python.org/mailman/listinfo/python-list
Re: Facing issue with Python loggin logger for printing object value
Hi Dave, It is able to log the message with: logger.debug(value of payment_line is +repr(payment_line)) The output is: value of payment_line is [] So it means payment_line is an empty list, so may be it could be reason it's not able to enter into the loop since the message in the for loop is not logged in the log file. Thanks and good night.. :) On Sat, Dec 29, 2012 at 7:38 PM, Morten Engvoldsen mortene...@gmail.comwrote: Hi Dev, Thanks a lot Dev for your reply. It is really a great help. Yes i have fixed what was wrong in the create method like log.debug. I have declared line_counter=1 before the for loop. i will try now to chcek the value of payment_line. Thanks again a lot. I am greateful be a member of this forum :) On Sat, Dec 29, 2012 at 6:10 PM, Dave Angel d...@davea.name wrote: On 12/29/2012 11:54 AM, Morten Engvoldsen wrote: Hi Dave, Thanks a lot for your reply. I have used logging.setLevel(logger.DEBUG) because of threshold as you said. I didn't copy paste the entire program since it was very huge. The batch which value i am trying to retrieve is in a a for loop : for payment in payment_line: but here payment_line has null value since it was not able to retrieve payment line value from the payment object. The closest thing Python has to null value is called None. If payment_line is None, then you'll get an exception on that loop. As I said a while ago, I have no idea how openerp handles exceptions. Maybe it's just doing a bare except, and ignoring anything that goes wrong in your functions. (Very bad practice) It could be that payment_line is an empty list. In that case, the loop will execute zero times. That would also explain the lack of output. So if openerp gives you no debugging aid, then you may have to fake it with the logger. How about logging a simple message just before the loop? logger.debug(value of payment_line is + repr(payment_line)) Did you ever fix the other things wrong with that create method? Like using log.debug when the object was called logger? Or incrementing line_counter when there was no such variable, and when it would vanish when you exited the method anyway? -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: New to python, do I need an IDE or is vim still good enough?
On 12/29/2012 11:52 AM, Roy Smith wrote: Chris Angelico ros...@gmail.com wrote: [regarding Bracket matching Language-sensitive auto-indentation and automatically indents Yeah, what he said, plus syntax coloring. And keyword highlighting. And autocompletion of variable names. I'll probably get dog-piled by the vim/emacs folks again here... but isn't that something most decent text editors do? On 12/29/2012 11:52 AM, Roy Smith wrote: And parsing of error messages. I'll pause a moment to let that sink in. Grok the fullness of just how awesome a feature it is. In emacs, for example. I'll do C-C M (which I have bound to M-X Compile). This runs a command and captures the output in a buffer. If the output happens to contain something like: Traceback (most recent call last): File /home/roy/production/python/local/lib/python2.7/site-packages/nose/case. py, line 197, in runTest self.test(*self.arg) File /home/roy/songza/api2/test_api2.py, line 16, in test_get_api data = requests.get(url('api/v2/')).json File /home/roy/songza/api2/test_common.py, line 13, in url assert route.startswith('/') AssertionError emacs will parse that, highlight the filenames and line numbers and if I type M-`, it'll take me to the line of the next error (including opening the file if it's not already open). I assume other smart editors have similar capabilities. Different tools have different combinations of these, or slightly different implementations. Find one you like and learn all of it's capabilities. It makes a huge difference in how productive you are. While I probably don't use the vast majority of the 'fancy' features of most IDEs - most of what I do barely requires any real 'project manangement'... there are a couple things that I've gotten *very* used to with an IDE. One is having it run pylint and pep8 checks against code, display the output in a friendly format with links straight to the offending items and even displaying colored carats in the gutter region and high-lighting them. The other is having it parse my imports, and use them for the 'auto-complete' aka 'code intelligence' features - and not just the standard library stuff, but also GUI toolkits like PyQt4. I'm pretty sure those things can be done, or something fairly close at least, in editors like vim or emacs... but the few times I looked into it for vim, it was enough to send me running back to Eclipse/PyDev, even if it is kind of an 800lb gorilla otherwise. It's still on my 'one of these days' list of things to do, though ;) -- http://mail.python.org/mailman/listinfo/python-list
Re: Facing issue with Python loggin logger for printing object value
On 12/29/2012 03:50 PM, Morten Engvoldsen wrote: Hi Dave, It is able to log the message with: logger.debug(value of payment_line is +repr(payment_line)) The output is: value of payment_line is [] So it means payment_line is an empty list, so may be it could be reason it's not able to enter into the loop since the message in the for loop is not logged in the log file. Thanks and good night.. :) You can easily test how iteration over empty list works: l=[] for x in l: print(x) ... i.e. nothing is printed because loop runs 0 times. -m -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Facing issue with Python loggin logger for printing object value
In article mailman.1442.1356814265.29569.python-l...@python.org, Morten Engvoldsen mortene...@gmail.com wrote: It is able to log the message with: logger.debug(value of payment_line is +repr(payment_line)) As a side note, a better way to write that is logger.debug(value of payment_line is %r, payment_line) The difference is that the first way, repr(payment_line) is evaluated, and the string addition is done, before debug() is called. Only then will it be decided if message should be logged, and if not, it will be discarded. The second way, payment_line will just get passed to debug(). If the message is never logged, repr() will never get called. Much more efficient that way, especially for debug calls which most of the time will not get logged. -- http://mail.python.org/mailman/listinfo/python-list
Re: New to python, do I need an IDE or is vim still good enough?
On Sun, Dec 30, 2012 at 6:52 AM, Roy Smith r...@panix.com wrote: Chris Angelico ros...@gmail.com wrote: [regarding Bracket matching Language-sensitive auto-indentation and automatically indents Yeah, what he said, plus syntax coloring. And keyword highlighting. And autocompletion of variable names. Syntax coloring I kinda touched on in different pieces; keyword highlighting isn't, imho, all that important. Apart from reminding you that the variable name you planned to use is an obscure keyword, it doesn't save all that much time. Auto-complete is handy, but not critical. And parsing of error messages. I'll pause a moment to let that sink in. Grok the fullness of just how awesome a feature it is. And how glaring an omission from my list. Yes. This one *definitely* belongs there. Though unlike most of the other examples, it's not as language-specific; you can cover a huge number of utilities by simply recognizing: filename:line: message Coupled with a helpful C compiler, this lets you jump around pretty easily. For instance, gcc will (if I recall correctly - haven't had to use this feature in a while, something to do with writing more code in Python and Pike than C, but anyway), if the arguments to a function mismatch, show error lines highlighting both the invocation *and* the declaration, so you can quickly compare (even if they're in different files). emacs will parse that, highlight the filenames and line numbers and if I type M-`, it'll take me to the line of the next error (including opening the file if it's not already open). I assume other smart editors have similar capabilities. Yeah, SciTE has F4 and Shift-F4 to cycle forwards/backwards through messages, and I expect it's pretty much standard among editors that can invoke external tools. It's extremely handy; not only errors from compilation/execution, but things like a 'git grep -n' fit too. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: dict comprehension question.
On 12/29/2012 03:15 PM, Joel Goldstick wrote: On Sat, Dec 29, 2012 at 3:09 PM, Mitya Sirenef msire...@lightbird.net mailto:msire...@lightbird.net wrote: On 12/29/2012 03:01 PM, Mitya Sirenef wrote: On 12/29/2012 02:48 PM, Quint Rankid wrote: Newbie question. I've googled a little and haven't found the answer. Given a list like: w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1] I would like to be able to do the following as a dict comprehension. a = {} for x in w: a[x] = a.get(x,0) + 1 results in a having the value: {1: 3, 2: 2, 3: 1, 4: 2, 5: 1, 6: 1} I've tried a few things eg a1 = {x:self.get(x,0)+1 for x in w} results in error messages. And a2 = {x:a2.get(x,0)+1 for x in w} also results in error messages. Trying to set a variable to a dict before doing the comprehension a3 = {} a3 = {x:a3.get(x,0)+1 for x in w} gets this result, which isn't what I wanted. {1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1} I'm not sure that it's possible to do this, and if not, perhaps the most obvious question is what instance does the get method bind to? TIA Will this do?: w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1] {x: w.count(x) for x in w} {1: 3, 2: 2, 3: 1, 4: 2, 5: 1, 6: 1} - mitya I should probably add that this might be inefficient for large lists as it repeats count for each item. If you need it for large lists, profile against the 'for loop' version and decide if performance is good enough for you, for small lists it's a nice and compact solution. In a more general case, you can't refer to the list/dict/etc comprehension as it's being constructed, that's just not a design goal of comprehensions. Would this help: w = [1,2,3,1,2,4,4,5,6,1] s = set(w) s set([1, 2, 3, 4, 5, 6]) {x:w.count(x) for x in s} {1: 3, 2: 2, 3: 1, 4: 2, 5: 1, 6: 1} Indeed, this is much better -- I didn't think of it.. -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ -- http://mail.python.org/mailman/listinfo/python-list
Re: New to python, do I need an IDE or is vim still good enough?
In article mailman.1446.1356816523.29569.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: Auto-complete is handy, but not critical. You just wait until your finger joints get to be my age and tell me that auto-complete isn't critical :-) It's extremely handy; not only errors from compilation/execution, but things like a 'git grep -n' fit too. Emacs has integrations with many version control systems. Over the years, I've gone back and forth over whether I do my version control from within emacs or at the command line. These days (with mercurial), I tend to do most vc-things at the command line. But, I'm addicted to C-x v = (hg diff). It diffs the current buffer against the last checked-in version of the file, and can take me directly to any particular changed line. Again, I would imagine any decent editor these days would have something similar. It just blows my mind when I see people editing program text with NotePad or some similar piece of crap. Oh, yeah, one other thing I forgot. You want to use an editor which can (preferably as something you can turn on and off easily) put line numbers down the left margin of the screen. For solo editing, it's kind of silly. But if you're doing any kind of pair programming, code review, or presentation to a group, it's invaluable. Compare and contrast: In the big for loop, a couple of lines down, no, not there, the other for loop, yeah, now go down a couple of lines, no that's too far, back up one. Yeah there. On that line, why do you ... with: On line 647, why do you ... -- http://mail.python.org/mailman/listinfo/python-list
Re: New to python, do I need an IDE or is vim still good enough?
On 12/29/2012 04:52 PM, Roy Smith wrote: In the big for loop, a couple of lines down, no, not there, the other for loop, yeah, now go down a couple of lines, no that's too far, back up one. Yeah there. On that line, why do you ... with: On line 647, why do you ... It's even better when it prints line # from top of screen, I have a handy mapping that jumps directly to a line # and it's much easier to type 23space or 9space when you jump around a lot. - mitya -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ -- http://mail.python.org/mailman/listinfo/python-list
Re: New to python, do I need an IDE or is vim still good enough?
On Sun, Dec 30, 2012 at 8:52 AM, Roy Smith r...@panix.com wrote: In article mailman.1446.1356816523.29569.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: It's extremely handy; not only errors from compilation/execution, but things like a 'git grep -n' fit too. Emacs has integrations with many version control systems. Over the years, I've gone back and forth over whether I do my version control from within emacs or at the command line. My point was that it fits _many_ tools, without specific integration with the tool. But yes, version control integration is a useful tool (though not one I've personally made use of - I just run git commands from the command line). Again, I would imagine any decent editor these days would have something similar. It just blows my mind when I see people editing program text with NotePad or some similar piece of crap. Yes. And then hopping over to Stack Overflow and trying to figure out why their PHP script won't create HTTP headers. Combination of poor language and poor editor... Oh, yeah, one other thing I forgot. You want to use an editor which can (preferably as something you can turn on and off easily) put line numbers down the left margin of the screen. For solo editing, it's kind of silly. But if you're doing any kind of pair programming, code review, or presentation to a group, it's invaluable. Compare and contrast: In the big for loop, a couple of lines down, no, not there, the other for loop, yeah, now go down a couple of lines, no that's too far, back up one. Yeah there. On that line, why do you ... with: On line 647, why do you ... Absolutely! Though it's roughly as good to have the current cursor position shown in a status line somewhere, and takes up less real estate. But yes, vital to be able to see that. Even when I'm sitting *right next to* my boss and communicating verbally, I'll talk about the code by quoting line numbers. Let me explain. (No, there is too much. Let me sum up.) Pull up foobar dot jay ess and go to line 254-ish - see how the frobnosticator always gets called with a quuxed argument? ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: New to python, do I need an IDE or is vim still good enough?
On 12/29/2012 05:30 PM, Chris Angelico wrote: In the big for loop, a couple of lines down, no, not there, the other for loop, yeah, now go down a couple of lines, no that's too far, back up one. Yeah there. On that line, why do you ... with: On line 647, why do you ... Absolutely! Though it's roughly as good to have the current cursor position shown in a status line somewhere, and takes up less real estate. I have to disagree -- if someone is standing next to you and they want to refer to a particular line, they can't really tell you move the cursor to that line there, so I can read its line number from status line and then tell you I'm referring to that line. - mitya -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ -- http://mail.python.org/mailman/listinfo/python-list
Re: New to python, do I need an IDE or is vim still good enough?
On Sun, Dec 30, 2012 at 9:40 AM, Mitya Sirenef msire...@lightbird.net wrote: On 12/29/2012 05:30 PM, Chris Angelico wrote: In the big for loop, a couple of lines down, no, not there, the other for loop, yeah, now go down a couple of lines, no that's too far, back up one. Yeah there. On that line, why do you ... with: On line 647, why do you ... Absolutely! Though it's roughly as good to have the current cursor position shown in a status line somewhere, and takes up less real estate. I have to disagree -- if someone is standing next to you and they want to refer to a particular line, they can't really tell you move the cursor to that line there, so I can read its line number from status line and then tell you I'm referring to that line. Ah, to clarify: We have our separate computers in front of us. So when I quote a line number, it's by looking at my screen, and allows him to synchronize his display. Of course, if you can afford the real estate, and as long as they're not distracting, a column of numbers doesn't hurt. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: dict comprehension question.
On 12/29/2012 4:40 PM, Mitya Sirenef wrote: On 12/29/2012 03:15 PM, Joel Goldstick wrote: Would this help: w = [1,2,3,1,2,4,4,5,6,1] s = set(w) s set([1, 2, 3, 4, 5, 6]) {x:w.count(x) for x in s} {1: 3, 2: 2, 3: 1, 4: 2, 5: 1, 6: 1} Indeed, this is much better -- I didn't think of it.. It still turns an O(n) problem into an O(k*n) problem, where k is the number of distinct items. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: dict comprehension question.
On 12/29/2012 2:48 PM, Quint Rankid wrote: Given a list like: w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1] I would like to be able to do the following as a dict comprehension. a = {} for x in w: a[x] = a.get(x,0) + 1 results in a having the value: {1: 3, 2: 2, 3: 1, 4: 2, 5: 1, 6: 1} Let me paraphrase this: I have nice, clear, straightforward, *comprehensible* code that I want to turn into an incomprehensible mess with a 'comprehension. That is the ironic allure of comprehensions. Comprehensions do not allow for interactions between the source items. Mitya and Joel worked around this with solutions that do redundant calculation and multiply the time order. Reductions do allow for interactions. Doing everything as a reduction was the fad before comprehensions came along ;-) from functools import reduce w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1] def update(dic, n): Mutate and return dic (contrary to usual Python policy) dic[n] = dic.get(n, 0) + 1 return dic counts = reduce(update, w, {}) print(counts == {1: 3, 2: 2, 3: 1, 4: 2, 5: 1, 6: 1}) # prints True The above is how to rewrite your code in a functional language that does not have statements and explicit iteration. In Python, I would only bother to wrap the body of the loop in a function if I needed the same body in multiple places. Comprehensions are filtered mappings and that both filter and map can be written as reduction, so reduction included comprehension. It is more powerful because it can also do sequential interaction. Indeed, I would say that it should only be used when there is sequential interaction. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Confused about logger config from within Python (3)
On 12/29/2012 8:48 AM, Roy Smith wrote: In article 50de7a0a$0$29967$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: In Python 3.2 and 3.3, the message about no handlers is not printed, which is an interesting difference. (Somebody who knows more about the logging package than I do might be able to state why that difference.) I hope that means that http://bugs.python.org/issue994421 has finally been fixed :-) I added an update ;-). If Vijay wanted the message to be a warning rather than an exception, the warnings module and mechanism could have been used (once it was available -- I am not sure when that was). But I think a default handler is even better. Given that you disagreed with his disposition of the issue, you might have posted to this list for other opinions. I also hope you appreciate that Vijay has stuck with maintenance and upgrade of the module for nearly a decade now. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: dict comprehension question.
On 12/29/12 15:40, Mitya Sirenef wrote: w = [1,2,3,1,2,4,4,5,6,1] s = set(w) s set([1, 2, 3, 4, 5, 6]) {x:w.count(x) for x in s} {1: 3, 2: 2, 3: 1, 4: 2, 5: 1, 6: 1} Indeed, this is much better -- I didn't think of it.. Except that you're still overwhelmed by iterating over every element in w for every distinct element. So you've gone from O(N**2) to O(k*N). The cleanest way to write it (IMHO) is MRAB's w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1] from collections import Counter results = dict(Counter(w)) which should gather all the statistics in one single pass across w making it O(N), and it's Pythonically readable. -tkc -- http://mail.python.org/mailman/listinfo/python-list
Re: New to python, do I need an IDE or is vim still good enough?
* Grant Edwards invalid@invalid.invalid [121229 10:02]: On 2012-12-27, mogul morten.gulda...@gmail.com wrote: I'm new to python, got 10-20 years perl and C experience, all gained on unix alike machines hacking happily in vi, and later on in vim. Now it's python, and currently mainly on my kubuntu desktop. Do I really need a real IDE, as the windows guys around me say I do, No. or will vim, git, make and other standalone tools make it the next 20 years too for me? I've been using vim for 12 years now. And it works pretty good for me as an IDE. I've written a lot of vimscripts to make vim better do my bidding and made generous use of contributed scripts. I see no reason to think that I would be more productive using anything else, but that is just me. Along the way, I did use emacs as well and ended doing quite a bit of elisping. Elisp does have the advantage of asynchronously running the interpereter inside of the editor Just one thing that I wouldn't mind seeing in vim. I do find vim a bit more nimble than emacs, but each to his/her own. It's wonderful to have all of the choices. They'll take away my vim when they pry it from my cold, dead fingers. -- Tim tim at tee jay forty nine dot com or akwebsoft dot com http://www.akwebsoft.com -- http://mail.python.org/mailman/listinfo/python-list
Re: New to python, do I need an IDE or is vim still good enough?
On Sun, Dec 30, 2012 at 11:38 AM, Tim Johnson t...@akwebsoft.com wrote: Along the way, I did use emacs as well and ended doing quite a bit of elisping. elispsis. n. the intentional omission of unnecessary work which can be inferred by the editor; often indicated with three consecutive parentheses ((( ))) ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Confused about logger config from within Python (3)
In article mailman.1455.1356826759.29569.python-l...@python.org, Terry Reedy tjre...@udel.edu wrote: On 12/29/2012 8:48 AM, Roy Smith wrote: In article 50de7a0a$0$29967$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: In Python 3.2 and 3.3, the message about no handlers is not printed, which is an interesting difference. (Somebody who knows more about the logging package than I do might be able to state why that difference.) I hope that means that http://bugs.python.org/issue994421 has finally been fixed :-) I added an update ;-). If Vijay wanted the message to be a warning rather than an exception, the warnings module and mechanism could have been used (once it was available -- I am not sure when that was). But I think a default handler is even better. Having a default handler is clearly a good fix. I also hope you appreciate that Vijay has stuck with maintenance and upgrade of the module for nearly a decade now. Absolutely. BTW, I recently discovered a truly awesome thing about logging and nosetests. Apparently, nose attaches a hander to the root logger at debug level and buffers anything that gets sent there. If a test fails, it prints anything that logger captured. So, for example (intentionally breaking one of my tests): begin captured logging requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection (1): localhost.lic.songza.com requests.packages.urllib3.connectionpool: DEBUG: GET /foo:80/api/v2/?format=json ('HTTP/1.1',) 404 None - end captured logging - This rocks! -- http://mail.python.org/mailman/listinfo/python-list
Re: dict comprehension question.
On Sat, Dec 29, 2012 at 7:26 PM, Tim Chase python.l...@tim.thechases.comwrote: On 12/29/12 15:40, Mitya Sirenef wrote: w = [1,2,3,1,2,4,4,5,6,1] s = set(w) s set([1, 2, 3, 4, 5, 6]) {x:w.count(x) for x in s} {1: 3, 2: 2, 3: 1, 4: 2, 5: 1, 6: 1} Indeed, this is much better -- I didn't think of it.. Except that you're still overwhelmed by iterating over every element in w for every distinct element. So you've gone from O(N**2) to O(k*N). The cleanest way to write it (IMHO) is MRAB's w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1] from collections import Counter results = dict(Counter(w)) which should gather all the statistics in one single pass across w making it O(N), and it's Pythonically readable. -tkc I like this too. I haven't learned about collections module yet. Thanks for the pointer -- http://mail.python.org/**mailman/listinfo/python-listhttp://mail.python.org/mailman/listinfo/python-list -- Joel Goldstick -- http://mail.python.org/mailman/listinfo/python-list
[issue16805] when building docs on Debian 7 -- ERROR: Error in note directive
Georg Brandl added the comment: In this case it's more of a docutils version problem, I would guess. Tshepang, can you find out your docutils version? But proper use of the note directive is with an empty line, so we should fix these instances anyway. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16805 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15112] argparse: nargs='*' positional argument doesn't accept any items if preceded by an option and another positional
Chris Jerdonek added the comment: Was argparse ever supposed to support inputs of the form given in the example (i.e. different positional arguments straddling optional arguments): 'yy -x zz'? The usage string shows up as: usage: test.py [-h] [-x] y [z [z ...]] The original example seems to work with the current code if given as: '-x yy zz'. Also, substituting argparse.REMAINDER for '*' in the original example gives the following both with and without the patch: Namespace(x=False, y='yy', z=['-x', 'zz']) That doesn't seem consistent with straddling being supported. Lastly, passing just '-x' gives the following error with and without the patch (z should be optional): error: the following arguments are required: y, z -- nosy: +chris.jerdonek ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15112 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16811] email.message.Message flatten dies of list index out of range
New submission from Helmut Jarausch: The following code triggers the bug: #!/usr/bin/python3.3 #-*- coding: latin1 -*- from email.message import Message from email import policy from email.parser import FeedParser Parser= FeedParser(policy=policy.SMTP) Parser.feed('From jarau...@igpm.rwth-aachen.de Tue Apr 24 15:09:24 2012\n') Parser.feed('X-Status:\n') # this triggers the bug Parser.feed('From: Helmut Jarausch jarau...@igpm.rwth-aachen.de\n') Msg= Parser.close() Msg_as_str= Msg.as_string(unixfrom=True) This triggers File Email_Parse_Bug.py, line 13, in module Msg_as_str= Msg.as_string(unixfrom=True) File /usr/lib64/python3.3/email/message.py, line 151, in as_string g.flatten(self, unixfrom=unixfrom) File /usr/lib64/python3.3/email/generator.py, line 112, in flatten self._write(msg) File /usr/lib64/python3.3/email/generator.py, line 171, in _write self._write_headers(msg) File /usr/lib64/python3.3/email/generator.py, line 198, in _write_headers self.write(self.policy.fold(h, v)) File /usr/lib64/python3.3/email/policy.py, line 153, in fold return self._fold(name, value, refold_binary=True) File /usr/lib64/python3.3/email/policy.py, line 176, in _fold (len(lines[0])+len(name)+2 maxlen or IndexError: list index out of range If I strip the '\n' from the lines feeded to the Parser, the bug does not occur. Thanks for looking into it, Helmut. This is with Python 3.3.0+ 3.3:ccc372b37fbb+ -- components: Library (Lib) messages: 178482 nosy: HJarausch priority: normal severity: normal status: open title: email.message.Message flatten dies of list index out of range type: crash versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16811 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16806] col_offset is -1 for multiline string expressions resembling docstrings
Carsten Klein added the comment: Please see the attached patch that will resolve the issue. It also includes a test case in test_ast.py. What the patch does is as follows: - tok_state is extended by two fields, namely first_lineno and multi_line_start - first_lineno will be set by tok_get as soon as the beginning of a STRING is detected and it will be set to the current line tok-lineno. - multi_line_start is the beginning of the first line of a string - in parsetok we now distinguish between STRING nodes and other nodes. in case of STRING nodes, we will use the values of the above fields for determining the actual lineno and the col_offset, otherwise tok-col_offset and tok-lineno will be used when creating the token. The included test case ensures that the col_offset and lineno of multi line strings is calculated correctly. -- keywords: +patch Added file: http://bugs.python.org/file28477/issue1680.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16806 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16806] col_offset is -1 and lineno is wrong for multiline string expressions
Changes by Carsten Klein carsten.kl...@axn-software.de: -- title: col_offset is -1 for multiline string expressions resembling docstrings - col_offset is -1 and lineno is wrong for multiline string expressions ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16806 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16806] col_offset is -1 and lineno is wrong for multiline string expressions
Changes by Carsten Klein carsten.kl...@axn-software.de: Removed file: http://bugs.python.org/file28477/issue1680.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16806 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16806] col_offset is -1 and lineno is wrong for multiline string expressions
Changes by Carsten Klein carsten.kl...@axn-software.de: Added file: http://bugs.python.org/file28478/issue16806.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16806 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16805] when building docs on Debian 7 -- ERROR: Error in note directive
Tshepang Lekhonkhobe added the comment: docutils 0.8.1-8 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16805 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16808] inspect.stack() should return list of named tuples
Daniel Shahaf added the comment: Why did you set stage to 'needs patch'? One is already attached. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16808 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16805] when building docs on Debian 7 -- ERROR: Error in note directive
Sandro Tosi added the comment: On Sat, Dec 29, 2012 at 4:33 AM, Tshepang Lekhonkhobe rep...@bugs.python.org wrote: It is my preference to be able to build all of CPython with the already-installed distro packages, instead of pulling in foreign ones. IMO, I think with a project as bit as CPython, you should leave you personal preferences apart and use (as much as possible) the tools the project has decided to use: having a consistent set of tools to build doc across everyone/everything (like auto-build doc machines) trying to generate the doc is the proper way to handle it. Any reason why not use later versions? no-one has done the work of testing, preparation and migration: do you volunteer? :) Can't the docs be written such that they can run on various versions of these tools anyway? Not always, but of course, as Georg said, if for note directive we can have a syntax working with current and higher versions of sphinx/docutils, that's ok to do it. I only think that using a non-standard set of doc-build-tools is to be discouraged, and sticking to what Makefile will fetch is the proper way to build the doc and contribute to it. Regards, -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16805 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16801] Preserve original representation for integers / floats in docstrings
Carsten Klein added the comment: The problem with this is that at the time that pydoc gets the information via inspect, the numbers have already been parsed as long or double and the original notation is no longer available. This is due to the fact that during build of the AST node for the NUMBER type, the value will already be deserialized into its machine representation, which is either long or double. The only way to preserve that information would be to extend the NUM_type with an additional 's' field which then would preserve its original notation and which can be retrieved from the AST. pydoc, however, would still fail as it does not use the AST. In order to restore the original information, pydoc must then source the original file or source of the function or class method and parse it using the AST. A much simpler approach would be to simply get the function or method source and extract its formal parameter list using for example a regular expression. However, preserving the original notation in the runtime is not required and shouldn't be done. -- nosy: +carsten.kl...@axn-software.de ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16801 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16801] Preserve original representation for integers / floats in docstrings
Carsten Klein added the comment: Here are some links into the sources: Python/ast.c, ast_for_atom(), line 1872ff. Python/ast.c, parsenumber(), line 3632ff. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16801 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16805] when building docs on Debian 7 -- ERROR: Error in note directive
Tshepang Lekhonkhobe added the comment: no-one has done the work of testing, preparation and migration: do you volunteer? :) What needs doing exactly? I would volunteer if guided. I normally build with the Debian-provided tools, and the docs look good, all but those note directive errors. Also, can I submit a patch that adds the missing newlines, or will some committer take care of it, or does this need further discussion? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16805 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16801] Preserve original representation for integers / floats in docstrings
Carsten Klein added the comment: However, hinting inspect to use a different format when serializing the default values for existing keyword parameters of methods or functions seems to be a good idea and +1 by me for that. Personally, I'd rather have the decorator based solution than having to manually add additional fields to a given method or function. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16801 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16798] DTD not checked
Eli Bendersky added the comment: I have no plans adding this feature to etree. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16798 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16805] when building docs on Debian 7 -- ERROR: Error in note directive
Sandro Tosi added the comment: On Sat, Dec 29, 2012 at 4:07 PM, Tshepang Lekhonkhobe rep...@bugs.python.org wrote: no-one has done the work of testing, preparation and migration: do you volunteer? :) What needs doing exactly? I would volunteer if guided. I normally (you always can't expect to be guided) it's not much more than - update sphinx (and the other tools it depends on, if needed). - fix what's broken or what needs updating - verify the doc is ok for any supported branches. Also, can I submit a patch that adds the missing newlines, or will some committer take care of it, or does this need further discussion? it won't hurt to have a patch. But please build the doc it with the CPython selected tools before submitting the patch, and verifying the doc sections you've changed are still ok. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16805 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16804] python3 -S -m site fails
Changes by Christian Heimes li...@cheimes.de: -- nosy: +christian.heimes ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16804 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16812] os.symlink can return wrong FileExistsError/WindowsError information
New submission from Andrew: When attempting to make a symlink using a name that already exists, a FileExistsError is raised (and rightfully so), but it lists the source name rather than the destination name. However, the existing destination name is what causes the exception to be raised, not the existing source. Since the FileExistsError is WinError 183 and I haven't attempted this on another OS, I'm marking this as Windows-specific. Issue 13775 seems to be related. -- components: Windows messages: 178493 nosy: IAmTheClaw priority: normal severity: normal status: open title: os.symlink can return wrong FileExistsError/WindowsError information type: behavior versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16812 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16813] use paths relative to CPython root
New submission from Tshepang Lekhonkhobe: I think it's a good idea to simply list the 'full' path. -- assignee: docs@python components: Devguide, Documentation files: use-paths-relative-to-root.diff keywords: patch messages: 178494 nosy: docs@python, ezio.melotti, tshepang priority: normal severity: normal status: open title: use paths relative to CPython root Added file: http://bugs.python.org/file28479/use-paths-relative-to-root.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16813 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16814] use --directory option of make
New submission from Tshepang Lekhonkhobe: This avoids having to run 2 separate commands. -- components: Devguide files: make-can-specify-build-directory.diff keywords: patch messages: 178495 nosy: ezio.melotti, tshepang priority: normal severity: normal status: open title: use --directory option of make Added file: http://bugs.python.org/file28480/make-can-specify-build-directory.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16814 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16814] use --directory option of make
Sandro Tosi added the comment: i'd use make -C Doc html much more compact and what you would usually find on the internet for cd into the dir and run the html target in it -- nosy: +sandro.tosi ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16814 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16814] use --directory option of make
Tshepang Lekhonkhobe added the comment: I like long-form options for documentation purposes since it's clearer what the option is for. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16814 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16219] segfault when using xml.etree.ElementTree.XMLTreeBuilder
Changes by Eli Bendersky eli...@gmail.com: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16219 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable
Eli Bendersky added the comment: Daniel, is your patch made vs. the 3.3 branch? I'll need to apply there first, and then merge up to default (3.4). [Also, removing the 3.2 tag here. 3.2 won't be fixed to make _elementtree pickleable - it never was]. -- versions: -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16076 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable
Daniel Shahaf added the comment: I wrote the patch against default (3.4), but it applies cleanly to 3.3. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16076 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable
Eli Bendersky added the comment: Also, could you explain what makes test___all__ start failing with this patch? What are you adding that makes that happen? P.S. I suspect the root reason is the bad way etree tests are structured in general. See issue 15083 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16076 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15651] PEP 3121, 384 refactoring applied to elementtree module
Eli Bendersky added the comment: Thanks for the patch. I'll take a look. -- assignee: - eli.bendersky ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15651 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16811] email.message.Message flatten dies of list index out of range
Changes by R. David Murray rdmur...@bitdance.com: -- components: +email nosy: +barry, r.david.murray stage: - needs patch type: crash - behavior versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16811 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16811] email.message.Message flatten dies of list index out of range
R. David Murray added the comment: Thanks for the report. We thought we fixed this once already (in issue 11401). It looks like that only fixed the old folding algorithm, and that the new one has the same bug. I thought the test ran against both algorithms, but I must have made a mistake. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16811 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16805] when building docs on Debian 7 -- ERROR: Error in note directive
Tshepang Lekhonkhobe added the comment: I have tested the attached patch using official tools (make -C Doc html) and the only differences, between before and after, are: * The genindex files, where some of the keywords that are duplicated in the documentation would end up getting randomly swapped around. An example is DEDENT token, which appears twice in the documentation (see http://docs.python.org/3/genindex-D.html). In its case, the 1st url points to where the 2nd url used to point and vice versa. * objects.inv: related to genindex changes? * searchindex.js: also related to genindex changes? I suspect these differences do not matter though, since these are just indexes. -- keywords: +patch Added file: http://bugs.python.org/file28481/remove-directives-warnings.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16805 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16813] use paths relative to CPython root in documentation building instructions
R. David Murray added the comment: Thanks for the suggestion, but the context is that you are in the Doc directory in order to run make, so I think the existing documentation is preferable. I'd let George decide, though. -- nosy: +georg.brandl, r.david.murray title: use paths relative to CPython root - use paths relative to CPython root in documentation building instructions ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16813 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16814] use --directory option of make
R. David Murray added the comment: I think the fact that the cd paradigm is more commonly encountered is a fairly strong argument in favor of keeping it, but I'm only -0 on this change. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16814 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16814] use --directory option of make in describing how to build the docs
Changes by R. David Murray rdmur...@bitdance.com: -- title: use --directory option of make - use --directory option of make in describing how to build the docs ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16814 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16805] when building docs on Debian 7 -- ERROR: Error in note directive
Tshepang Lekhonkhobe added the comment: The previous patch applies cleanly to 3.3 and 3.4. I am now attaching one that applies cleanly to 3.2. -- versions: +Python 3.3 Added file: http://bugs.python.org/file28482/remove-directives-warnings-3.2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16805 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16805] when building docs on Debian 7 -- ERROR: Error in note directive
Tshepang Lekhonkhobe added the comment: And this one patch applies to 2.7. -- versions: +Python 2.7, Python 3.2 Added file: http://bugs.python.org/file28483/remove-directives-warnings-2.7.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16805 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16778] Logger.findCaller needs to be smarter
Vinay Sajip added the comment: Passing a globals() instance looks hackish. Agreed it's not ideal, but we're constrained by what's available to compare against via the frame. Apart from globals() there's only really the filename, which isn't ideal either. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16778 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable
Daniel Shahaf added the comment: Any attempt to pickle an Element object in test_xml_etree.py causes that test to fail if test___all__ had been run before it; see attached transcript. It's against 3.4, with no changes other than the testsuite changes shown within. I don't know what the root cause is. As noted before, adding 'xml.etree' to test___all__.AllTest.test_all.blacklist is a workaround, so I assume the root cause lies within the test framework --- a bad interaction between the import magics in test___all__ and test_xml_etree. -- Added file: http://bugs.python.org/file28484/transcript-test___all__.txt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16076 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15083] Rewrite ElementTree tests in a cleaner and safer way
Changes by Daniel Shahaf pyt...@danielsh.fastmail.net: -- nosy: +danielsh ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15083 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16801] Preserve original representation for integers / floats in docstrings
Serhiy Storchaka added the comment: And if os.open were supplied in os.py: @inspect.override_string_representation('mode', 'os.O_CREAT | os.O_RDWR') def open(file, flags, mode=0o777, *, dir_fd=None): Other use case is a sentinel default. foo(arg={}) looks better than foo(arg=object object) for function which use a sentinel idiom: _sentinel = object() def foo(arg=_sentinel): if arg is _sentinel: arg = {} ... Sometimes full signature overwriting is needed (see for example Python implementation of operator.methodcaller() in issue16694). -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16801 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16809] Tk 8.6.0 introduces TypeError. (Tk 8.5.13 works)
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16809 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16812] os.symlink can return wrong FileExistsError/WindowsError information
Serhiy Storchaka added the comment: See also issue16074. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16812 ___ ___ 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
Tshepang Lekhonkhobe added the comment: Additionally, the whole way we're fetching those tools will be revisited soon. What are/were your plans ? -- ___ 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
[issue13775] Access Denied message on symlink creation misleading for an existing file/directory target.
Serhiy Storchaka added the comment: See also issue16074. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13775 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16074] bad error message in os.rename
Serhiy Storchaka added the comment: As I see, now 3.4 behavior differs from 3.3 behavior. os.link('non-existent-name', 'new-name') Traceback (most recent call last): File stdin, line 1, in module FileNotFoundError: [Errno 2] No such file or directory: 'non-existent-name' os.symlink('long-name'*1000, 'new-name') Traceback (most recent call last): File stdin, line 1, in module OSError: [Errno 36] File name too long: 'long-namelong-namelong-namelong-namelong-namelong-name... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16074 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16815] Is all OK!!
Changes by Bernie Keimel unowne...@gmail.com: -- nosy: Bernie.Keimel priority: normal severity: normal status: open title: Is all OK!! ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16815 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16815] Is all OK!!
New submission from Hynek Schlawack: Glad to hear. -- nosy: +hynek resolution: - invalid stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16815 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16813] use paths relative to CPython root in documentation building instructions
Georg Brandl added the comment: Fine with me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16813 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16814] use --directory option of make in describing how to build the docs
Georg Brandl added the comment: Agree with David. -- nosy: +georg.brandl status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16814 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com