Re: Unicode issue with Python v3.3
Τη Τετάρτη, 10 Απριλίου 2013 12:10:13 π.μ. UTC+3, ο χρήστης Νίκος Γκρ33κ έγραψε: Hello, iam still trying to alter the code form python 2.6 = 3.3 Everyrging its setup except that unicode error that you can see if you go to http://superhost.gr Can anyone help with this? I even tried to change print() with sys.stdout.buffer() but still i get the same unicode issue. I don't know what to try anymore. root@nikos [/home/nikos/public_html/foo-py]# pwd /home/nikos/public_html/foo-py root@nikos [/home/nikos/public_html/foo-py]# cat foo.py #!/bin/sh exec 2/home/nikos/cgi.err.out echo $0 $* 2 id 2 env | sort 2 set -x exec /full/path/to/foo-py ${1+$@} root@nikos [/home/nikos/public_html/foo-py]# python3 foo.py File foo.py, line 2 exec 2/home/nikos/cgi.err.out ^ SyntaxError: invalid syntax root@nikos [/home/nikos/public_html/foo-py]# As far as thr tail -f of the error_log: root@nikos [/home/nikos/public_html]# touch /var/log/httpd/error_log root@nikos [/home/nikos/public_html]# tail -f /var/log/httpd/error_log and its empty even when at the exact same time i run 'python3 metrites.py' from another interactive prompt when it supposed to give live feed of the error messages. Cameron would it be too much to ask to provide you with root access to my VPS server so you can have a look there too? i can pay you if you like if you wait a few days to gather some money. -- http://mail.python.org/mailman/listinfo/python-list
Re: python-noob - which container is appropriate for later exporting into mySql + matplotlib ?
On Sat, 13 Apr 2013 10:02:18 -0700, rusi wrote: To the OP: Steven is welcome to his views about use of databases. I haven't given any views about databases. I've given my view on application developers -- specifically, Firefox -- using a not-quite ACID database in a way that is fragile, can cause data loss, and adds lots more complexity to the application AND the end-user experience. And for what? Simple data that would be much better in a simpler format, such as bookmarks. Good to remember that everyone does not agree with him. This includes the firefox devs as well as python devs. I don't see what the Python devs have to do with it. They don't use Sqlite for Python's internals, and the fact that there is a module for sqlite doesn't mean squat. There's a module for parsing Sun AU audio files, that doesn't mean the Python devs recommend that they are the best solution to your audio processing and multimedia needs. I'm not saying that Sqlite doesn't have it's uses, although I personally haven't found them yet. And as for the Firefox devs, well, I'll just let Jamie Zawinski show their l33t des1gn ski11z in context: http://www.jwz.org/blog/2003/01/more-khtml/ Okay, that's ten years old. What do you think the odds are that Firefox has a nice, clean design by now? Well, I suppose it's possible, but when it takes a minimum of NINE files to do the equivalent of Hello World in Firefox, I wouldn't put money on it: http://kb.mozillazine.org/Getting_started_with_extension_development I mean, really -- bookmarks, in a single-user application, and they store it in a database. You can't even have two instances of Firefox running at the same time. The consequences of this over-engineered solution is that Firefox is more complex and fragile than it needs be, and less reliable than it could be. When your bookmarks database gets corrupt, which is easy, the browser History and Back button stop working, which then pushes responsibility for fixing the database corruption back on the user. So the Firefox developers actually end up paying the costs of a non-lightweight implementation, but without the benefits. They don't even get to remove the old bookmarks to HTML code, since they still need it for manual exports and backups. Considering the rest of the Firefox architecture (XUL, XUL everywhere!), using sqlite probably feels like a lightweight solution to the devs. The Mork database structure used by Mozilla Firefox v1-2 is unusual to say the least. It was originally developed by Netscape for their browser (Netscape v6) and the format was later adopted by Mozilla to be used in Firefox. It is a plain text format which is not easily human readable and is not efficient in its storage structures. For example, a single Unicode character can take many bytes to store. The developers themselves complained it was extremely difficult to parse correctly and from Firefox v3, it was replaced by MozStorage which is based on an SQLite database. http://wordpress.bladeforensics.com/?p=357 http://en.wikipedia.org/wiki/Mork_%28file_format%29 -- Steven -- http://mail.python.org/mailman/listinfo/python-list
كيف تعالج الهالات السوداء أسفل العين
كيف تعالج الهالات السوداء أسفل العين http://natigtas7ab.blogspot.com/2013/04/blog-post_5060.html انشرا على الفيس بك https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fnatigtas7ab.blogspot.com%2F2013%2F04%2Fblog-post_5060.html%23.UWpinJbOYeo.facebook انشرها على تويتر https://twitter.com/intent/tweet?text=%D9%83%D9%8A%D9%81+%D8%AA%D8%B9%D8%A7%D9%84%D8%AC+%D8%A7%D9%84%D9%87%D8%A7%D9%84%D8%A7%D8%AA+%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D8%A1+%D8%A3%D8%B3%D9%81%D9%84+%D8%A7%D9%84%D8%B9%D9%8A%D9%86+~+%D9%86%D8%AA%D8%A7%D8%A6%D8%AC+%D8%A7%D9%84%D8%A5%D9%85%D8%AA%D8%AD%D8%A7%D9%86%D8%A7%D8%AA+%D9%84%D9%84%D8%B4%D9%87%D8%A7%D8%AF%D8%A7%D8%AA+%D9%88%D8%A7%D9%84%D8%AC%D8%A7%D9%85%D8%B9%D8%A7%D8%AAurl=http%3A%2F%2Fnatigtas7ab.blogspot.com%2F2013%2F04%2Fblog-post_5060.html%23.UWpittQQGIo.twitterrelated= -- http://mail.python.org/mailman/listinfo/python-list
python setup.py install and dependencies
I have a some confusion about the package installation process. Let's say I have manually installed Python 3.3, so I don't have distribute and pip. Now I want to install the bpython shell, so I download the source code and after I try to do python3.3 setup.py install. I did so, and all it'is ok, but I don't have the dependencies (pygments), so when I run bpython, Python complains with an ImportError: No module named 'pygments'. So I installed distribute, and after I removed and reinstalled bpython, and now python3.3 setup.py install has installed pygments too. So my question is: if I want python3.3 setup.py install installs the dependencies of a package I need to have distribute? And pip installs the dependencies because of it uses distribute? Thanks in advance, -- Marco -- http://mail.python.org/mailman/listinfo/python-list
Re: Unicode issue with Python v3.3
On 13Apr2013 23:00, nagia.rets...@gmail.com nagia.rets...@gmail.com wrote: | root@nikos [/home/nikos/public_html/foo-py]# pwd | /home/nikos/public_html/foo-py | root@nikos [/home/nikos/public_html/foo-py]# cat foo.py | #!/bin/sh | exec 2/home/nikos/cgi.err.out | echo $0 $* 2 | id 2 | env | sort 2 | set -x | exec /full/path/to/foo-py ${1+$@} | | root@nikos [/home/nikos/public_html/foo-py]# python3 foo.py | File foo.py, line 2 | exec 2/home/nikos/cgi.err.out | ^ | SyntaxError: invalid syntax That is because foo.py isn't a python script anymore, it is a shell script. Its purpose is to divert stderr to a file and to recite various things about the environment to that file in addition to any error messages. Just run it directly: ./foo.py The #! line should cause it to be run by the shell. I also recommend you try to do all this as your normal user account. Root is for administration, such as stopping/starting apache and so on. Not test running scripts from the command line; consider: if the script has bugs, as root it can do an awful lot of damage. | root@nikos [/home/nikos/public_html/foo-py]# | As far as thr tail -f of the error_log: | root@nikos [/home/nikos/public_html]# touch /var/log/httpd/error_log That won't do you much good; apache has not opened it, and so it will not be writing to it. It was writing to a file of that name, but you removed that file. Apache probably still has its hooks in the old file (which now has no name). Restarting apache should open (or create if missing) this file for you. | root@nikos [/home/nikos/public_html]# tail -f /var/log/httpd/error_log | and its empty even when at the exact same time i run 'python3 | metrites.py' from another interactive prompt when it supposed to | give live feed of the error messages. No, _apache_ writes to that file. So only when you visit the web page will stuff appear there. If you just run things from the command line, error messages will appear on your terminal. Or, after this line of the wrapper script: exec 2/home/nikos/cgi.err.out the error messages will appear in cgi.err.out. | Cameron would it be too much to ask to provide you with root | access to my VPS server so you can have a look there too? | i can pay you if you like if you wait a few days to gather some money. I really do not recommend that: - it is nuts to blithely allow a stranger root access to your system - you won't learn anything about CGI scripts What you need for further debugging of your python issues is access to the error messages from the CGI script. That is the purpose of the wrapper script. Get the wrapper running on the command line and then test it via the browser. Cheers, -- Cameron Simpson c...@zip.com.au Lord grant me the serenity to accept the things I can not change, the courage to change the things that I can, and the wisdom to hide the bodies of those people I had to kill because they pissed me off. - Jeffrey Papen jpa...@asucla.ucla.edu -- http://mail.python.org/mailman/listinfo/python-list
Re: API design for Python 2 / 3 compatibility
Terry, Ethan: Thanks a lot for your excellent advice. :-) On 2013-04-13 19:32, Terry Jan Reedy wrote: Approach 2 matches (or should match) io.open, which became builtin open in Python 3. I would simply document that ftp_host.open mimics io.open in the same way that ftp_host.chdir, etcetera, match os.chdir, etc. Your principle will remain intact. I didn't know about `io.open` (or had forgotten it). Anyone writing *new* Py 2 code with any idea of ever running on Py 3 should be using io.open anyway. That is why it was backported. You might be able to reuse some io code or subclass some io classes for your implementation. Since I use `socket.makefile` to create the underlying file objects, I can use `BufferedReader`/`BufferedWriter` and `TextIOWrapper` to supply buffering and encoding/decoding. On 2013-04-13 20:03, Ethan Furman wrote: Approach 2, because it is much saner to deal with unicode inside the program, and only switch back to some kind of encoding when writing to files/pipes/etc. Yes, this is a much saner design. I just was hesitant because of the introduced backward incompatibility and wanted to get other's opinions. Since you are going to support python 3 as well you can bump the major version number and note the backward incompatibility. Actually I plan to increase the version number from 2.8 to 3.0 because of the Python 3 support and already intend to change some module names that will be visible to client code. So this is also a good opportunity to clean up the file interface. :) Best regards, Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: python-noob - which container is appropriate for later exporting into mySql + matplotlib ?
On Apr 14, 12:56 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Sat, 13 Apr 2013 10:02:18 -0700, rusi wrote: To the OP: Steven is welcome to his views about use of databases. I haven't given any views about databases. You are twisting use of databases to just about databases And heres what you said: Using a database for such lightweight data as bookmarks is, in my opinion, gross overkill and adds to the complexity of Firefox. More complexity leads to more bugs… Not that I would disagree with that for general databases, just for something as atypical as sqlite. In short, you are being hypnotized by the word 'database' and not seeing that sqlite is a very strange instance of that species. http://en.wikipedia.org/wiki/Etymological_fallacy + http://en.wikipedia.org/wiki/Accident_%28fallacy%29 I've given my view on application developers -- specifically, Firefox -- using a not-quite ACID database in a way that is fragile, can cause data loss, FUD Are you saying that flat-files dont lose data? and adds lots more complexity to the application AND the end-user experience. And for what? Strange argument: If I call a one line re.match(..) that hooks into 5000 arcane lines of the re module, on whose account is the complexity -- mine or python's? From a programmer's POV if 10 lines of flat-file munging are reduced to two lines of SQL its a reduction of 10 to 2. Simple data that would be much better in a simpler format, such as bookmarks. Good to remember that everyone does not agree with him. This includes the firefox devs as well as python devs. I don't see what the Python devs have to do with it. They don't use Sqlite for Python's internals, and the fact that there is a module for sqlite doesn't mean squat. There's a module for parsing Sun AU audio files, that doesn't mean the Python devs recommend that they are the best solution to your audio processing and multimedia needs. Python made a choice to include AU file support when Sun existed and looked more respectable than MS. Today the support continues to exist probably for backward compatibility reasons. The code's already written. Why remove it? Sure but it has its costs -- memory footprint, sources-size etc -- which are deemed negligible enough to not bother. Likewise python 2.5 made a choice to include sqlite. Following RoR's D Hansson we may call it an 'opinionated choice.' That choice implies that the devs decided that a fixed-cost of bundling sqlite with python is deemed better than each programmer installing/rolling-his-own etc I'm not saying that Sqlite doesn't have it's uses, although I personally haven't found them yet. And as for the Firefox devs, well, I'll just let Jamie Zawinski show their l33t des1gn ski11z in context: http://www.jwz.org/blog/2003/01/more-khtml/ Faulty generalization fallacy: http://en.wikipedia.org/wiki/Faulty_generalization Because some code in firefox is bad, every choice of firefox is bad? [Actually I am surprised that you agree with *that example*: Would you claim that a void returning, no-argument function is better than one with arguments and return values? Anyways thats really far away from this discussion…] To the OP: Lets deconstruct ACID. Consistency+Atomicity: Lets say you write some stack code like this stack[top] = newvalue top += 1 And if you catch the machine state between the two assignments, you will find an *inconsistent* stack because that code is *non-atomic* Should you bother? Yes if you have concurrency, no if not. Likewise Isolation is vacuously guaranteed if you are the sole guy running your code. As for Durability, if you randomly turn off your machine when your program is running, yes you may lose the results of your program. You may lose much else! IOW if you are alone on your machine, all discussion of ACID is moot -- http://mail.python.org/mailman/listinfo/python-list
Re: Unicode issue with Python v3.3
Τη Κυριακή, 14 Απριλίου 2013 12:28:32 μ.μ. UTC+3, ο χρήστης Cameron Simpson έγραψε: On 13Apr2013 23:00, nagia.rets...@gmail.com nagia.rets...@gmail.com wrote: | root@nikos [/home/nikos/public_html/foo-py]# pwd | /home/nikos/public_html/foo-py | root@nikos [/home/nikos/public_html/foo-py]# cat foo.py | #!/bin/sh | exec 2/home/nikos/cgi.err.out | echo $0 $* 2 | id 2 | env | sort 2 | set -x | exec /full/path/to/foo-py ${1+$@} | | root@nikos [/home/nikos/public_html/foo-py]# python3 foo.py | File foo.py, line 2 | exec 2/home/nikos/cgi.err.out | ^ | SyntaxError: invalid syntax That is because foo.py isn't a python script anymore, it is a shell script. Its purpose is to divert stderr to a file and to recite various things about the environment to that file in addition to any error messages. Just run it directly: ./foo.py The #! line should cause it to be run by the shell. I also recommend you try to do all this as your normal user account. Root is for administration, such as stopping/starting apache and so on. Not test running scripts from the command line; consider: if the script has bugs, as root it can do an awful lot of damage. | root@nikos [/home/nikos/public_html/foo-py]# | As far as thr tail -f of the error_log: | root@nikos [/home/nikos/public_html]# touch /var/log/httpd/error_log That won't do you much good; apache has not opened it, and so it will not be writing to it. It was writing to a file of that name, but you removed that file. Apache probably still has its hooks in the old file (which now has no name). Restarting apache should open (or create if missing) this file for you. | root@nikos [/home/nikos/public_html]# tail -f /var/log/httpd/error_log | and its empty even when at the exact same time i run 'python3 | metrites.py' from another interactive prompt when it supposed to | give live feed of the error messages. No, _apache_ writes to that file. So only when you visit the web page will stuff appear there. If you just run things from the command line, error messages will appear on your terminal. Or, after this line of the wrapper script: exec 2/home/nikos/cgi.err.out the error messages will appear in cgi.err.out. | Cameron would it be too much to ask to provide you with root | access to my VPS server so you can have a look there too? | i can pay you if you like if you wait a few days to gather some money. I really do not recommend that: - it is nuts to blithely allow a stranger root access to your system - you won't learn anything about CGI scripts What you need for further debugging of your python issues is access to the error messages from the CGI script. That is the purpose of the wrapper script. Get the wrapper running on the command line and then test it via the browser. Cheers, -- Cameron Simpson c...@zip.com.au Lord grant me the serenity to accept the things I can not change, the courage to change the things that I can, and the wisdom to hide the bodies of those people I had to kill because they pissed me off. - Jeffrey Papen jpa...@asucla.ucla.edu Well i trust you because you are the only one along with Lele that are helpimg me here: i tried what you said: root@nikos [/home/nikos/public_html/cgi-bin]# service httpd restart root@nikos [/home/nikos/public_html/cgi-bin]# python3 metrites.py root@nikos [/home/nikos/public_html]# cd foo-py/ root@nikos [/home/nikos/public_html/foo-py]# ls ./ ../ foo.py* root@nikos [/home/nikos/public_html/foo-py]# ./foo.py root@nikos [/home/nikos/public_html/foo-py]# cd .. root@nikos [/home/nikos/public_html]# cat cgi.err.out root@nikos [/home/nikos/public_html/cgi-bin]# cat /var/log/httpd/error_log root@nikos [/home/nikos/public_html/cgi-bin]# and i have run the script form browser but i still see nothing. I insist that you will make the most of this if you access the VPS yourself. it runs CentOS 6.4 Please accept, i trust you. -- http://mail.python.org/mailman/listinfo/python-list
Re: python-noob - which container is appropriate for later exporting into mySql + matplotlib ?
On Sun, Apr 14, 2013 at 9:17 PM, rusi rustompm...@gmail.com wrote: On Apr 14, 12:56 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: I've given my view on application developers -- specifically, Firefox -- using a not-quite ACID database in a way that is fragile, can cause data loss, FUD Are you saying that flat-files dont lose data? If they do, a human being can easily open them up and see what's inside. Suppose bookmarks are stored like this: rSome-Browser-Name web bookmarks file - edit with care url: http://www.google.com/ title: Search engine icon: whatever-format-you-want-to-use url: http://www.duckduckgo.com/ title: Another search engine url: http://www.python.org/ url: ftp://192.168.0.12/ title: My FTP Server desc: Photos are in photos/, videos are in videos/ Everything else is in other/ user: root pass: secret The parsing of this file is pretty simple. Blank line marks end of entry; indented line continues the previous attribute (like RFC822), everything else is attribute: value. (You might even be able to abuse an RFC822 parser/compositor for the job.) The whole file has to be read and rewritten for any edits, so it's unsuited to gigabytes of content; but we're talking about *web browser bookmarks* here. I know some people have a lot of them, but hardly gigs and gigs. And if you think they will, then all you need to do is have multiple files, eg one for each folder in the bookmark tree. Now suppose it gets damaged somehow. Firstly, that's a lot less likely with a simple file format and a write to temp file, then move temp file over main file setup; but mainly, it's very easy to resynchronize - maybe there'll be one bookmark (or a group of bookmarks) that get flagged as corrupted, but everything after that can be parsed just fine - as soon as you get to a blank line, you start parsing again. Very simple. Well suited to a simple task. (Note, however, that the uber-simple concept I've posited here would have the same concurrency problems that Firefox has. At very least, it'd rely on some sort of filesystem-level lock when it starts rewriting the file. But this is approximately similar to running two instances of a text editor and trying to work with the same file.) From a programmer's POV if 10 lines of flat-file munging are reduced to two lines of SQL its a reduction of 10 to 2. The complexity exists in a variety of places. The two lines of SQL hide a morass of potential complexity; so would a massive regex. The file itself is way harder for external tools to manage. And all of it can be buggy. With a simple flat-file system, chances are you can turn it into a nested list structure and a dict for indexing (or possibly a collections.OrderedDict), and then you have the same reduction - it's just simple in-memory operations, possibly followed by a save() call. All the options available will do that, whether flat-file or database. I don't see what the Python devs have to do with it. They don't use Sqlite for Python's internals, and the fact that there is a module for sqlite doesn't mean squat. There's a module for parsing Sun AU audio files, that doesn't mean the Python devs recommend that they are the best solution to your audio processing and multimedia needs. Python made a choice to include AU file support when Sun existed and looked more respectable than MS. Today the support continues to exist probably for backward compatibility reasons. The code's already written. Why remove it? Sure but it has its costs -- memory footprint, sources-size etc -- which are deemed negligible enough to not bother. Actually, this is one place where I disagree with the current decision of the Python core devs: I think bindings for other popular databases (most notably PostgreSQL, and probably MySQL since it's so widely used) ought to be included in core, rather than being shoved off to PyPI. Databasing is so important to today's world that it would really help if people had all the options right there in core, if only so they're more findable (if you're browsing docs.python.org, you won't know that psycopg is available). Currently the policy seems to be we don't include the server so why should we include the client; I disagree, I think the client would stand nicely on its own. (Does Python have a DNS server module? DNS client? I haven't dug deep, but I'm pretty sure I can do name lookups in Python, yet running a DNS server is sufficiently arcane that it can, quite rightly, be pushed off to PyPI.) But this is minor, and tangential to this discussion. Faulty generalization fallacy: http://en.wikipedia.org/wiki/Faulty_generalization Because some code in firefox is bad, every choice of firefox is bad? It's a matter of windows into the philosophy, rather than specific examples. Requiring nine files to do a Hello World extension suggests a large corpus of mandatory boilerplate; imagine, for instance, that my example bookmarks file structure had demanded _every_
Re: python-noob - which container is appropriate for later exporting into mySql + matplotlib ?
In article captjjmrp_9saig89dkse-p6d0kpbjxmfe1731dffagukvas...@mail.gmail.com, Chris Angelico ros...@gmail.com wrote: Actually, this is one place where I disagree with the current decision of the Python core devs: I think bindings for other popular databases (most notably PostgreSQL, and probably MySQL since it's so widely used) ought to be included in core, rather than being shoved off to PyPI. Databasing is so important to today's world that it would really help if people had all the options right there in core, if only so they're more findable (if you're browsing docs.python.org, you won't know that psycopg is available). Currently the policy seems to be we don't include the server so why should we include the client; I disagree, I think the client would stand nicely on its own. (Does Python have a DNS server module? DNS client? I haven't dug deep, but I'm pretty sure I can do name lookups in Python, yet running a DNS server is sufficiently arcane that it can, quite rightly, be pushed off to PyPI.) But this is minor, and tangential to this discussion. For the bindings to be useful, Python batteries-included distributions (like python.org installers) would either need to also ship the various DB client libraries for all supported platforms (including Windows), which adds complexity and potentially intractable license issues, or there would need to be reverse-engineered implementations of the client libs or wire protocols, either option adding fragility and complex testing issues. DNS client lookups use published, well-understood Internet-standard protocols, not at all like talking to a third-party database, be it open-source or not. Sqlite3 is certainly an anomaly in that it is not-only open source but designed to be a lightweight, compatible library that runs on just about everything, and with a fanatical devotion to compatibility and documentation. These days just about every major product or operating system platform ships with or uses a copy of sqllite3 for something. -- Ned Deily, n...@acm.org -- http://mail.python.org/mailman/listinfo/python-list
Re: python-noob - which container is appropriate for later exporting into mySql + matplotlib ?
Steven D'Aprano wrote: On Fri, 12 Apr 2013 23:26:05 +, Cousin Stanley wrote: The firefox browser keeps different sqlite database files for various uses Yes, and I *really* wish they wouldn't. It's my number 1 cause of major problems with Firefox. Problems with software of any flavor, especially software that is used regularly and upon which we are somewhat dependent, are always a source of frustration My own personal use of firefox over the years has been limited as I have not used it for my primary browser and have not experienced any problems with its bookmarks I use opera as my primary browser and would very much like to convert the plain-vanilla bookmark.adr file that opera uses into an sqlite data base for diversity in bookmark searches that would be independent of reglular browser usage $ grep FOLDER ~/.opera/bookmarks.adr | wc -l 631 $ grep URL ~/.opera/bookmarks.adr | wc -l 14944 http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox Although there have been many reports entailing corruption of the places.sqlite file, it isn't apparent to me from the link above that sqlite itself is the culprit Could the complexity/bugginess of the firefox code possibly be the cause instead ? If Firefox works normally when you first open it after starting up the computer but multiple symptoms arise after you close and later reopen Firefox, it's likely that a Firefox process from a previous session did not close properly and the Places database ( places.sqlite file ) is locked. If you check the headers of any of my posts here you will find that I post with a python-based news client named XPN that also uses sqlite for persistent storage, one sqlite database for each different newsgroup I've used xpn daily for many years and have never experienced a corrupted sqlite database file firefox + sqlite buggy ? ... :-( python + sqlite ok, hooray :-) Using a database for such lightweight data as bookmarks is, in my opinion, gross overkill and adds to the complexity of Firefox. More complexity leads to more bugs, e.g.: https://bugzilla.mozilla.org/show_bug.cgi?id=465684#c11 https://bugzilla.mozilla.org/show_bug.cgi?id=431558 These pages show problems that are 4 and 5 years old from 2008 2009 and are marked as Status: RESOLVED FIXED at the top of the page Are you still having firefox bookmark problems today ? -- Stanley C. Kitching Human Being Phoenix, Arizona -- http://mail.python.org/mailman/listinfo/python-list
howto remove the thousand separator
Hi, I came across a problem that when i deal with int data with ',' as thousand separator, such as 12,916, i can not change it into int() or float(). How can i remove the comma in int data? Any reply will be appreciated!! Best, Chen -- http://mail.python.org/mailman/listinfo/python-list
Re: howto remove the thousand separator
On Sun, Apr 14, 2013 at 11:57 AM, pyth0n3r pyth0...@gmail.com wrote: I came across a problem that when i deal with int data with ',' as thousand separator, such as 12,916, i can not change it into int() or float(). How can i remove the comma in int data? Any reply will be appreciated!! cleaned='' for c in myStringNumber: if c != ',': cleaned+=c int(cleaned) mark -- http://mail.python.org/mailman/listinfo/python-list
Re: howto remove the thousand separator
On 04/14/2013 02:57 PM, pyth0n3r wrote: Hi, I came across a problem that when i deal with int data with ',' as thousand separator, such as 12,916, i can not change it into int() or float(). How can i remove the comma in int data? Any reply will be appreciated!! Best, Chen I would do int(num.replace(',', '')) -m -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ When a friend succeeds, I die a little. Gore Vidal -- http://mail.python.org/mailman/listinfo/python-list
Re: howto remove the thousand separator
On Mon, 15 Apr 2013 02:57:35 +0800 pyth0n3r pyth0...@gmail.com wrote: float(). How can i remove the comma in int data? Any reply will be int(n.replace(',', '')) -- D'Arcy J.M. Cain da...@druid.net | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416 788 2246 (DoD#0082)(eNTP) | what's for dinner. IM: da...@vex.net, VOIP: sip:da...@vex.net -- http://mail.python.org/mailman/listinfo/python-list
Re: howto remove the thousand separator
I would do int(num.replace(',', '')) That's much more pythonic than my C-ish version Mark -- http://mail.python.org/mailman/listinfo/python-list
Re: howto remove the thousand separator
On 14/04/2013 19:57, pyth0n3r wrote: Hi, I came across a problem that when i deal with int data with ',' as thousand separator, such as 12,916, i can not change it into int() or float(). How can i remove the comma in int data? Any reply will be appreciated!! Best, Chen Use the string replace method thus. '12,916'.replace(',', '') '12916' -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: python-noob - which container is appropriate for later exporting into mySql + matplotlib ?
On 2013-04-14 09:40, Ned Deily wrote: DNS client lookups use published, well-understood Internet-standard protocols, not at all like talking to a third-party database, be it open-source or not. That said, even though DNS is a publicly documented standard, I've reached for DNS code in the Python stdlib on multiple occasions (usually to try and snag the MX record for a customer, so smtplib can send stuff to it), and get disappointed each time. I'd really love if there was a simple DNS-lookup module available in the stdlib, especially if it allowed overriding the server to ask. I mean...POP, IMAP and SMTP are all publicly documented standards that Python makes easily accessible. DNS would be a good addition. -tkc -- http://mail.python.org/mailman/listinfo/python-list
Re: python-noob - which container is appropriate for later exporting into mySql + matplotlib ?
On Mon, Apr 15, 2013 at 2:40 AM, Ned Deily n...@acm.org wrote: In article captjjmrp_9saig89dkse-p6d0kpbjxmfe1731dffagukvas...@mail.gmail.com, Chris Angelico ros...@gmail.com wrote: Actually, this is one place where I disagree with the current decision of the Python core devs: I think bindings for other popular databases (most notably PostgreSQL, and probably MySQL since it's so widely used) ought to be included in core, rather than being shoved off to PyPI. Databasing is so important to today's world that it would really help if people had all the options right there in core, if only so they're more findable (if you're browsing docs.python.org, you won't know that psycopg is available). Currently the policy seems to be we don't include the server so why should we include the client; I disagree, I think the client would stand nicely on its own. (Does Python have a DNS server module? DNS client? I haven't dug deep, but I'm pretty sure I can do name lookups in Python, yet running a DNS server is sufficiently arcane that it can, quite rightly, be pushed off to PyPI.) But this is minor, and tangential to this discussion. For the bindings to be useful, Python batteries-included distributions (like python.org installers) would either need to also ship the various DB client libraries for all supported platforms (including Windows), which adds complexity and potentially intractable license issues, or there would need to be reverse-engineered implementations of the client libs or wire protocols, either option adding fragility and complex testing issues. DNS client lookups use published, well-understood Internet-standard protocols, not at all like talking to a third-party database, be it open-source or not. Sqlite3 is certainly an anomaly in that it is not-only open source but designed to be a lightweight, compatible library that runs on just about everything, and with a fanatical devotion to compatibility and documentation. These days just about every major product or operating system platform ships with or uses a copy of sqllite3 for something. Understandable, but I'm actually referencing a discussion on either python-dev or python-ideas where the statement was made that it didn't make sense to include the client for something that the server for wasn't included. I can't find the discussion thread off-hand, but that, rather than the portability/complication issues, seemed to be the primary line of argument. I don't know about any others, but PostgreSQL's wire protocol isn't all that difficult to work with, and since we're talking about something where the far end is almost certainly going to consume some time, it wouldn't hurt to implement it in pure Python. Based on http://wiki.postgresql.org/wiki/Python it seems there are a few modules that do just that (unchecked, but if they work on any platform and don't require libpq, I strongly suspect they use Python's own networking); if one of those is of sufficient code quality for the stdlib, I think it would be an excellent addition. However, I am not a core dev, therefore sqlite is the only one included. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: python-noob - which container is appropriate for later exporting into mySql + matplotlib ?
In article mailman.605.1365973547.3114.python-l...@python.org, Tim Chase python.l...@tim.thechases.com wrote: I'd really love if there was a simple DNS-lookup module available in the stdlib, especially if it allowed overriding the server to ask. pip install dnspython -- http://mail.python.org/mailman/listinfo/python-list
Grammar question: Englisn and Python: qualified names
Quirky question time! When you read out a qualified name, eg collections.OrderedDict, do you read the qualifier (collections dot ordered dict), or do you elide it (ordered dict)? I ask because it makes a difference to talking about just one of them: ... or possibly a collections.OrderedDict... ... or possibly an collections.OrderedDict... Written, the latter looks completely wrong; but if the name is read in its short form, with the collections part being implicit, then an is clearly correct! What do you think, experts and others? ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Using xtopdf and pypyodbc to publish MS Access database data to PDF
Wrote a program that lets you publish your MS Access database data to PDF, using Python, ReportLab, xtopdf (my toolkit) and pypyodbc. Sharing it here. Link: http://jugad2.blogspot.in/2013/04/using-xtopdf-and-pypyodbc-to-publish-ms.html Note: Saw some comments about my blog post on the Python Reddit, which made me realize that I had not explained that similar code can be used to publish data from any ODBC database (for which you have an ODBC driver, and which is supported by pypyodbc), to PDF. All you have to do is change the connection string in the code, and maybe a few other small tweaks for differences between SQL dialects of different RDBMS's. Enjoy. - Vasudev Ram www.dancingbison.com jugad2.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Grammar question: Englisn and Python: qualified names
On 14/04/2013 22:50, Chris Angelico wrote: Quirky question time! When you read out a qualified name, eg collections.OrderedDict, do you read the qualifier (collections dot ordered dict), or do you elide it (ordered dict)? I ask because it makes a difference to talking about just one of them: ... or possibly a collections.OrderedDict... ... or possibly an collections.OrderedDict... Written, the latter looks completely wrong; but if the name is read in its short form, with the collections part being implicit, then an is clearly correct! What do you think, experts and others? I read what's there: a collections.OrderedDict vs an OrderedDict. -- http://mail.python.org/mailman/listinfo/python-list
Threadpool item mailboxes design problem
What is the best approach to implementing actors that accept and post messages (and have no other external contacts). So far what I've come up with is something like: actors = {} mailboxs = {} Stuff actors with actor instances, mailboxes with multiprocessing.queue instances. (Actors and mailboxes will have identical keys, which are id#, but it's got to be a dict rather than a list, because too many are rolled out to disk.) And I'm planning of having the actors running simultaneously and continually in a threadpool that just loops through the actors that are assigned to each thread of the pool. This lets any actor post messages to the mailbox of any other actor that it has the id of, and lets him read his own mail without multi-processing clashes. But I'm quite uncertain that this is the best way, because, if nothing else, it means that each mailbox needs to be allocated large enough to handle the maximum amount of mail it could possibly receive. (I suppose I could implement some sort of wait awhile and try again method.) It would, however, be better if the mailbox could be specific to the threadpool instance, so less space would be wasted. Or if the queues could dynamically resize. Or if there was a threadsafe dict. Or... But I don't know that any of these are feasible. (I mean, yes, I could write all the mail to a database, but is that a better answer, or even a good one?) -- Charles Hixson -- http://mail.python.org/mailman/listinfo/python-list
Re: howto remove the thousand separator
On Sun, 14 Apr 2013 12:06:12 -0700, Mark Janssen wrote: cleaned='' for c in myStringNumber: if c != ',': cleaned+=c int(cleaned) Please don't write code like that. Firstly, it's long and bloated, and runs at the speed of Python, not C. Second, it runs at the speed of SOO Python, not fast Python, due to being an O(N**2) algorithm. If you don't know what O(N**2) means, you should read this for an introduction: http://www.joelonsoftware.com/articles/fog000319.html -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Grammar question: Englisn and Python: qualified names
On 04/14/2013 02:50 PM, Chris Angelico wrote: Quirky question time! When you read out a qualified name, eg collections.OrderedDict, do you read the qualifier (collections dot ordered dict), or do you elide it (ordered dict)? I ask because it makes a difference to talking about just one of them: ... or possibly a collections.OrderedDict... ... or possibly an collections.OrderedDict... Written, the latter looks completely wrong; but if the name is read in its short form, with the collections part being implicit, then an is clearly correct! What do you think, experts and others? Explicit is better than implicit. ;) collections dot ordereddict -- http://mail.python.org/mailman/listinfo/python-list
Re: howto remove the thousand separator
On Sun, Apr 14, 2013 at 5:29 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sun, 14 Apr 2013 12:06:12 -0700, Mark Janssen wrote: cleaned='' for c in myStringNumber: if c != ',': cleaned+=c int(cleaned) due to being an O(N**2) algorithm. What on earth makes you think that is an O(n**2) algorithm and not O(n)? Mark -- http://mail.python.org/mailman/listinfo/python-list
Re: howto remove the thousand separator
On Sun, 14 Apr 2013 17:44:28 -0700, Mark Janssen wrote: On Sun, Apr 14, 2013 at 5:29 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sun, 14 Apr 2013 12:06:12 -0700, Mark Janssen wrote: cleaned='' for c in myStringNumber: if c != ',': cleaned+=c int(cleaned) due to being an O(N**2) algorithm. What on earth makes you think that is an O(n**2) algorithm and not O(n)? Strings are immutable. Consider building up a single string from four substrings: s = '' s += 'fe' s += 'fi' s += 'fo' s += 'fum' Python *might* optimize the first concatenation, '' + 'fe', to just reuse 'fe', (but it might not). Let's assume it does, so that no copying is needed. Then it gets to the second concatenation, and now it has to copy characters, because strings are immutable and cannot be modified in place. Showing the *running* total of characters copied: 'fe' + 'fi' = 'fefi' # four characters copied 'fefi' + 'fo' = 'fefifo' # 4 + 6 = ten characters copied 'fefifo' + 'fum' = 'fefifofum' # 10 + 9 = nineteen characters copied Notice how each intermediate substring gets copied repeatedly? In order to build up a string of length 9, we've had to copy at least 19 characters. With only four substrings, it's not terribly obvious how badly this performs. So let's add some more substrings, and see how the running total increases: 'fefifofum' + 'foo' = 'fefifofumfoo' # 19 + 12 = 31 'fefifofumfoo' + 'bar' = 'fefifofumfoobar' # 31 + 15 = 46 'fefifofumfoobar' + 'baz' = 'fefifofumfoobarbaz' # 46 + 18 = 64 'fefifofumfoobarbaz' + 'spam' = 'fefifofumfoobarbazspam' # 64 + 22 = 86 To build up a string of length 22, we've had to copy, and re-copy, and re- re-copy, 86 characters in total. And the string gets bigger, the inefficiency gets worse. Each substring (except the very last one) gets copied multiple times; the number of times it gets copied is proportional to the number of substrings. If the substrings are individual characters, then each character is copied a number of times proportional to the number of characters N; since there are N characters, each being copied (proportional to) N times, that makes N*N or N**2. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: howto remove the thousand separator
On Mon, Apr 15, 2013 at 11:14 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sun, 14 Apr 2013 17:44:28 -0700, Mark Janssen wrote: What on earth makes you think that is an O(n**2) algorithm and not O(n)? Python *might* optimize the first concatenation, '' + 'fe', to just reuse 'fe', (but it might not). Let's assume it does, so that no copying is needed. Then it gets to the second concatenation, and now it has to copy characters, because strings are immutable and cannot be modified in place. There are actually a lot of optimizations done, so it might turn out to be O(n) in practice. But strictly in the Python code, yes, this is definitely O(n*n). ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: classes and sub classes?
NwInvDb = NetworkInventoryDatabase, yes you are correct, it creates the database handle and makes it ready for use. I am interested in opinions. I for one dislike abbreviations on the theory that programs are read more than they are written. I would probably use this variable name: network_inventory_db_connection = ... And yes, I'm aware that db is an abbreviation. I believe I am following a few Zen principles: Beautiful is better than ugly. Explicit is better than implicit. Readability counts. Special cases aren't special enough to break the rules, Although practicality beats purity. What would others use? -- http://mail.python.org/mailman/listinfo/python-list
Re: classes and sub classes?
On 15/04/2013 02:38, Jason Friedman wrote: NwInvDb = NetworkInventoryDatabase, yes you are correct, it creates the database handle and makes it ready for use. I am interested in opinions. I for one dislike abbreviations on the theory that programs are read more than they are written. I would probably use this variable name: network_inventory_db_connection = ... And yes, I'm aware that db is an abbreviation. I believe I am following a few Zen principles: Beautiful is better than ugly. Explicit is better than implicit. Readability counts. Special cases aren't special enough to break the rules, Although practicality beats purity. What would others use? network could be abbreviated to net, inventory to inv (maybe OK in this context; in another context it could an abbreviation for inverse), and connection to con (maybe), giving net_inv_db_con, or net_inv_db_connection. The trick, of course, is to make it clear, but not annoyingly long. Python itself has def, len, and lstrip, not define, length and left_strip. -- http://mail.python.org/mailman/listinfo/python-list
Re: howto remove the thousand separator
On 15/04/2013 02:14, Steven D'Aprano wrote: On Sun, 14 Apr 2013 17:44:28 -0700, Mark Janssen wrote: On Sun, Apr 14, 2013 at 5:29 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sun, 14 Apr 2013 12:06:12 -0700, Mark Janssen wrote: cleaned='' for c in myStringNumber: if c != ',': cleaned+=c int(cleaned) due to being an O(N**2) algorithm. What on earth makes you think that is an O(n**2) algorithm and not O(n)? Strings are immutable. Consider building up a single string from four substrings: s = '' s += 'fe' s += 'fi' s += 'fo' s += 'fum' Python *might* optimize the first concatenation, '' + 'fe', to just reuse 'fe', (but it might not). Let's assume it does, so that no copying is needed. Then it gets to the second concatenation, and now it has to copy characters, because strings are immutable and cannot be modified in place. Actually, I believe that CPython is optimised to modify strings in place where possible, so that the above would surprisingly turn out to be O(n). See the following thread where I asked about this: http://groups.google.com/group/comp.lang.python/browse_thread/thread/990a695fe2d85c52 (Sorry for linking to Google Groups. Does anyone know of a better c.l.p. web archive?) -- http://mail.python.org/mailman/listinfo/python-list
Re: howto remove the thousand separator
On Mon, 15 Apr 2013 11:29:17 +1000, Chris Angelico wrote: There are actually a lot of optimizations done, so it might turn out to be O(n) in practice. But strictly in the Python code, yes, this is definitely O(n*n). In any event, Janssen should cease and desist offering advice here if he can't do better than that. -- http://mail.python.org/mailman/listinfo/python-list
Re: Threadpool item mailboxes design problem
On Apr 14, 2013 4:27 PM, Charles Hixson charleshi...@earthlink.net wrote: What is the best approach to implementing actors that accept and post messages (and have no other external contacts). You might look at how some of the existing Python actor libraries are implemented (perhaps one of these might even save you from reinventing the wheel): http://www.pykka.org/en/latest/ http://www.kamaelia.org/Docs/Axon/Axon.html https://pypi.python.org/pypi/pulsar Kinda old: http://candygram.sourceforge.net/contents.html http://osl.cs.uiuc.edu/parley/ So far what I've come up with is something like: actors = {} mailboxs = {} Stuff actors with actor instances, mailboxes with multiprocessing.queue instances. (Actors and mailboxes will have identical keys, which are id#, but it's got to be a dict rather than a list, because too many are rolled out to disk.) And I'm planning of having the actors running simultaneously and continually in a threadpool that just loops through the actors that are assigned to each thread of the pool. snip It would, however, be better if the mailbox could be specific to the threadpool instance, so less space would be wasted. Or if the queues could dynamically resize. Or if there was a threadsafe dict. Or... But I don't know that any of these are feasible. (I mean, yes, I could write all the mail to a database, but is that a better answer, or even a good one?) My recollection is that the built-in collection types are threadsafe at least to the limited extent that the operations exposed by their APIs (e.g. dict.setdefault) are atomic. Perhaps someone will be able to chime in with more details. -- http://mail.python.org/mailman/listinfo/python-list
Re: howto remove the thousand separator
In article kkfodv$f5m$1...@news.albasani.net, Walter Hurry walterhu...@lavabit.com wrote: On Mon, 15 Apr 2013 11:29:17 +1000, Chris Angelico wrote: There are actually a lot of optimizations done, so it might turn out to be O(n) in practice. But strictly in the Python code, yes, this is definitely O(n*n). In any event, Janssen should cease and desist offering advice here if he can't do better than that. That's a little harsh. Sure, it was a sub-optimal way to write the code (for all the reasons people mentioned), but it engendered a good discussion. -- http://mail.python.org/mailman/listinfo/python-list
Re: Threadpool item mailboxes design problem
Charles Hixson於 2013年4月15日星期一UTC+8上午7時12分11秒寫道: What is the best approach to implementing actors that accept and post messages (and have no other external contacts). So far what I've come up with is something like: actors = {} mailboxs = {} Stuff actors with actor instances, mailboxes with multiprocessing.queue instances. (Actors and mailboxes will have identical keys, which are id#, but it's got to be a dict rather than a list, because too many are rolled out to disk.) And I'm planning of having the actors running simultaneously and continually in a threadpool that just loops through the actors that are assigned to each thread of the pool. This lets any actor post messages to the mailbox of any other actor that it has the id of, and lets him read his own mail without multi-processing clashes. But I'm quite uncertain that this is the best way, because, if nothing else, it means that each mailbox needs to be allocated large enough to handle the maximum amount of mail it could possibly receive. (I suppose I could implement some sort of wait awhile and try again method.) It would, however, be better if the mailbox could be specific to the threadpool instance, so less space would be wasted. Or if the queues could dynamically resize. Or if there was a threadsafe dict. Or... But I don't know that any of these are feasible. (I mean, yes, I could write all the mail to a database, but is that a better answer, or even a good one?) -- Charles Hixson Actors can receive and response to messages to take actions accordingly in time in one or more cores. The timer is required and the message read/write operations are required. Do you want the actors to gain new methods to evolve in the long run? -- http://mail.python.org/mailman/listinfo/python-list
The type/object distinction and possible synthesis of OOP and imperative programming languages
Hello, I'm new to the list and hoping this might be the right place to introduce something that has provoked a bit of an argument in my programming community. I'm from the Python programming community. Python is an interpreted language. Since 2001, Python's has migrated towards a pure Object model (ref: http://www.python.org/download/releases/2.2/descrintro/). Prior to then, it had both types and classes and these types were anchored to the underlying C code and the machine/hardware architecture itself. After the 2001 type/class unification , it went towards Alan Kay's ideal of everything is an object. From then, every user-defined class inherited from the abstract Object, rooted in nothing but a pure abstract ideal. The parser, lexer, and such spin these abstrations into something that can be run on the actual hardware. As a contrast, this is very distinct from C++, where everything is concretely rooted in the language's type model which in *itself* is rooted (from it's long history) in the CPU architecture. The STL, for example, has many Container types, but each of them requires using a single concrete type for homogenous containers or uses machine pointers to hold arbitrary items in heterogeneous containers (caveat: I haven't programmed in C++ for a long time, so it's possible this might not be correct anymore). My question is: Is there something in the Computer Science literature that has noticed this distinction/development in programming language design and history? It's very significant to me, because as languages went higher and higher to this pure OOP model, the programmer+data ecosystem tended towards very personal object hierarchies because now the hardware no longer formed a common basis of interaction (note also, OOPs promise of re-usable code never materialized). It's not unlike LISP, where the power of its general language architecture tended towards hyperpersonal mini macro languages -- making it hardly used, in practice, though it was and is so powerful, in theory. That all being said, the thrust of this whole effort is to possibly advance Computer Science and language design, because in-between the purely concrete object architecture of the imperative programming languages and the purely abstract object architecture of object-oriented programming languages is a possible middle ground that could unite them all. Thank you for your time. Mark Janssen Tacoma, Washington -- http://mail.python.org/mailman/listinfo/python-list
Re: The type/object distinction and possible synthesis of OOP and imperative programming languages
Note: cross-posting to mailing lists does not work well. Hence the reply only to python-list and the gmane mirror. On 4/14/2013 11:48 PM, Mark Janssen wrote: Python is an interpreted language. I consider this a useless or even deceptive statement. Python is an object-based algorithm language. The CPython implementation (currently) *compiles* Python code to a virtual machine bytecode, similar to Java bytecode. This could change. Jython translates to Java, which is then compiled to Java bytecode. Do you call Java an 'interpreted' language? There are compilers that compile Python to the same 'object code' that C is compiled to. Since 2001, Python's has migrated towards a pure Object model. It migrated towards a pure class model. model (ref: http://www.python.org/download/releases/2.2/descrintro/). Prior to then, it had both types and classes and these types were anchored to the underlying C code and the machine/hardware architecture itself. I started with Python 1.3 and I have no idea what you mean by this. I think you are heavily confusing Python the language and CPython the implementation. After the 2001 type/class unification , it went towards Alan Kay's ideal of everything is an object. Everything has always been an object with value and identity. This stands in contrast to the assemble/C model that everything (except registers) is a block of linear memory with an address. My question is: Is there something in the Computer Science literature that has noticed this distinction/development in programming language design and history? To me, there should be, since this is a fundamental distinction in data models. I think the biggest problem in shifting from C to Python is 'getting' the data model difference. For Lispers, the difference is the syntax. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: howto remove the thousand separator
In article kkfnun$kpj$1...@dont-email.me, Rotwang sg...@hotmail.co.uk wrote: (Sorry for linking to Google Groups. Does anyone know of a better c.l.p. web archive?) http://dir.gmane.org/gmane.comp.python.general -- Ned Deily, n...@acm.org -- http://mail.python.org/mailman/listinfo/python-list
Re: Grammar question: Englisn and Python: qualified names
Hi Chris, On 2013-04-14 23:50, Chris Angelico wrote: Quirky question time! When you read out a qualified name, eg collections.OrderedDict, do you read the qualifier (collections dot ordered dict), or do you elide it (ordered dict)? I ask because it makes a difference to talking about just one of them: ... or possibly a collections.OrderedDict... ... or possibly an collections.OrderedDict... Written, the latter looks completely wrong; but if the name is read in its short form, with the collections part being implicit, then an is clearly correct! What do you think, experts and others? I think if you _write_ collections.OrderedDict, the article you _write_ in front should match this. The phrase an collections.OrderedDict looks odd to me, and if I read it somewhere, it wouldn't cross my mind that the writer used an collections.OrderedDict with the idea not to pronounce collections. ;-) In my opinion, this is too subtle. On the other hand, when you _speak_ about the ordered dict, use the article matching what you actually say. Best regards, Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: [TYPES] The type/object distinction and possible synthesis of OOP and imperative programming languages
I'm not quite sure I understand your question, but I'll give it a shot. :-) The C/C++ model, in which the types are anchored to the machine hardware, in the exception, not the rule. In the academic literature, type theory is almost entirely focused on studying abstract models of computation that are purely mathematical, and bear no resemblance to the underlying hardware. The lambda calculus is the most general, and most commonly used formalism, but there are many others; e.g. Featherweight Java provides a formal model of objects and classes as they are used in Java. Types and Programming Languages, by Benjamin Pierce, is an excellent introductory textbook which describes how various language features, including objects, can be formalized. If you are interested in OOP, Abadi and Cardelli's Theory of Objects is the obvious place to start, although I'd recommend reading Pierce's book first if you want to understand it. :-) Abadi and Cardelli discuss both class-based languages, and pure object languages. If you are interested in the type/object distinction in particular, then I'll shamelessly plug my own thesis: Pure Subtype Systems (available online), which describes a formal model in which types are objects, and objects are types. If you are familiar with the Self language, then you can think of it as a type system for Self. Once you have a type system in place, it's usually fairly straightforward to compile a language down to actual hardware. An interpreter, like that used in Python, is generally needed only for untyped or dynamic languages. There are various practical considerations -- memory layout, boxed or unboxed data types, garbage collection, etc. -- but the basic techniques are described in any compiler textbook. Research in the areas of typed assembly languages and proof carrying code are concerned with ensuring that the translation from high-level language to assembly language is sound, and well-typed at all stages. -DeLesley On Sun, Apr 14, 2013 at 8:48 PM, Mark Janssen dreamingforw...@gmail.comwrote: [ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list] Hello, I'm new to the list and hoping this might be the right place to introduce something that has provoked a bit of an argument in my programming community. I'm from the Python programming community. Python is an interpreted language. Since 2001, Python's has migrated towards a pure Object model (ref: http://www.python.org/download/releases/2.2/descrintro/). Prior to then, it had both types and classes and these types were anchored to the underlying C code and the machine/hardware architecture itself. After the 2001 type/class unification , it went towards Alan Kay's ideal of everything is an object. From then, every user-defined class inherited from the abstract Object, rooted in nothing but a pure abstract ideal. The parser, lexer, and such spin these abstrations into something that can be run on the actual hardware. As a contrast, this is very distinct from C++, where everything is concretely rooted in the language's type model which in *itself* is rooted (from it's long history) in the CPU architecture. The STL, for example, has many Container types, but each of them requires using a single concrete type for homogenous containers or uses machine pointers to hold arbitrary items in heterogeneous containers (caveat: I haven't programmed in C++ for a long time, so it's possible this might not be correct anymore). My question is: Is there something in the Computer Science literature that has noticed this distinction/development in programming language design and history? It's very significant to me, because as languages went higher and higher to this pure OOP model, the programmer+data ecosystem tended towards very personal object hierarchies because now the hardware no longer formed a common basis of interaction (note also, OOPs promise of re-usable code never materialized). It's not unlike LISP, where the power of its general language architecture tended towards hyperpersonal mini macro languages -- making it hardly used, in practice, though it was and is so powerful, in theory. That all being said, the thrust of this whole effort is to possibly advance Computer Science and language design, because in-between the purely concrete object architecture of the imperative programming languages and the purely abstract object architecture of object-oriented programming languages is a possible middle ground that could unite them all. Thank you for your time. Mark Janssen Tacoma, Washington -- http://mail.python.org/mailman/listinfo/python-list
[issue13922] argparse handling multiple -- in args improperly
paul j3 added the comment: This patch removes only one '--', the one that put a '-' in the 'arg_strings_pattern'. It does this in 'consume_positionals' right before calling 'take_action'. As before it does not do this if nargs is PARSER or REMAINDER. test_argparse.py has two DoubleDashRemoval cases, that attempt to highlight the changes from production (delete all --) and development (delete first -- in each positional group) versions. I have not made any changes to the documentation. All it says now is: If you have positional arguments that must begin with - and don’t look like negative numbers, you can insert the pseudo-argument '--' which tells parse_args() that everything after that is a positional argument: -- Added file: http://bugs.python.org/file29845/dbldash.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13922 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17720] pickle.py's load_appends should call append() on objects other than lists
Alexandre Vassalotti added the comment: Alright alright! Here's a less bogus patch. :) -- stage: needs patch - patch review Added file: http://bugs.python.org/file29846/fix_loads_appends.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17720 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17725] English mistake in Extending and Embedding Python doc page.
New submission from Kyle Simpson: The second sentence in http://docs.python.org/3/extending/index.html says: Those modules can define new functions but also new object types and their methods. The word but doesn't make sense here. I suppose that the author meant to write: Those modules can not only define new functions but also new object types and their methods. -- assignee: docs@python components: Documentation messages: 186886 nosy: Kyle.Simpson, docs@python priority: normal severity: normal status: open title: English mistake in Extending and Embedding Python doc page. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17725 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17636] Modify IMPORT_FROM to fallback on sys.modules
Nick Coghlan added the comment: Thanks for working through that Phillip - falling back to sys.modules when the expected attribute was missing is actually something I suggested as a possibility years ago, and Guido's response at the time was If it was that easy, someone would have done it already. Your analysis is one of the pieces that was missing, along with Brett's insight that the code that needs the fallback is the IMPORT_FROM bytecode rather than the import implementation. I'm going to close the original circular import bug as being superseded by this one. -- nosy: +ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17636 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17725] English mistake in Extending and Embedding Python doc page.
Kyle Simpson added the comment: I have provided a patch. -- keywords: +patch Added file: http://bugs.python.org/file29847/issue17725.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17725 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue992389] attribute error due to circular import
Nick Coghlan added the comment: The implementation of issue #17636 (making IMPORT_FROM fall back to sys.modules when appropriate) will make import x.y and from x import y equivalent for resolution purposes during import. That covers off the subset of circular references that we want to allow, so I'm closing this one in favour of the more precisely defined proposal. -- resolution: - duplicate status: open - closed superseder: - Modify IMPORT_FROM to fallback on sys.modules ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue992389 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17716] From ... import fails when parent package failed but child module succeeded, yet works in std import case
Nick Coghlan added the comment: The interpreter level problem covered by the current issue is that the difference between import mypkg.module_a and from mypkg import module_a is masking the fact that it is the original import mypkg that failed, and may still fail on the second and subsequent imports. That is, the user level code is at best dubious, but the interpreter is spitting out misleading error messages that obscure the real cause of the failure. In the tests for #17636, we should ensure that all of the following consistently raise RuntimeError when the import fails (on both the initial and subsequent import attempts): import badpkg.goodmod raise RuntimeError(Always fails) from badpkg import goodmod raise RuntimeError(Always fails) from . import goodmod raise RuntimeError(Always fails) Where that is the __init__.py code in the following layout: badpkg/ __init__.py goodmod.py -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17716 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17668] re.split loses characters matching ungrouped parts of a pattern
Changes by Mike Hoy mho...@gmail.com: -- nosy: +mikehoy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17668 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17726] faq/design: improve clarity
New submission from Tshepang Lekhonkhobe: I puzzled a bit on what that sentence meant. -- assignee: docs@python components: Documentation files: diff messages: 186891 nosy: docs@python, tshepang priority: normal severity: normal status: open title: faq/design: improve clarity versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file29848/diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17726 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17716] From ... import fails when parent package failed but child module succeeded, yet works in std import case
Nick Coghlan added the comment: More generally, I think we may have to revisit the question of what we remove from sys.modules on failure if, as a side effect of the import, a child module was imported successfully. In this situation, the possibilities are: 1. Remove the parent module, and all child modules. We don't currently do this because importing the child modules may have had side effects. However, I'm not sure this reasoning is sound, as the section of __init__.py before the failure may have had side effects too, and we don't let that stop us from removing the parent module. 2. Remove just the parent module. That's what we currently do, and it's a problem because we're knowingly breaking one of the import state invariants (i.e. if a non top-level module is present in sys.modules, then all parent modules in the chain can be assumed to also be in sys.modules) 3. Leave the partially initialised parent module in sys.modules as well. This would be a bad idea, since it would lead to very inconsistent behaviour as to whether or not the parent module was left in sys.modules based on the contents of __init__.py To be honest, I think purging the entire subtree (option 1 above) would be better than what we do now - breaking state invariants is bad, because it can lead to surprising errors a long way from the actual source of the problem. -- versions: -Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17716 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17726] faq/design: improve clarity
Roundup Robot added the comment: New changeset ab35b5e81317 by Georg Brandl in branch '2.7': Closes #17726: small clarification in design FAQ. http://hg.python.org/cpython/rev/ab35b5e81317 New changeset f6fdf3457f74 by Georg Brandl in branch '3.3': Closes #17726: small clarification in design FAQ. http://hg.python.org/cpython/rev/f6fdf3457f74 -- nosy: +python-dev resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17726 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17711] Persistent id in pickle with protocol version 0
Serhiy Storchaka added the comment: I think a string with character codes 256 will be better for test_protocol0_is_ascii_only(). It can be latin1 encoded (Python 2 allows any 8-bit strings). PyUnicode_AsASCIIString() can be slower than _PyUnicode_AsStringAndSize() (actually PyUnicode_AsUTF8AndSize()) because the latter can use cached value. You can check if the persistent id only contains ASCII characters by checking PyUnicode_GET_LENGTH(pid_str) == size. And what are you going to do with the fact that in Python 2 you can pickle non-ascii persistent ids, which will not be able to unpickle in Python 3? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17711 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17661] documentation of '%r' links to the wrong repr
Georg Brandl added the comment: Fixed, thanks. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17661 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17661] documentation of '%r' links to the wrong repr
Roundup Robot added the comment: New changeset dd5e7aef4d5b by Georg Brandl in branch '2.7': Closes #17661: fix references to repr() going to module repr. http://hg.python.org/cpython/rev/dd5e7aef4d5b -- nosy: +python-dev resolution: - fixed stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17661 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17727] document that some distributions change site.py defaults
New submission from Georg Brandl: From the docs@ list: Dear all, the first paragraph of the documentation for the site module states that site.py constructs four directories using a head and tail part, and that one of the tail parts would be lib/pythonX.Y/site-packages on UNIX/Mac. However, in my Python 3.2 installation on Ubuntu 12.04 this is actually lib/python3/dist-packages (so no .Y and a different subdirectory) ! This is also stated in the module’s doc string. I don’t know why the Python documentation says something else, but that should be fixed. Attached a patch to explain why the defaults may look different on some distributions. Please review. -- assignee: docs@python components: Documentation files: site-patch.diff keywords: patch messages: 186897 nosy: barry, docs@python, doko, georg.brandl priority: normal severity: normal stage: patch review status: open title: document that some distributions change site.py defaults type: enhancement versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file29849/site-patch.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17727 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17618] base85 encoding
Serhiy Storchaka added the comment: I want to see both algorithms to be similar so far as it is possible. It might be worth extract and reuse a common code. Mercurial's code looks far more optimal (for example a85encode has a quadratic complexity in result accumulating). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17618 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13638] PyErr_SetFromErrnoWithFilenameObject is undocumented
Roundup Robot added the comment: New changeset 4cc94d30926f by Georg Brandl in branch '2.7': Closes #13638: document PyErr_SetFromErrnoWithFilenameObject, http://hg.python.org/cpython/rev/4cc94d30926f New changeset ee848457930f by Georg Brandl in branch '3.3': Closes #13638: document PyErr_SetFromErrnoWithFilenameObject, http://hg.python.org/cpython/rev/ee848457930f -- nosy: +python-dev resolution: - fixed stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13638 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14462] In re's named group the name cannot contain unicode characters
Roundup Robot added the comment: New changeset 2fa27a3818a2 by Georg Brandl in branch '3.3': Closes #14462: allow any valid Python identifier in sre group names, as documented. http://hg.python.org/cpython/rev/2fa27a3818a2 -- nosy: +python-dev resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14462 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3056] Simplify the Integral ABC
Roundup Robot added the comment: New changeset 4678259af5a4 by Georg Brandl in branch '2.7': The Integral class does not contain implementations for the bit-shifting operations. (See #3056.) http://hg.python.org/cpython/rev/4678259af5a4 New changeset 1d4ba14cc505 by Georg Brandl in branch '3.3': The Integral class does not contain implementations for the bit-shifting operations. (See #3056.) http://hg.python.org/cpython/rev/1d4ba14cc505 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3056 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17728] format() default precisions undocumented
New submission from Georg Brandl: The docs for % formatting say what the default precision for presentation types e, f, g is. I couldn't find the same for format(). -- assignee: eric.smith components: Documentation messages: 186902 nosy: eric.smith, georg.brandl priority: normal severity: normal status: open title: format() default precisions undocumented versions: Python 2.7, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17728 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17729] advocacy howto improvements
New submission from Georg Brandl: From docs@: The howto-advocacy is interesting. You might consider removing the following sentences, which I found personally gave me a negative impression: python hasn't had all the publicity to my mind gives the impression that python is not popular. python is definitely not a toy language that only usable for small tasks. This gives to me the impression that you feel many people think it is. Section who's going to support it? a company needs to be able to call someone, pay for support right now, within one hour, not on a maybe basis. I feel either remove this section or suggest links to three companies providing python support. Section python is freely available , how good can it be? I felt what I wanted to see was not that Linux and apache are good, but why python is good. I think the advocacy howto was written quite a while ago and could use a makeover. -- assignee: docs@python components: Documentation messages: 186903 nosy: akuchling, docs@python, georg.brandl priority: normal severity: normal status: open title: advocacy howto improvements versions: Python 2.7, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17729 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17727] document that some distributions change site.py defaults
Matthias Klose added the comment: the local patch adds as documentation on Debian/Ubuntu: For Debian and derivatives, this sys.path is augmented with directories for packages distributed within the distribution. Local addons go into /usr/local/lib/pythonversion/dist-packages, Debian addons install into /usr/lib/python3/dist-packages. /usr/lib/pythonversion/site-packages is not used. I can improve the local information, but I'm not sure how much should be added/changed in the upstream documentation. So maybe we should add an option for python-config to get the site dirs, or the list of site dirs too? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17727 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13050] RLock support the context manager protocol but this is not documented
Georg Brandl added the comment: Thanks, closing. -- nosy: +georg.brandl resolution: - out of date status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13050 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16551] Cleanup the pure Python pickle implementation
Roundup Robot added the comment: New changeset 3dff836cedef by Serhiy Storchaka in branch 'default': Closes #16551. Cleanup pickle.py. http://hg.python.org/cpython/rev/3dff836cedef -- nosy: +python-dev resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16551 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16550] pickletools.py treats 32bit lengths as signed, but pickle.py as unsigned
Roundup Robot added the comment: New changeset 4ced30417300 by Alexandre Vassalotti in branch '3.3': Issue #16550: Update the opcode descriptions of pickletools to use unsigned http://hg.python.org/cpython/rev/4ced30417300 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16550 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2118] smtplib.SMTP() raises socket.error rather than SMTPConnectError
Roundup Robot added the comment: New changeset adc72ff451dc by R David Murray in branch 'default': #2118: IOError is deprecated, use OSError. http://hg.python.org/cpython/rev/adc72ff451dc -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2118 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15301] os.chown: OverflowError: Python int too large to convert to C long
Serhiy Storchaka added the comment: Thank you, Mark. There is only one question. For what version is it appropriate? Only for 3.4 or for all maintained? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15301 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17413] format_exception() breaks on exception tuples from trace function
R. David Murray added the comment: Thanks Ingrid and Mark. The patch looks good; I put a couple of FYI comments on the review. I'm pretty sure this patch is correct, but I'd like someone with more experience modifying the ceval loop to confirm, so I'm nosying Benjamin. -- nosy: +benjamin.peterson stage: needs patch - commit review versions: -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17413 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17713] test_logging fails in test_compute_rollover_weekly_attime
Roundup Robot added the comment: New changeset 1494daf809c1 by Vinay Sajip in branch 'default': Closes #17713: Fixed bug in test_compute_rollover_weekly_attime. http://hg.python.org/cpython/rev/1494daf809c1 -- resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17713] test_logging fails in test_compute_rollover_weekly_attime
Roundup Robot added the comment: New changeset efda51b85b31 by Vinay Sajip in branch 'default': Issue #17713: additional tweak to test. http://hg.python.org/cpython/rev/efda51b85b31 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15301] os.chown: OverflowError: Python int too large to convert to C long
Larry Hastings added the comment: Oh...! Serhiy, I thought you already checked in the AsIndex stuff. Guess I was asleep at the switch. Certainly the patch should go in for trunk. I'd be comfortable with it going in for 3.3 as a bugfix but that's ultimately Georg's call. I'll give you a comment or two on the diff. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15301 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17703] Trash can mechanism segfault during interpreter finalization in Python 2.7.4
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +benjamin.peterson priority: normal - release blocker ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17703 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17730] code.interact() doesn't support no banner
New submission from Drekin: Currently, there is no way to run code.interact without a banner – empty string still means to print an empty line. If I want that behaviour, I must subclass code.InteractiveConsole and reimplement whole .interact method including the repl logic just not to print a banner. Maybe there should be .print_banner method for this. -- components: Library (Lib) messages: 186914 nosy: Drekin priority: normal severity: normal status: open title: code.interact() doesn't support no banner type: enhancement versions: Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17730 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17703] Trash can mechanism segfault during interpreter finalization in Python 2.7.4
Marc-Andre Lemburg added the comment: On 12.04.2013 20:00, Antoine Pitrou wrote: Marc-André, does this patch work for you? Added file: http://bugs.python.org/file29791/tstate_trashcan.patch Thanks, Antoine. I can try this tomorrow. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17703 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16694] Add pure Python operator module
Antoine Pitrou added the comment: Thank you! One optional thing, the code churn could be minimized in test_operator.py by writing operator = self.module at the beginning of each test method. Otherwise, looks good to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16694 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16163] Wrong name in Lib/pkgutil.py:iter_importers
Roundup Robot added the comment: New changeset c40b50d65a00 by Nick Coghlan in branch '3.3': Close issue #16163: handle submodules in pkgutil.iter_importers http://hg.python.org/cpython/rev/c40b50d65a00 New changeset 3bb5a8a4830e by Nick Coghlan in branch 'default': Merge fix for #16163 from 3.3 http://hg.python.org/cpython/rev/3bb5a8a4830e -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16163 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16163] Wrong name in Lib/pkgutil.py:iter_importers
Changes by Nick Coghlan ncogh...@gmail.com: -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16163 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9682] socket.create_connection error message for domain subpart with invalid length is very confusing
Mike Milkin added the comment: I did not mean to take the decode out of the previos patch. Sorry for the spam. -- Added file: http://bugs.python.org/file29850/Issue9682-full.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9682 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9682] socket.create_connection error message for domain subpart with invalid length is very confusing
Changes by Mike Milkin mmil...@gmail.com: Removed file: http://bugs.python.org/file29834/Issue9682-full.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9682 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17703] Trash can mechanism segfault during interpreter finalization in Python 2.7.4
Benjamin Peterson added the comment: Yes, let's not break thing in point releases. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17703 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17044] Implement PEP 422: Simple class initialisation hook
Daniel Urban added the comment: I've attached a new patch. With this patch, type.__prepare__ has an optional keyword-only argument 'namespace', and returns it if it's specified. Also, __init_class__ is passed an argument: a mapping proxy of the mapping originally returned by __prepare__. Would it make sense to have the signature of __init_class__ parallel meta.__init__() I don't think so, because some of the arguments (name, bases) would be mostly useless, others would have a different meaning (namespace). Although, passing the keyword arguments from the class header might make some sense ... I'm not sure. If everybody agrees with these changes, I'll create a patch for the PEP too. -- Added file: http://bugs.python.org/file29851/pep422_6.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17044 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15866] encode(..., 'xmlcharrefreplace') produces entities for surrogate pairs
STINNER Victor added the comment: Should we really invest time to fix bugs related to astral (non-BMP) characters with rare codecs and error handlers (CJK codecs, xmlcharrefreplace error handler)? Python 3.3 is released and has a much better support of astral characters (in many places). I don't know for CJK codecs: Python 3.3 still uses the legacy Unicode API for CJK codecs and so depend on the wchar_t type (which is 16 bits on Windows). I just fixed Python 3.4 to use the new Unicode API (PEP 393), which always support astral characters support and don't depend on the size of the wchar_t type. I'm not against fixing Python 2.7, I'm just not interested. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15866 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17636] Modify IMPORT_FROM to fallback on sys.modules
Phillip J. Eby added the comment: On Sun, Apr 14, 2013 at 3:51 AM, Nick Coghlan rep...@bugs.python.org wrote: Your analysis is one of the pieces that was missing, Unfortunately, I just noticed it's actually incorrect in a pretty important part In my original example, I said, because of the circularity, this will *also* happen if you import 'a' first. This statement is actually false. Importing 'a' first in that example will result in a.util == b.util:util, not a.util=b.util. I made the mistake because I was for some reason thinking that 'a' was going to execute its import while being imported from b.util, and in that scenario it will not. That means there *is* an ordering dependency, and an ambiguity like this one can lie dormant until long after you've introduced the circularity. :-( -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17636 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17702] os.environ converts key type from string to bytes in KeyError exception
Roundup Robot added the comment: New changeset 72df981e83d3 by Victor Stinner in branch '3.3': Close #17702: os.environ now raises KeyError with the original environment http://hg.python.org/cpython/rev/72df981e83d3 New changeset ea54559a4442 by Victor Stinner in branch 'default': (Merge 3.3) Close #17702: os.environ now raises KeyError with the original http://hg.python.org/cpython/rev/ea54559a4442 New changeset b0c002fa4335 by Victor Stinner in branch '3.3': Issue #17702: use assertRaises() for the unit test http://hg.python.org/cpython/rev/b0c002fa4335 New changeset cc6c5b5ec4f2 by Victor Stinner in branch 'default': (Merge 3.3) Issue #17702: use assertRaises() for the unit test http://hg.python.org/cpython/rev/cc6c5b5ec4f2 -- nosy: +python-dev resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17702 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17618] base85 encoding
Martin Morrison added the comment: I've updated the Ascii85 algorithms to remove the quadratic complexity, and use a single struct.pack/unpack. They should now be much quicker for large input strings. It's difficult to factor out commonality with b85* because the encodings and rules differ. This is especially true for decode (where Ascii85 allows arbitrary whitespace, so it either has to be stepped through as I've implemented it, or it would have to first be sanitised with .replace() or similar, which is expensive for large inputs). For encode, the special cases supported by Ascii85 make it impossible to *just* use a lookup table, and the simplified algorithm for encoding means it isn't necessary to use one at all. I also wanted to keep the Mercurial code intact as much as possible, so it can be kept in sync in future if necessary. My notes from the previous diff also still apply if anyone has thoughts on those. -- Added file: http://bugs.python.org/file29852/issue17618-3.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17618 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17221] Resort Misc/NEWS
Roundup Robot added the comment: New changeset dbb943399c9b by Serhiy Storchaka in branch '2.7': Issue #17221: Resort Misc/NEWS. http://hg.python.org/cpython/rev/dbb943399c9b New changeset 7da08495b497 by Serhiy Storchaka in branch '3.3': Issue #17221: Resort Misc/NEWS. http://hg.python.org/cpython/rev/7da08495b497 New changeset 6fdcea9e89a3 by Serhiy Storchaka in branch 'default': Issue #17221: Resort Misc/NEWS. http://hg.python.org/cpython/rev/6fdcea9e89a3 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17221 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17221] Resort Misc/NEWS
Serhiy Storchaka added the comment: I commit patches since no one objected. Not all errors are corrected. There are duplicates (`cat Misc/NEWS | sort | uniq -cd | sort -n`). I'm not sure that the line What's New in Python 3.3.1 release candidate 1? in Misc/NEWS for 3.4 correct. The difference between 3.3 and 3.4 is more than expected (`hg diff -r 3.3 -r default Misc/NEWS`). -- stage: patch review - commit review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17221 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue995907] memory leak with threads and enhancement of the timer class
Yael added the comment: Added a class Threading.TimerPool. This new class spawns one thread, and that thread is running as long as there are active timers. -- keywords: +patch Added file: http://bugs.python.org/file29853/mywork.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue995907 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17244] py_compile.compile() fails to raise exceptions when writing of target file fails
Roundup Robot added the comment: New changeset 04aaeae6ee7b by Brett Cannon in branch 'default': Issue #17244: Don't mask exceptions raised during the creation of http://hg.python.org/cpython/rev/04aaeae6ee7b -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17244 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17244] py_compile.compile() fails to raise exceptions when writing of target file fails
Changes by Brett Cannon br...@python.org: -- resolution: - fixed stage: test needed - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17244 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17341] Poor error message when compiling invalid regex
Roundup Robot added the comment: New changeset 65db865c0851 by R David Murray in branch '3.3': #17341: Include name in re error message about invalid group name. http://hg.python.org/cpython/rev/65db865c0851 New changeset 227fed7a05d4 by R David Murray in branch 'default': Merge #17341: Include name in re error message about invalid group name. http://hg.python.org/cpython/rev/227fed7a05d4 New changeset bbb3aa45b4ea by R David Murray in branch '2.7': #17341: Include name in re error message about invalid group name. http://hg.python.org/cpython/rev/bbb3aa45b4ea -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17341 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17353] Plistlib outputs empty data tags when deeply nested
Mike Milkin added the comment: Looks like plistlib.writePlistToString is no loger in the plistlib. -- nosy: +mmilkin ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17353 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17341] Poor error message when compiling invalid regex
R. David Murray added the comment: Thanks Jason. -- resolution: - fixed stage: - committed/rejected status: open - closed versions: +Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17341 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17693] Use _PyUnicodeWriter API for CJK decoders
Roundup Robot added the comment: New changeset ffd4b72f7f95 by Victor Stinner in branch 'default': Issue #17693: Fix memory/reference leaks http://hg.python.org/cpython/rev/ffd4b72f7f95 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17693 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17618] base85 encoding
Antoine Pitrou added the comment: Hi and thanks for the patch! I named the Mercurial base85 implementation functions with the b85 prefix. For the Ascii85 ones, I used a85. I considered overloading the same functions with a keyword argument to select which encoding, but rejected that. Thoughts? I agree, it's better like this. I haven't made the changes to add a pure Python binascii module as suggested in msg186216. Although poorly named, base64.py already contains a number of other encodings, so this seemed the best place for these too. Yes, I think it's ok. I was thinking about binascii in the context of making a C version, but we can refactor things later anyway. Now about the patch: I haven't read it in detail, but it seems to lack tests for b85decode and b85encode. It should be easy enough to get some test values by calling Mercurial's version. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17618 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15866] encode(..., 'xmlcharrefreplace') produces entities for surrogate pairs
Ezio Melotti added the comment: I tend to agree with Victor: if you want to fix 2.7 go ahead, but if that's too much work it's OK with me to close this issue. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15866 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10438] list an example for calling static methods from WITHIN classes
R. David Murray added the comment: After a discussion (at the Boston Python sprint, unfortunately I forget with who) of how difficult this could be to explain succinctly without confusing either java/C++ programmers on the one hand or Python programmers on the other hand, this, the wording in the attached patch occurred to me. I'm not certain that adding the extra words is worth it, but if so this might do. -- keywords: +patch Added file: http://bugs.python.org/file29854/static_method_call_examples_10438.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10438 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13510] Clarify that readlines() is not needed to iterate over a file
Ezio Melotti added the comment: I would actually remove the whole section about readlines() or possibly just mention it briefly (something like If you want to read all the lines of a file in a list you can also use f.readlines().) The sizehint arg is rarely used, so I don't see the point of going in such details about it in the tutorial. In Lib/, there are only a couple of places where it's actually used: Lib/fileinput.py:358: self._buffer = self._file.readlines(self._bufsize) Lib/idlelib/GrepDialog.py:90: block = f.readlines(10) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13510 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13510] Clarify that readlines() is not needed to iterate over a file
Antoine Pitrou added the comment: I would actually remove the whole section about readlines() or possibly just mention it briefly (something like If you want to read all the lines of a file in a list you can also use f.readlines().) The sizehint arg is rarely used, so I don't see the point of going in such details about it in the tutorial. You are right, Ezio. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13510 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com