pytest-2.4.1: fix three regressions (of 2.4 compared to 2.3.5)
pytest-2.4.1 is a quick follow up release to fix three regressions compared to 2.3.5 before they hit more people: - When using parser.addoption() unicode arguments to the type keyword should also be converted to the respective types. thanks Floris Bruynooghe, @dnozay. (fixes issue360 and issue362) - fix dotted filename completion when using argcomplete thanks Anthon van der Neuth. (fixes issue361) - fix regression when a 1-tuple (arg,) is used for specifying parametrization (the values of the parametrization were passed nested in a tuple). Thanks Donald Stufft. - also merge doc typo fixes, thanks Andy Dirnberger as usual, docs at http://pytest.org and upgrades via:: pip install -U pytest have fun and keep bug reports coming! holger krekel -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
ANN: rom 0.21 - Redis object mapper for Python
Hey everyone, As time progresses, so does my Redis object mapper. The rom package is a Redis object mapper for Python. It sports an interface similar to Django's ORM, SQLAlchemy + Elixir, or Appengine's datastore. The changelog for recent releases can be seen below my signature. You can find the package at: https://www.github.com/josiahcarlson/rom https://pypi.python.org/pypi/rom And docs can be found at: http://pythonhosted.org/rom/ Please CC me on any replies if you have any questions or comments. Thank you, - Josiah #--- 0.21 [fixed] upload for rom 0.20 was missing new columns.py, now fixed #--- 0.20 [changed] Added exception when performing .all(), .execute(), or .count() on query objects that have had no filters or attribute ordering provided. This addresses issue #12. [changed] Moved column definitions to their own module, shouldn't affect any normal uses of rom. [added] For users of Redis 2.6 and later, there is a beta Lua-enabled writing option that allows for multiple unique columns on models. In some cases, this may improve performance when writing many entities very quickly. [added] The ability to reload an entity from Redis, optionally discarding any modifications to the object itself. Check out the documentation for Model.refresh(), Session.refresh(), and Session.refresh_all() [added] Tests for the newly changed/added features. [changed] Tests no longer use flushdb() - all test models/indexes/etc. are prefixed with RomTest, and we find/delete such keys before and after any tests are run. Now anyone can reasonably run the test suite. #--- 0.19 [fixed] Thanks to a bug report by https://github.com/MickeyKim , was notified of a bug when using unique indexes, which is now fixed and has a testcase. #--- 0.18 [fixed] Thanks to a bug report by https://github.com/MickeyKim , was notified and received an interim patch for a bug that could cause deleted entities to be resurrected on session.commit() or session.flush() . This has now been fixed and a testcase has been added. -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Sphinx 1.2 beta 3 released
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all, I'm very happy to announce the release of Sphinx 1.2, beta 3, available on the Python package index at http://pypi.python.org/pypi/Sphinx. Please test and report bugs to http://dev.sphinx-doc.org/sphinx/issues. This is the second testing release for Sphinx 1.2, a new feature release with lots of improvements and new features, such as better search results, more support for internationalization and faster parallel builds. For the full changelog, go to http://sphinx-doc.org/latest/changes.html. Thanks to the Python APAC 2013 sprint team! What is it? === Sphinx is a tool that makes it easy to create intelligent and beautiful documentation for Python projects (or other documents consisting of multiple reStructuredText source files). Website: http://sphinx-doc.org/ IRC: #sphinx-doc on irc.freenode.net cheers, Georg -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.21 (GNU/Linux) iEYEARECAAYFAlJNsPMACgkQN9GcIYhpnLBx0wCePJ93ZbMADG8S3Iy4EubWSp3Q tLMAnj7LFsp7eGeLcSpUlhYwbKHyQRe8 =E+bh -END PGP SIGNATURE- -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
[ANN] iPOPO 0.5.4
=== iPOPO 0.5.4 === iPOPO v0.5.4 has been released ! About iPOPO === iPOPO is a service-oriented component model (SOCM) framework for Python, inspired from the Java project iPOJO. What's new in 0.5.4 === This version greatly speeds up iPOPO on large numbers of components (from 5,000 to 30,000 components). It also brings back Python 2.6 compatibility and fixes many bugs. New features: - Shell IOHandler now has a prompt() method, to request a line to the user - Shell command service get_method_names() method is no longer used. - iPOPO.get_factory_details() now returns the ID of the bundle providing the factory - New way to get the iPOPO service, replacing get_ipopo_svc_ref(): from pelix.ipopo.constants import use_ipopo with use_ipopo(bundle_context) as ipopo: ipopo.instantiate(...) The website of iPOPO has been replaced by a wiki: https://ipopo.coderxpress.net You can register to propose new features ! Feel free to send feedback on your experience of Pelix/iPOPO, via the mailing lists: User list : http://groups.google.com/group/ipopo-users Development list : http://groups.google.com/group/ipopo-dev Have fun ! Thomas -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
ANN: PyQt5 v5.1 Released
PyQt5 v5.1 has been released and is available from http://www.riverbankcomputing.com/software/pyqt/download5. PyQt5 is a comprehensive set of bindings for v5 of Digia's Qt cross-platform application framework. It supports Python v3, v2.7 and v2.6. The highlights of this release include full support for Qt v5.1, the QtSensors and QtSerialPort modules, and bindings for OpenGL v2.0 and OpenGL ES/2. Windows installers are provided which contain everything needed for PyQt5 development (including Qt, Qt Designer, QScintilla, and MySQL, PostgreSQL, SQLite and ODBC drivers) except Python itself. Installers are provided for the 32 and 64 bit versions of Python v3.3. PyQt5 is implemented as a set of 22 extension modules including support for: - non-GUI infrastructure including event loops, threads, i18n, user and application settings, mapped files and shared memory - GUI infrastructure including window system integration, event handling, 2D graphics, basic imaging, fonts, OpenGL - a comprehensive set of desktop widgets - WebKit - full integration with Quick2 and QML allowing new Quick items to be implemented in Python and created in QML - event driven network programming - multimedia including cameras, audio and radios - sensors including accelerometers, altimeters, compasses, gyroscopes, magnetometers, and light, pressure, proximity, rotation and temperature sensors - serial ports - SQL - printing - DBus - XPath, XQuery, XSLT and XML Schema validation - a help system for creating and viewing searchable documentation - unit testing of GUI applications. -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Volles Programm - PyCon.DE-Tutorials jetzt buchen!
NOTE: This is an announcement for the PyCon.DE 2013 conference in Cologne, Germany (https://2013.de.pycon.org) and intended for a German-speaking audience. Volles Programm - PyCon.DE-Tutorials jetzt buchen! -- - Sie wollen eine Webseite mit Python entwickeln und wissen nicht, wie Sie anfangen sollen? - Sie arbeiten mit vielen Daten und suchen effiziente Tools zur Analyse und Berechnungen mit komplexen Datenstrukturen? - Sie beherrschen die Grundlagen Pythons und möchten fortgeschrittene Programmiertechniken erlernen und idiomatischen Python-Code schreiben? Auf dem Tutorialtag der PyCon.DE 2013 in Köln bieten wir ein volles Programm. Sicher ist dabei auch etwas für Sie, Ihre Kollegen oder Ihre Mitarbeiter! Unsere Tutorials finden am *Montag, den 14. Oktober 2013*, vor der PyCon.DE-Hauptkonferenz im Komed (Mediapark) in Köln statt. Sie dauern dauern drei (halbtags) oder sechs Stunden (ganztags). Zwei besondere Schwerpunkte des Tutorialangebots sind die Themen *Python-Frameworks zur Webentwicklung* sowie *wissenschaftliche Datenanalyse und -verarbeitung*. Daneben bieten wir auch auch Tutorials zu fortgeschrittenen Python-Sprachkonzepten oder zur Software-Entwicklungspraxis an. Einige Highlights aus der Auswahl von über einem Dutzend Tutorials sind: * In sechs Stunden zur eigenen Django App * Kurzeinstieg in IPython und IPython Notebook * Einführung in NumPy * Unittests für Einsteiger * Iteratoren, Generatoren und Dekoratoren * u.v.m. Besuchen Sie einfach die PyCon.DE-Webseite und buchen Sie Ihr Tutorial aus dem spannenden Tutorialprogramm: https://2013.de.pycon.org/programm/tutorials/ Dabei lohnt sich natürlich auch ein Blick auf das umfangreiche Vortragsprogramm und die anderen Events der PyCon.DE 2013. Wenn Sie daran teilnehmen möchten, buchen Sie noch *bis zum 30. September 2013*, um von den günstigeren Preisen für Normalbucher zu profitieren! https://2013.de.pycon.org/teilnehmen/registrieren/ Noch ein Tipp: falls Sie persönlich nicht an einem Tutorial teilnehmen können, machen Sie doch einfach einem Geschäftspartner eine Freude und schenken ihm ein Tutorialticket. Sicher freuen sich auch Ihre Mitarbeiter, Werkstudenten oder Auszubildenden über eine Tutorialteilnahme auf der PyCon.DE 2013. Wir freuen uns auf Sie! Im Namen des PyCon.DE-Organisationsteams Christopher Arndt -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Re: Efficency help for a Calculator Program
On Fri, Oct 4, 2013 at 9:15 AM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Thu, 3 Oct 2013 10:25:47 +1000, Chris Angelico ros...@gmail.com declaimed the following: On Thu, Oct 3, 2013 at 9:47 AM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: try: numItems = int(raw_input(\n\nHow many values? )) except: #naked exception is not really good programming print Invalid input, exiting... sys.exit(1) Please don't _ever_ advocate this programming style! Wrapping something in a try/except that emits a generic message and terminates is a bad idea - the default behaviour, if you simply let the exception happen, is to emit a very useful message and terminate. Never test for any error condition you're not prepared to handle, as the BOFH advised his boss. Note: I DID include a comment that this was NOT good style. You mentioned that bare except is a problem; I'm more looking at the fact that the except clause simply writes a message and terminates. They're two separate issues, both bad style. I know _you_ know it's bad style; but someone reading over this needs to be aware that this shouldn't normally be done. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Where does MySQLdb put inserted data?
Hi, As of late clipboard pasting into a terminal sometimes fails (a known bug, apparently), I use MySQLdb to access MySQL tables. In general this works just fine. But now I fail filling a new table. The table exists. mysqlEXPLAIN new_table; explains and root@blackbox-one:/# sudo/find / -name 'new_table*' finds /var/lib/mysql/fr/new_table.frm. So I do cursor.executemany ('insert into new_table values (%s)' % format, data). No error occurs and cursor.execute ('select * from new_table;') returns the number of records read, and cursor.fetchall () returns all new records. All looks fine, but mysqlSELECT * FROM new_table; produces an Empty set and sudo find / -name 'new_table* still finds only the format file, same as before. Could it have to do with COMMIT. I believe I am using ISAM tables (default?) and those don't recognize undo commands, right?. Anyway, an experimental cursor.execute ('COMMIT') didn't make a difference. It looks like MySQLdb puts the data into a cache and that cache should be saved either by the OS or by me. Strange thing is that this is one freak incident in an almost daily routine going back years and involving thousands of access operations in and out acting instantaneously. I seem to remember a similar case some time ago and it also involved a new empty table. Thanks for hints Frederic mysql select version() - ; +-+ | version() | +-+ | 5.5.31-0ubuntu0.12.04.1 | +-+ 1 row in set (0.00 sec) -- https://mail.python.org/mailman/listinfo/python-list
Re: Multiple scripts versus single multi-threaded script
Roy Smith wrote: Threads are lighter-weight. That means it's faster to start a new thread (compared to starting a new process), and a thread consumes fewer system resources than a process. If you have lots of short-lived tasks to run, this can be significant. If each task will run for a long time and do a lot of computation, the cost of startup becomes less of an issue because it's amortized over the longer run time. This might be true on Windows, but I think on Linux process overheads are pretty similar to threads, e.g. http://stackoverflow.com/questions/807506/threads-vs-processes-in-linux Combined with the lack of a GIL-conflict, processes can be pretty efficient. Jeremy -- https://mail.python.org/mailman/listinfo/python-list
Re: wil anyone ressurect medusa and pypersist?
On Thursday, 3 October 2013 21:48:35 UTC+1, c-gsc...@neogov.net wrote: On Thursday, May 16, 2013 11:15:45 AM UTC-7, vispha...@gmail.com wrote: www.prevayler.org in python = pypersist medusa = python epoll web server and ftp server eventy and async wow interesting sprevayler ?? cl-prevalence Hmm - FWIW this looks a lot like it's from 'gavino', a troll-like entity on c.l.forth. J^n -- https://mail.python.org/mailman/listinfo/python-list
Re: Where does MySQLdb put inserted data?
On Fri, 04 Oct 2013 09:38:41 +0200, F.R. wrote: Hi, As of late clipboard pasting into a terminal sometimes fails (a known bug, apparently), I use MySQLdb to access MySQL tables. [...] You appear to have posted to the wrong list. This is a Python list, not MySQL. Nothing in your question appears to be about Python. If I am mistaken, please re-word your question explain what Python code you are having trouble with, what you tried, what you expected, and what it actually did. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Tail recursion to while iteration in 2 easy steps
On Thursday, October 3, 2013 5:33:27 AM UTC+8, Terry Reedy wrote: On 10/2/2013 8:31 AM, random...@fastmail.us wrote: On Tue, Oct 1, 2013, at 17:30, Terry Reedy wrote: Part of the reason that Python does not do tail call optimization is that turning tail recursion into while iteration is almost trivial, once you know the secret of the two easy steps. Here it is. That should be a reason it _does_ do it - saying people should rewrite their functions with loops means declaring that Python is not really a multi-paradigm programming language but rather rejects functional programming styles in favor of imperative ones. It is true that Python does not encourage the particular functional style that is encouraged by auto optimization of tail recursion. A different functional style would often use reduce (or fold) instead. Some other points I left out in a post of medium length yet brief for the topic. 1. If one starts with body recursion, as is typical, one must consider commutativity (possibly associativity) of the 'inner' operator in any conversion. 2. Instead of converting to tail recursion, one might convert to while iteration directly. 3. One often 'polishes' the while form in a way that cannot be done automatically. 4. While loops are actually rare in idiomatic Python code. In Python, for loops are the standard way to linearly process a collection. The final version I gave for a factorial while loop, def fact_while(n): if n 0 or n != int(n): raise ValueError('fact input {} is not a count'.format(n)) fac = 1 while n 1: fac *= n n -= 1 return fac should better be written with a for loop: As I pointed out before, an accelerated version without the limit of the stack depth for computing facotrials can be obtained by storing a list of products of primes first. Of course integer divisions are required to transform the to stack depth problem into the size of the 32-64 bit heap space. -- https://mail.python.org/mailman/listinfo/python-list
howto check programs and C libraries
Hello, I'm in charge of preparing a computer room for the practices of introduction to programming. One of the tasks is checking that from all the computers in the room one can execute some programs and link (and compile) against some libraries. My first idea was using Autotools (or cmake), but as I'm a big fan of python, I was thinking how to do that with python, and I don't have a clear solution yet. I know that distutils includes the distutils.command.config module, and I think it could do the job (when properly subclassed). Do you have a better idea? Thanks in advance. Regards, DPalao -- https://mail.python.org/mailman/listinfo/python-list
Re: ipy %run noob confusion
On 3 October 2013 18:42, jshra...@gmail.com wrote: I have some rather complex code that works perfectly well if I paste it in by hand to ipython, but if I use %run it can't find some of the libraries, but others it can. The confusion seems to have to do with mathplotlib. I get it in stream by: %pylab osx and do a bunch of stuff interactively that works just fine, for example: clf() But I want it to run on a %run, but %pylab is (apparently) not allowed from a %run script, and importing matplotlib explicitly doesn't work...I mean, it imports, but then clf() is only defined in the module, not interactively. The % commands are ipython magic commands. They are not valid Python syntax so you can't use them in a Python script. In a Python script you would use 'from pylab import *' for (roughly) the same effect: $ ipython Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] Type copyright, credits or license for more information. IPython 0.13.2 -- An enhanced Interactive Python. ? - Introduction and overview of IPython's features. %quickref - Quick reference. help - Python's own help system. object? - Details about 'object', use 'object??' for extra details. In [1]: from pylab import * In [2]: clf Out[2]: function matplotlib.pyplot.clf More confusing, if I do all the setup interactively, and the try to just run my script, again, clf() [etc] don't work (don't appear to exist), even though I can do them interactively. When you use %run it runs the script externally. This is basically the same as typing 'python myscript.py' in the system terminal. In that case the script needs to import everything it wants to use. There seems to be some sort of scoping problem ... or, put more correctly, my problem is that I don't seem to understand the scoping, like, are %run eval'ed in some closed context that doesn't work the same way as ipython interactive? Is there any way to really do what I mean, which is: Please just read in commands from that script (short of getting out and passing my script through stdin to ipython?) I'm not sure if I understand what you mean but I usually %edit the script and closing the editor seems to just run the commands as if I typed them directly in. If you really want this kind of semi-interactive Matlab-style approach I suggest having a look at the Spyder IDE. Personally though I think it's bad to work this way in Python (and in Matlab) and I discourage my students from doing this. The interactive interpreter modes are great for testing short snippets of code or introspecting modules etc. However any real code should go in a real script. Using %edit for convenience while you write the script is fine but make sure that what you're creating is a real Python script that you can run normally with 'python myscript.py'. Spyder is also good for doing this. Otherwise all of your work, computation and plots are a mess and it becomes impossible to trace back to exactly how you produced everything to check your work or to fix it when it becomes apparent that you've screwed up. Oscar -- https://mail.python.org/mailman/listinfo/python-list
Re: howto check programs and C libraries
On 4 October 2013 10:30, David Palao dpalao.pyt...@gmail.com wrote: Hello, I'm in charge of preparing a computer room for the practices of introduction to programming. One of the tasks is checking that from all the computers in the room one can execute some programs and link (and compile) against some libraries. My first idea was using Autotools (or cmake), but as I'm a big fan of python, I was thinking how to do that with python, and I don't have a clear solution yet. I know that distutils includes the distutils.command.config module, and I think it could do the job (when properly subclassed). Do you have a better idea? I'm not very experienced with it but perhaps waf would be better for you: https://code.google.com/p/waf/ Oscar -- https://mail.python.org/mailman/listinfo/python-list
Re: hg.python.org: Server unresponsive and timeout
On 2 October 2013 23:25, Terry Reedy tjre...@udel.edu wrote: On 10/2/2013 5:36 AM, Tae Wong wrote: This post is irrelevant from using Python; so it's an Internet server problem. When you try to connect to hg.python.org, the connection takes forever. I believe hg.python.org is on a different machine than python.org. It has occasionally been down, but works fine with Firefox. Sometimes connections fail even if both endpoints are working. If you have a particular persistent problem with hg.python.org, I suggest talking to your ISP. Cloning the CPython repository may take an hour or two if that is what you are trying to do. It takes 15 minutes to clone with hg from hg.python.org on my machine. It takes 4 minutes on the same machine to clone the semi-official github mirror using git: 'git clone https://github.com/python/cpython.git' Those times are obviously affected by the fact that I have a very good internet connection at work: neither of the above operations comes close to the maximum bandwidth that I can access from some servers. Perhaps if there are problems with hg.python.org you might want to try the github mirror though. Oscar -- https://mail.python.org/mailman/listinfo/python-list
Re: Where does MySQLdb put inserted data?
On 10/04/2013 09:38 AM, F.R. wrote: Hi, As of late clipboard pasting into a terminal sometimes fails (a known bug, apparently), I use MySQLdb to access MySQL tables. In general this works just fine. But now I fail filling a new table. The table exists. mysqlEXPLAIN new_table; explains and root@blackbox-one:/# sudo/find / -name 'new_table*' finds /var/lib/mysql/fr/new_table.frm. So I do cursor.executemany ('insert into new_table values (%s)' % format, data). No error occurs and cursor.execute ('select * from new_table;') returns the number of records read, and cursor.fetchall () returns all new records. All looks fine, but mysqlSELECT * FROM new_table; produces an Empty set and sudo find / -name 'new_table* still finds only the format file, same as before. Could it have to do with COMMIT. I believe I am using ISAM tables (default?) and those don't recognize undo commands, right?. Anyway, an experimental cursor.execute ('COMMIT') didn't make a difference. It looks like MySQLdb puts the data into a cache and that cache should be saved either by the OS or by me. Strange thing is that this is one freak incident in an almost daily routine going back years and involving thousands of access operations in and out acting instantaneously. I seem to remember a similar case some time ago and it also involved a new empty table. Thanks for hints Frederic mysql select version() - ; +-+ | version() | +-+ | 5.5.31-0ubuntu0.12.04.1 | +-+ 1 row in set (0.00 sec) Thank you Chris, thank you Steven, The suggestion to switch to PostgreSQL isn't lost on me. I have it installed, but have been putting off the change, apprehensive of getting slowed down by many annoying side effects for some time to come. This may be the moment . . . Off list? MySQL is. MySQLdb is not. Before I know which of the two is the culprit, I don't know whether I'm off list or not and take the risk, prepared to beg pardon if I am. Frederic -- https://mail.python.org/mailman/listinfo/python-list
Re: Tail recursion to while iteration in 2 easy steps
Mark Janssen dreamingforw...@gmail.com writes: def fact(n): return 1 if n = 1 else n * fact(n-1) class Strange: ... def __le__(dummy): global fact fact = someotherfun # this is binding return false You cannot prevent this in python. No, but you can't prevent a lot of bad moves in python. What you just did there is a total bonehead (strange?) of an idea. I think allowing rebinding of function names is extremely strange, even though it's easier to implement. I tend to agree with you on the quality of the idea, but optimization has to take this into account (and give up, usually). -- Alain. -- https://mail.python.org/mailman/listinfo/python-list
Re: Where does MySQLdb put inserted data?
On Fri, Oct 4, 2013 at 8:05 PM, F.R. anthra.nor...@bluewin.ch wrote: Off list? MySQL is. MySQLdb is not. Before I know which of the two is the culprit, I don't know whether I'm off list or not and take the risk, prepared to beg pardon if I am. Just to clarify: Off-topic means discussing stuff that isn't about Python; off-list means sending private emails, not to python-list@python.org / comp.lang.python. You're uncertain as to whether you're off-topic or not, but you're definitely on-list; and my previous mail to you was off-list, so people here are going to be a little confused, as they lack context. (I merely suggested that switching to PostgreSQL would quite probably be a worthwhile time investment.) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Tail recursion to while iteration in 2 easy steps
Neil Cerutti ne...@norwich.edu wrote: On 2013-10-03, Duncan Booth duncan.booth@invalid.invalid wrote: It isn't hard to imagine adding a TAIL_CALL opcode to the interpreter that checks whether the function to be called is the same as the current function and if it is just updates the arguments and jumps to the start of the code block. Tail call optimization doesn't involve verification that the function is calling itself; you just have to verfify that the call is in tail position. You misunderstood me. As usually implemented tail call recursion doesn't require verifying that the function is calling itself, but in Python the function could be rebound so a check would be a necessary protection against this unlikely situation. Consider this Python: @some_decorator def fact(n, acc=1): if n = 1: return acc return fact(n-1, n*acc) Is that tail recursion or not? You cannot tell whether or not that is tail recursion unless you know the definition of 'some_decorator' and even then the answer may vary from run to run. -- Duncan Booth http://kupuguy.blogspot.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Tail recursion to while iteration in 2 easy steps
On Fri, Oct 4, 2013 at 4:16 AM, Duncan Booth duncan.booth@invalid.invalid wrote: Neil Cerutti ne...@norwich.edu wrote: On 2013-10-03, Duncan Booth duncan.booth@invalid.invalid wrote: It isn't hard to imagine adding a TAIL_CALL opcode to the interpreter that checks whether the function to be called is the same as the current function and if it is just updates the arguments and jumps to the start of the code block. Tail call optimization doesn't involve verification that the function is calling itself; you just have to verfify that the call is in tail position. You misunderstood me. As usually implemented tail call recursion doesn't require verifying that the function is calling itself, but in Python the function could be rebound so a check would be a necessary protection against this unlikely situation. Consider this Python: @some_decorator def fact(n, acc=1): if n = 1: return acc return fact(n-1, n*acc) Is that tail recursion or not? You cannot tell whether or not that is tail recursion unless you know the definition of 'some_decorator' and even then the answer may vary from run to run. There is no doubt that it's a tail call. Whether it is recursion is irrelevant to optimizing it. The reason we talk about tail call recursion specifically is because the recursive case is the one that makes the optimization worthwhile, not because the recursion is necessary to perform the optimization. It is possible that fact is recursive but that some_decorator adds additional stack frames that are not tail calls and not optimizable. If this were the case, then the recursion would still eventually hit the stack limit, but there would still be benefit in optimizing the fact frames, as it would increase the allowable depth before the stack limit is reached. So I see no reason to check the identity of the called function before optimizing the tail call. -- https://mail.python.org/mailman/listinfo/python-list
Re: Where does MySQLdb put inserted data?
On 10/04/2013 12:11 PM, Chris Angelico wrote: On Fri, Oct 4, 2013 at 8:05 PM, F.R. anthra.nor...@bluewin.ch wrote: Off list? MySQL is. MySQLdb is not. Before I know which of the two is the culprit, I don't know whether I'm off list or not and take the risk, prepared to beg pardon if I am. Just to clarify: Off-topic means discussing stuff that isn't about Python; off-list means sending private emails, not to python-list@python.org / comp.lang.python. You're uncertain as to whether you're off-topic or not, but you're definitely on-list; and my previous mail to you was off-list, so people here are going to be a little confused, as they lack context. (I merely suggested that switching to PostgreSQL would quite probably be a worthwhile time investment.) ChrisA I shall switch and give you credit for the impulse in addition to the terminological clarification on being off something or other . . . Frederic -- https://mail.python.org/mailman/listinfo/python-list
Re: Tail recursion to while iteration in 2 easy steps
On Fri, Oct 4, 2013 at 4:41 AM, Ian Kelly ian.g.ke...@gmail.com wrote: There is no doubt that it's a tail call. Whether it is recursion is irrelevant to optimizing it. The reason we talk about tail call recursion specifically is because the recursive case is the one that makes the optimization worthwhile, not because the recursion is necessary to perform the optimization. It is possible that fact is recursive but that some_decorator adds additional stack frames that are not tail calls and not optimizable. If this were the case, then the recursion would still eventually hit the stack limit, but there would still be benefit in optimizing the fact frames, as it would increase the allowable depth before the stack limit is reached. So I see no reason to check the identity of the called function before optimizing the tail call. On the other hand, if you start optimizing every tail call and not just the recursive functions, then I can see where that could start to get problematic for debugging -- as arbitrary functions get removed from the stack traces just because they happened to end in tail calls. -- https://mail.python.org/mailman/listinfo/python-list
Image manipulation
Is there a way using the python 3.3.2 whidout any additional downloaded moduls, to get a pixels RGB value? -- https://mail.python.org/mailman/listinfo/python-list
Re: Tail recursion to while iteration in 2 easy steps
On Thursday, October 3, 2013 10:57:48 PM UTC+5:30, Ravi Sahni wrote: On Wed, Oct 2, 2013 at 10:46 AM, rusi wrote: 4. There is a whole spectrum of such optimizaitons -- 4a eg a single-call structural recursion example, does not need to push return address on the stack. It only needs to store the recursion depth: If zero jump to outside return add; if 0 jump to internal return address 4b An example like quicksort in which one call is a tail call can be optimized with your optimization and the other, inner one with 4a above I am interested in studying more this 'whole spectrum of optimizations' Any further pointers? Mmm… Bummer… There was a book having these -- at least 5-6 different optimizations of which tail-call was the most obvious. Maybe author was McGettrick dont remember for sure... Probably 20 years now! I'll try and re-remember them and post. -- https://mail.python.org/mailman/listinfo/python-list
Re: Tail recursion to while iteration in 2 easy steps
On Fri, 04 Oct 2013 11:49:26 +0200, Alain Ketterlin wrote: I think allowing rebinding of function names is extremely strange, It's not, it's quite common. Functions in Python are first-class values, and we can do things like this: from somelibrary import somethingwithalonglongname as shortname def inorder(tree, op=print): # Walk the tree in infix order, doing op to each node. process(tree.left, op) op(tree.payload) process(tree.right, op) _len = len def len(obj): do_something_first() return _len(obj) Now, the first two aren't the same sort of function-rebinding that you're talking about, or that were shown in your post, but the third is. What is unusual though is rebinding a function from within itself: def func(arg): global func do_this(arg) def func(arg): do_that(arg) but it's legal and it sometimes can be useful, although it counts as clever code, possibly too clever. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Tail recursion to while iteration in 2 easy steps
Duncan Booth writes: Neil Cerutti wrote: On 2013-10-03, Duncan Booth duncan.booth@invalid.invalid wrote: It isn't hard to imagine adding a TAIL_CALL opcode to the interpreter that checks whether the function to be called is the same as the current function and if it is just updates the arguments and jumps to the start of the code block. Tail call optimization doesn't involve verification that the function is calling itself; you just have to verfify that the call is in tail position. You misunderstood me. As usually implemented tail call recursion doesn't require verifying that the function is calling itself, but in Python the function could be rebound so a check would be a necessary protection against this unlikely situation. Consider this Python: @some_decorator def fact(n, acc=1): if n = 1: return acc return fact(n-1, n*acc) Is that tail recursion or not? You cannot tell whether or not that is tail recursion unless you know the definition of 'some_decorator' and even then the answer may vary from run to run. Ignoring the decorator, fact(n-1, n*acc) is in a tail position because it follows the keyword return. It doesn't matter what function fact is at the time: the remaining action in the caller is to return. Tail positions, with respect to enclosing code, are defined syntactically. -- https://mail.python.org/mailman/listinfo/python-list
Re: howto check programs and C libraries
On 4/10/2013 05:30, David Palao wrote: Hello, I'm in charge of preparing a computer room for the practices of introduction to programming. One of the tasks is checking that from all the computers in the room one can execute some programs and link (and compile) against some libraries. My first idea was using Autotools (or cmake), but as I'm a big fan of python, I was thinking how to do that with python, and I don't have a clear solution yet. I know that distutils includes the distutils.command.config module, and I think it could do the job (when properly subclassed). Do you have a better idea? I don't have any specific tool in mind, but I'd suggest that you really need to run the tool on only one of the machines, and run a separate tool on them all that assures that they are identical, presumably made that way by wiping each and copying from a master That assumes the hardware is close enough to identical to make this practical. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list
Re: Tail recursion to while iteration in 2 easy steps
Ian Kelly ian.g.ke...@gmail.com wrote: On Fri, Oct 4, 2013 at 4:41 AM, Ian Kelly ian.g.ke...@gmail.com wrote: There is no doubt that it's a tail call. Whether it is recursion is irrelevant to optimizing it. The reason we talk about tail call recursion specifically is because the recursive case is the one that makes the optimization worthwhile, not because the recursion is necessary to perform the optimization. It is possible that fact is recursive but that some_decorator adds additional stack frames that are not tail calls and not optimizable. If this were the case, then the recursion would still eventually hit the stack limit, but there would still be benefit in optimizing the fact frames, as it would increase the allowable depth before the stack limit is reached. So I see no reason to check the identity of the called function before optimizing the tail call. On the other hand, if you start optimizing every tail call and not just the recursive functions, then I can see where that could start to get problematic for debugging -- as arbitrary functions get removed from the stack traces just because they happened to end in tail calls. Quite so. Losing some stack frames in the traceback because tail recursion was optimised is probably no big deal. Losing arbitrary stack frames because of a more widespread tail call optimisation would not IMHO fit with the spirit of Python except possibly as an optional optimisation that was off by default. -- Duncan Booth http://kupuguy.blogspot.com -- https://mail.python.org/mailman/listinfo/python-list
Re: howto check programs and C libraries
On Fri, Oct 4, 2013 at 3:00 PM, David Palao dpalao.pyt...@gmail.com wrote: Hello, I'm in charge of preparing a computer room for the practices of introduction to programming. One of the tasks is checking that from all the computers in the room one can execute some programs and link (and compile) against some libraries. My first idea was using Autotools (or cmake), but as I'm a big fan of python, I was thinking how to do that with python, and I don't have a clear solution yet. I know that distutils includes the distutils.command.config module, and I think it could do the job (when properly subclassed). Do you have a better idea? I have ruby on rails friends who speak of capistrano and puppet. google puppet python gives me : http://stackful-dev.com/cuisine-the-lightweight-chefpuppet-alternative If you find it good I shall be interested to know. -- Ravi -- https://mail.python.org/mailman/listinfo/python-list
Re: JUST GOT HACKED
On Tuesday, October 1, 2013 5:06:38 PM UTC-5, Ben Finney wrote: This is an unmoderated forum, so we have occasional spates of persistent nuisances, and those who respond with the maturity level and impulse control of an average six-year-old. Hey! That's so degrading! I don't know many six-year-olds (and certainly not mine, but maybe they're just not average) who would continue to respond in the same fashion that the OP of *this* thread did! ;-) -W -- https://mail.python.org/mailman/listinfo/python-list
Re: JUST GOT HACKED
Op 03-10-13 13:30, Steven D'Aprano schreef: On Thu, 03 Oct 2013 09:01:29 +0200, Antoon Pardon wrote: You don't follow the principle of treating others in the way you hope to be treated if you were in their shoes. [...] Suppose you develop a new interest in which you are now the newbie and you go to a newsgroup or forum where as a nebie you ask a poor question. Are you hoping they will answer with sarcasm? I doubt that very much. Then you would be wrong. You don't know me very well at all. If I asked a dumb question -- not an ignorant question, but a dumb question -- then I hope somebody will rub my nose in it. Sarcasm strikes me as a good balance between being too namby-pamby to correct me for wasting everyone's time, and being abusive. You are contradicting yourself with previous contributions. If you yourself want to be treated with sarcasm when you ask a poor question and you follow the priciple of trying to treat people the same way as you like to be treated should you be in their shoes. Then it doesn't make sense that you should judge yourself as not living up to your ideals because of having a tendency to react to newbies' poor questions with sarcasm, as you did earlier. That tendency would then make you live up to your ideals. I have the impression you haven't thought this through much and are just making it up as you go along. And quite frankly, although I might *prefer* a gentle request asking for more information, I might *need* something harsher for the lesson to really sink in. Negative reinforcement is a legitimate teaching tool, provided it doesn't cross the line into abuse. But need was orginally not a consideration. You certainly never seem to consider Nikos might need something harsher than a polite answer, labeling almost any criticism almost automaticcaly as hate. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list
Re: JUST GOT HACKED
On Wednesday, October 2, 2013 5:43:32 AM UTC-5, Ferrous Cranus wrote: I only re-ask the same thing if: 1. Di not understood what was provided or proposed to me as being a solution 2. Still feel that that the solution provided to me doesn't meet my needs and should have been re-written in a different way. Nevertheless we are all improving, especially the newbies, by seeing alternative way, best methods and wise practices of writing code for the specific problem and pick the one that does the job best. If you feel that the provided solution doesn't meet your needs then the *most likely* answer is that you have asked the wrong question. Rather than, say, posting a new thread (unless your new question is clearly different and mostly unrelated), the appropriate course of action is to say something like, Hey, apparently I'm asking the wrong question, because all these answers are about frobnosticating, but I really wanted to foo the baz. If you don't acknowledge that you goofed up, you come across as arrogant or ignorant (or both). -W -- https://mail.python.org/mailman/listinfo/python-list
API for custom Unicode error handlers
I have some custom Unicode error handlers, and I'm looking for advice on the right API for dealing with them. I have a module containing custom Unicode error handlers. For example: # Python 3 import unicodedata def namereplace_errors(exc): c = exc.object[exc.start] try: name = unicodedata.name(c) except (KeyError, ValueError): n = ord(c) if n = 0x: replace = \\u%04x else: assert n = 0x10 replace = \\U%08x replace = replace % n else: replace = \\N{%s} % name return replace, exc.start + 1 Before I can use the error handler, I need to register it using this: import codecs codecs.register_error('namereplace', namereplace_errors) And now: py 'abc\u04F1'.encode('ascii', 'namereplace') b'abc\\N{CYRILLIC SMALL LETTER U WITH DIAERESIS}' Now, my question: Should the module holding the error handlers automatically register them? In other words, if I do: import error_handlers just importing it will have the side-effect of registering the error handlers. Normally, I dislike imports that have side-effects of this sort, but I'm not sure that the alternative is better, that is, to put responsibility on the caller to register some, or all, of the handlers: import error_handlers error_handlers.register(error_handlers.namereplace_errors) error_handlers.register_all() As far as I know, there is no way to find out what error handlers are registered, and no way to deregister one after it has been registered. Which API would you prefer if you were using this module? -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: ipy %run noob confusion
Thank you. This is extremely helpful. The key that I was missing is that it's running them outside of the ipy context. I also discovered that if you call the script .ipy instead of .py, it actually does more or less what I was expecting -- that is, it allows magic commands, and I got the thing working as desired through this means. I do appreciate the concern that my script should be real python, and I would aim for that eventually, but while I'm experimenting, it's useful to be able to have the interactive and script work the same way. I'm happy to real-ify it later. BTW, I generally work the opposite way than %edit: I code in emacs, and have a shell that's running ipy. Actually ipy is bad at this because it sends all sorts of terminal crap that I can probably get rid of somehow, but working this way has many advantages, not the least of which is that you don't have to fire up editors over and over (my editor context is primary), and I get an automatic log of my whole session in the shell buffer. This mode has served me well using regular python, because I didn't have the .ipy v. .py problem, but when I started into ipyton, things no longer worked. But your guidance (and others) have help deconfuse me on this. Thanks again! -- https://mail.python.org/mailman/listinfo/python-list
Re: Image manipulation
On 10/04/2013 03:52 AM, markot...@gmail.com wrote: Is there a way using the python 3.3.2 whidout any additional downloaded moduls, to get a pixels RGB value? No (I guess). If you want a better answer, then you'll have to give us a *much* better question. Get a pixel from *what*? (screen? image on disk? image on web page? printed image on paper? ...?) On what operating system? Using what kind of a graphics/imaging hardware/software? How are said pixels being written? Please understand how broad the term pixel is and how little information your question has provided. Try again with a full description of what you want, and we'll try to provide a useful answer. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list
Re: Multiple scripts versus single multi-threaded script
On 2013-10-03, Roy Smith r...@panix.com wrote: Threads are lighter-weight. That means it's faster to start a new thread (compared to starting a new process), and a thread consumes fewer system resources than a process. That's true, but the extent to which it's true varies considerably from one OS to another. Starting processes is typically very cheap on Unix systems. On Linux a thread and a process are actually both started by the same system call, and the only significant difference is how some of the new page descriptors are set up (they're copy-on-write instead of shared). On other OSes, starting a process is _way_ more expensive/slow than starting a thread. That was very true for VMS, so one suspects it might also be true for its stepchild MS-Window. -- Grant Edwards grant.b.edwardsYow! RELATIVES!! at gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: compare two list of dictionaries
On 04/10/2013 03:29, Mohan L wrote: [snip] output1=[ {'count': 3 , 'ip': 'xxx.xx.xxx.1'}, {'count': 4, 'ip': 'xxx.xx.xxx.2'}, {'count': 8, 'ip': 'xxx.xx.xxx.3'}, {'count': 10, 'ip': 'xxx.xx.xxx.4'}, {'count': 212, 'ip': 'hostname1'}, {'count': 27, 'ip': 'hostname2'}, {'count': 513, 'ip': 'hostname3'}, {'count': 98, 'ip': 'hostname4'}, {'count': 1, 'ip': 'hostname10'}, {'count': 2, 'ip': 'hostname8'}, {'count': 3, 'ip': 'xxx.xx.xxx.11'}, {'count': 90, 'ip': 'xxx.xx.xxx.12'}, {'count': 12, 'ip': 'xxx.xx.xxx.13'}, {'count': 21, 'ip': 'xxx.xx.xxx.14'}, {'count': 54, 'ip': 'xxx.xx.xxx.15'}, {'count': 34, 'ip': 'xxx.xx.xxx.16'}, {'count': 11, 'ip': 'xxx.xx.xxx.17'}, {'count': 2, 'ip': 'xxx.xx.xxx.18'}, {'count': 19, 'ip': 'xxx.xx.xxx.19'}, {'count': 21, 'ip': 'xxx.xx.xxx.20'}, {'count': 25, 'ip': 'xxx.xx.xxx.21'}, {'count': 31, 'ip': 'xxx.xx.xxx.22'}, {'count': 43, 'ip': 'xxx.xx.xxx.23'}, {'count': 46, 'ip': 'xxx.xx.xxx.24'}, {'count': 80, 'ip': 'xxx.xx.xxx.25'}, {'count': 91, 'ip': 'xxx.xx.xxx.26'}, {'count': 90, 'ip': 'xxx.xx.xxx.27'}, {'count': 10, 'ip': 'xxx.xx.xxx.28'}, {'count': 3, 'ip': 'xxx.xx.xxx.29'}] output2=(('INNCHN01','xxx.xx.xxx.11'), ('HYDRHC02', 'xxx.xx.xxx.12'), ('INNCHN03','xxx.xx.xxx.13'), ('MUMRHC01','xxx.xx.xxx.14'), ('n/a','xxx.xx.xxx.15'), ('INNCHN05','xxx.xx.xxx.16'), ('hostname1','n/a'), ('hostname2','n/a'), ('hostname10',''), ('hostname8',''), ('hostname200','xxx.xx.xxx.200'), ('hostname300','xxx.xx.xxx.400'), ) ## 1). ## Create a dict from output1 in which the key is the ip and the value is the count. mongodb_data={} for doc in output1: mongodb_data.update({doc['ip']:doc['count']}) A simpler way is: mongodb_data = {} for doc in output1: mongodb_data[doc['ip']] = doc['count'] ## Create a set from output2 containing all the hostnames and ip_addrs. all_hostname_ip_set=set(list(sum(output2, ( ## Get the intersection of the keys of the dict with the set. key_set=set(mongodb_data.keys()) int_keys=key_set all_hostname_ip_set # Print the entries of the dict for each member of the intersection. print ---intersection- for key in int_keys: print key,mongodb_data[key] ## 2). ## Get the difference between the keys of the dict and the intersection. deff_keys=key_set - all_hostname_ip_set ## Print the entries of the dict for each member of the difference. print ---difference--- for key in deff_keys: print key,mongodb_data[key] $ ./demo.py ---intersection- xxx.xx.xxx.11 3 xxx.xx.xxx.12 90 xxx.xx.xxx.13 12 xxx.xx.xxx.14 21 xxx.xx.xxx.15 54 xxx.xx.xxx.16 34 hostname2 27 hostname1 212 hostname10 1 hostname8 2 ---difference--- xxx.xx.xxx.29 3 xxx.xx.xxx.28 10 xxx.xx.xxx.17 11 xxx.xx.xxx.18 2 xxx.xx.xxx.19 19 xxx.xx.xxx.23 43 xxx.xx.xxx.22 31 xxx.xx.xxx.25 80 xxx.xx.xxx.24 46 xxx.xx.xxx.27 90 xxx.xx.xxx.26 91 xxx.xx.xxx.2 4 xxx.xx.xxx.21 25 hostname3 513 hostname4 98 xxx.xx.xxx.4 10 xxx.xx.xxx.20 21 xxx.xx.xxx.1 3 xxx.xx.xxx.3 8 3). Ip address with is there only in output2 dictionary. xxx.xx.xxx.200 xxx.xx.xxx.400 1. Create a set from output2 containing all the ip_addrs 2. Get the difference between the set and the keys of the dict created from output1. I have one problem here. I want to compare the output2 (hostname or ip address) with output1 'ip' values (i.e., either hostname or ip address of output2 does not matching the ip dict key in output1 then I want to print either hostname or ip address from output2). You already have the output1 'ip' values (the keys of mongodb_data) and the entries of output2 (all_hostname_ip_set). Just find the set difference. -- https://mail.python.org/mailman/listinfo/python-list
Re: Why didn't my threads exit correctly ?
Thanks for your reply, MRAB. I've seen that the child thread has been stoped, it just died in the queue.If I want the queue be empty, I must use queue.get() to dequeue and clean it, but I didn't do that. I've implement the thread using List now, thanks again. On Fri, Oct 4, 2013 at 2:25 AM, MRAB pyt...@mrabarnett.plus.com wrote: On 03/10/2013 18:37, 李洛 wrote: Hi list, I write an example script using threading as follow. It look like hang when the list l_ip is empty. And any suggestion with debug over the threading in Python ? 1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*- 3 import re 4 import os 5 import threading 6 from Queue import Queue 7 from time import sleep 8 9 l_ip = [] 10 l_result = [] 11 result = re.compile(r[1-3] received) 12 13 class ping(threading.Thread): 14 15 def __init__(self, l_ip, l_result): 16 threading.Thread.__init__(**self) 17 self.l_ip = l_ip 18 #self.l_result = l_result 19 20 def run(self): 21 22 while True: 23 try: 24 ip = self.l_ip.pop() 25 except IndexError as e: 26 print e 27 break 28 ping_out = os.popen(''.join(['ping -q -c3 ',ip]), 'r') 29 print 'Ping ip:%s' % ip 30 while True: 31 line = ping_out.readline() 32 if not line: break 33 if result.findall(line): 34 l_result.append(ip) 35 break 36 37 queue = Queue() 38 39 for i in range(1,110): 40 l_ip.append(''.join(['192.168.**1.', str(i)])) 41 for i in xrange(10): 42 t = ping(l_ip, l_result) 43 t.start() 44 queue.put(t) 45 queue.join() 46 print Result will go here. 47 for i in l_result: 48 print 'IP %s is OK' % i queue.join() will block until the queue is empty, which is never is! You're putting the workers in the queue, whereas the normal way of doing it is to put them into a list, the inputs into a queue, and the outputs into another queue. The workers then 'get' from the input queue, do some processing, and 'put' to the output queue. -- https://mail.python.org/**mailman/listinfo/python-listhttps://mail.python.org/mailman/listinfo/python-list -- All the best! http://luolee.me -- https://mail.python.org/mailman/listinfo/python-list
Re: API for custom Unicode error handlers
On Fri, Oct 4, 2013 at 11:56 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Should the module holding the error handlers automatically register them? In other words, if I do: import error_handlers just importing it will have the side-effect of registering the error handlers. Normally, I dislike imports that have side-effects of this sort, but I'm not sure that the alternative is better, that is, to put responsibility on the caller to register some, or all, of the handlers: import error_handlers error_handlers.register(error_handlers.namereplace_errors) error_handlers.register_all() Caveat: I don't actually use codecs much, so I don't know the specifics. I'd be quite happy with importing having a side-effect here. If you import a module that implements a numeric type, it should immediately register itself with the Numeric ABC, right? This is IMO equivalent to that. As far as I know, there is no way to find out what error handlers are registered, and no way to deregister one after it has been registered. The only risk that I see is of an accidental collision. Having a codec registered that you don't use can't hurt (afaik). Is there any mechanism for detecting a name collision? If not, I wouldn't worry about it. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: API for custom Unicode error handlers
On 10/04/2013 06:56 AM, Steven D'Aprano wrote: Should the module holding the error handlers automatically register them? I think it should. Registration only needs to happen once, the module is useless without being registered, no threads nor processes are being started, and the only reason to import the module is to get the functionality... isn't it? What about help(), sphynx (sp?), or other introspection tools? This sounds similar to cgitb -- another module which you only import if you want the html'ized traceback, and yet it requires a separate cgitb.enable() call... I change my mind, it shouldn't. Throw in a .enable() function and call it good. :) -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list
Re: API for custom Unicode error handlers
04.10.13 20:22, Chris Angelico написав(ла): I'd be quite happy with importing having a side-effect here. If you import a module that implements a numeric type, it should immediately register itself with the Numeric ABC, right? This is IMO equivalent to that. There is a difference. You can't use a numeric type without importing a module, but you can use error handler registered outside of your module. This leads to subtle bugs. Let the A module imports error_handlers and uses error handle. The module B uses error handle but doesn't import error_handlers. C.py imports A and B and all works. D.py imports B and A and fails. -- https://mail.python.org/mailman/listinfo/python-list
Help wanted: Writing a PMI Project Management system
I'm looking for anyone who has an interest in project management; workable Python design and programming skills; and wants to code for an open source Project Management system. Having used Redmine, Launchpad, Trak, OpenProj, and so on, I've found there's no good PM tools. Microsoft Project and Oracle PM are even kind of crap. The issue I have is that none of these are really in line with modern PM. The PMBOK and various practice standards outline something very different from what's available. For example: Redmine has the concept of Projects and Subprojects; but it doesn't have the concept of a Program, and instead follows the common open source model by which a Project is all on-going effort of a deliverable. Calling Mozilla Firefox a project is technically incorrect. Mozilla Firefox is the deliverable of a Program (called Mozilla Firefox), an ongoing effort to meet a business need (in this case, the business need is the collective desire to produce a Web browser). Mozilla Firefox 18 is a Project; Mozilla Firefox 19 is a Project; and so on. More Projects will be added to the Program; long-standing bugs in Mozilla Firefox are Program Issues, and a particular Project (i.e. Mozilla Firefox 21) may include as a requirement Correct and close bug #55995 or such. I've been trying to write a technically correct Project Management software system that adheres to the PMBOK 5e (released January 2013), but I am a crappy software designer. I can code, some, but I don't know Python well enough; I don't know how to accomplish some design aspects (like modularity--the ability to extend via drop-in plug-ins instead of by tightly integrated code) and I don't know much about software design at all anyway. I know how to translate procedural concepts into code in any language I can code in to the best of my understanding of the language--some people think this makes them good programmers; they create absolute garbage, and I have no intent of being that guy. I'll code, but I'll code based on the design of somebody actually competent, thanks. So I guess what I want is to find people who are: * Interested in Project Management as a concept * Skilled in application design and Python * Interested in putting these two things together and contributing to a program to develop a technically correct Project Management software suite In open source software development, the primary compensation is self-enrichment: Developers are attracted by the chance to learn something new, to enhance their skills, to contribute to something they feel is worthwhile, or to work on something they simply enjoy working on. Thus I need to find people who go, That looks interesting. Where do I find? From a planning perspective, the initial goal is to create the four main modules: * Project Management * Program Management * Portfolio Management * Work Breakdown Structure Projects are a temporary effort to produce a deliverable. Programs are an ongoing effort to address a business or organizational need, and may include other programs and projects. Portfolios are collections of Projects, Programs, and Portfolios under the control of an organization. A business may have its Portfolio, containing its Marketing and MIS Portfolios, which each contain Programs (for Marketing or MIS) that contain Projects and other Programs. A department may even have sub-portfolios: the MIS Portfolio may contain Networking Portfolio, Programming Portfolio, and Systems Portfolio for the three departments under MIS. Each Project has a Work Breakdown Structure. Every element is a deliverable, so something that must actually exist. The Project is itself the sole top-level element, for example: 1. Work Breakdown Structure Module The process of Decomposition is used to break down the project into manageable work. Work is Manageable when it can be understood; breaking it down further gives no gain and causes increased management overhead, so is wasteful. There are many decomposition strategies such as top-down, bottom-up, brainstorm, and fishbone; they are usually combined (I favor top-down, then bottom-up). The first level of decomposition can go in any direction. It is often recommended as decomposition by phase (Design, Implementation, Testing...) or by major deliverables (Drive System, Engine, Wheels, Suspension...), or combination means. 1. Work Breakdown Structure Module 1.1 Project Management 1.2 Design 1.3 Implementation 1.4 Testing 1.5 Release These are further broken down. 1. Work Breakdown Structure Module 1.1 Project Management 1.1.1 Work Breakdown Structure 1.1.2 Meetings 1.2 Design 1.2.1 Document Schema 1.2.2 UI 1.2.2.1 Outline View 1.2.2.2 Table View 1.2.2.3 Graphical View 1.3 Implementation 1.3.1 Back-End 1.3.1.1 Storage Class 1.3.1.2 Data Rendering 1.3.2 Front-End 1.3.2.1 Views 1.3.2.1.1 Outline View 1.3.2.1.2 Table View 1.3.2.1.3 Graphical View 1.4 Testing 1.5 Release
Re: compare two list of dictionaries
On 10/03/2013 09:11 AM, Mohan L wrote: Dear All, I have two list of dictionaries like below: In the below dictionaries the value of ip can be either hostname or ip address. output1=[ {'count': 3 , 'ip': 'xxx.xx.xxx.1'}, {'count': 4, 'ip': 'xxx.xx.xxx.2'}, {'count': 8, 'ip': 'xxx.xx.xxx.3'}, {'count': 10, 'ip': 'xxx.xx.xxx.4'}, {'count': 212, 'ip': 'hostname1'}, {'count': 27, 'ip': 'hostname2'}, {'count': 513, 'ip': 'hostname3'}, {'count': 98, 'ip': 'hostname4'}, {'count': 1, 'ip': 'hostname10'}, {'count': 2, 'ip': 'hostname8'}, {'count': 3, 'ip': 'xxx.xx.xxx.11'}, {'count': 90, 'ip': 'xxx.xx.xxx.12'}, {'count': 12, 'ip': 'xxx.xx.xxx.13'}, {'count': 21, 'ip': 'xxx.xx.xxx.14'}, {'count': 54, 'ip': 'xxx.xx.xxx.15'}, {'count': 34, 'ip': 'xxx.xx.xxx.16'}, {'count': 11, 'ip': 'xxx.xx.xxx.17'}, {'count': 2, 'ip': 'xxx.xx.xxx.18'}, {'count': 19, 'ip': 'xxx.xx.xxx.19'}, {'count': 21, 'ip': 'xxx.xx.xxx.20'}, {'count': 25, 'ip': 'xxx.xx.xxx.21'}, {'count': 31, 'ip': 'xxx.xx.xxx.22'}, {'count': 43, 'ip': 'xxx.xx.xxx.23'}, {'count': 46, 'ip': 'xxx.xx.xxx.24'}, {'count': 80, 'ip': 'xxx.xx.xxx.25'}, {'count': 91, 'ip': 'xxx.xx.xxx.26'}, {'count': 90, 'ip': 'xxx.xx.xxx.27'}, {'count': 10, 'ip': 'xxx.xx.xxx.28'}, {'count': 3, 'ip': 'xxx.xx.xxx.29'}] In the below dictionaries have either hostname or ip or both. output2=( {'hostname': 'INNCHN01', 'ip_addr': 'xxx.xx.xxx.11'}, {'hostname': 'HYDRHC02', 'ip_addr': 'xxx.xx.xxx.12'}, {'hostname': 'INNCHN03', 'ip_addr': 'xxx.xx.xxx.13'}, {'hostname': 'MUMRHC01', 'ip_addr': 'xxx.xx.xxx.14'}, {'hostname': 'n/a', 'ip_addr': 'xxx.xx.xxx.15'}, {'hostname': 'INNCHN05', 'ip_addr': 'xxx.xx.xxx.16'}, {'hostname': 'hostname1', 'ip_addr': 'n/a'}, {'hostname': 'hostname2', 'ip_addr': 'n/a'}, {'hostname': 'hostname10', 'ip_addr': ''}, {'hostname': 'hostname8', 'ip_addr': ''}, {'hostname': 'hostname200', 'ip_addr': 'xxx.xx.xxx.200'}, {'hostname': 'hostname300', 'ip_addr': 'xxx.xx.xxx.400'}, ) trying to get the following difference from the above dictionary 1). compare the value of 'ip' in output1 dictionary with either 'hostname' and 'ip_addr' output2 dictionary and print their intersection. Tried below code: for doc in output1: for row in output2: if((row[hostname] == doc[ip]) or (row[ip_addr] == doc[ip])): print doc[ip],doc[count] *output:* hostname1 212 hostname2 27 hostname10 1 hostname8 2 xxx.xx.xxx.11 3 xxx.xx.xxx.12 90 xxx.xx.xxx.13 12 xxx.xx.xxx.14 21 xxx.xx.xxx.15 54 xxx.xx.xxx.16 34 2). need to print the below output if the value of 'ip' in output1 dictionary is not there in in output2 dictionary(ip/hostname which is there in output1 and not there in output2): xxx.xx.xxx.1 3 xxx.xx.xxx.2 4 xxx.xx.xxx.3 8 xxx.xx.xxx.4 10 hostname3 513 hostname4 98 xxx.xx.xxx.17 11 xxx.xx.xxx.18 2 xxx.xx.xxx.19 19 xxx.xx.xxx.20 21 xxx.xx.xxx.21 25 xxx.xx.xxx.22 31 xxx.xx.xxx.23 43 xxx.xx.xxx.24 46 xxx.xx.xxx.25 80 xxx.xx.xxx.26 91 xxx.xx.xxx.27 90 xxx.xx.xxx.28 10 xxx.xx.xxx.29 3 3). Ip address with is there only in output2 dictionary. xxx.xx.xxx.200 xxx.xx.xxx.400 Any help would be really appreciated. Thank you Thanks Mohan L There is a bit of work that can be consolidated to help both case 2 and 3. Then both cases are a little more straightforward: ## import itertools inside_out = {x['ip']: x for x in output1} set1 = set(inside_out.keys()) ### CASE 2 ### set2 = set(itertools.chain.from_iterable([x.values() for x in output2])) for name in set1 - set2: print name, inside_out[name]['count'] ### CASE 3 ### set2 = set([x['ip_addr'] for x in output2]) print \n.join(set2 - set1) -- https://mail.python.org/mailman/listinfo/python-list
Re: API for custom Unicode error handlers
04.10.13 16:56, Steven D'Aprano написав(ла): I have some custom Unicode error handlers, and I'm looking for advice on the right API for dealing with them. I have a module containing custom Unicode error handlers. For example: # Python 3 import unicodedata def namereplace_errors(exc): c = exc.object[exc.start] try: name = unicodedata.name(c) except (KeyError, ValueError): n = ord(c) if n = 0x: replace = \\u%04x else: assert n = 0x10 replace = \\U%08x replace = replace % n else: replace = \\N{%s} % name return replace, exc.start + 1 I'm planning to built this error handler in 3.4 (see http://comments.gmane.org/gmane.comp.python.ideas/21296). Actually Python implementation should looks like: def namereplace_errors(exc): if not isinstance(exc, UnicodeEncodeError): raise exc replace = [] for c in exc.object[exc.start:exc.end]: try: replace.append(r'\N{%s}' % unicodedata.name(c)) except KeyError: n = ord(c) if n 0x100: replace.append(r'\x%02x' % n) elif n 0x1: replace.append(r'\u%04x' % n) else: replace.append(r'\U%08x' % n) return ''.join(replace), exc.end Now, my question: Should the module holding the error handlers automatically register them? This question interesting me too. -- https://mail.python.org/mailman/listinfo/python-list
Re: Tail recursion to while iteration in 2 easy steps
On 10/4/2013 6:46 AM, Ian Kelly wrote: On the other hand, if you start optimizing every tail call and not just the recursive functions, then I can see where that could start to get problematic for debugging -- as arbitrary functions get removed from the stack traces just because they happened to end in tail calls. The idea of CPython space-optimizing tail calls when the call is made has been suggested on python-ideas. Guido verified that it is technically possible with the current bytecode interpreter but rejected it because it would arbitrarily mess up stack traces. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: JUST GOT HACKED
Ravi Sahni ganeshsahn...@gmail.com writes: I find this real confused!! Why they are answering then?!?! As far as I can make out everyone who is answering (helping!) doing it frustratation and disgust. But still they keep answering and answering!! I answered him because I wanted to help him. I also find it interesting to solve Python problems. I did not like Nikos' arrogance, ignorance and his refusal to use perfectly good solutions. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list
Re: Tail recursion to while iteration in 2 easy steps
On 10/4/2013 5:49 AM, Alain Ketterlin wrote: I think allowing rebinding of function names is extremely strange, Steven already countered the 'is extremely strange' part by showing that such rebinding is common, generally useful, and only occasionally dodgy and a candidate for being blocked. I want to consider here what it would mean to concretely implement the abstract notion 'disallow rebinding of function names' and show what would be behind calling the idea 'not feasible'. 1. A 'name' is not a 'function name' unless the name is bound, at runtime, to a 'function'. 2. A 'function' in Python is not just one class but any callable object -- with with a __call__ methods. That comprises an unbounded set. 3. Python does not mandate how namespaces are implemented. CPython uses both dicts and, for function local namespaces, internal C arrays. So 'names' in code can become either string keys for dicts or integer indexes for arrays. 4. Rebinding can be explicit ('='), implicit ('import', 'class', 'def'), *or hidden* (globals('a') = 1; ob.__dict__('a') = 1). The 'hidden' methods are intentional as they are sometimes needed*. In CPython, these forms remain different in the byte code, but it could be otherwise. The point is that is may or may not be possible for the interpreter to even recognize a 'rebinding' in order to apply any rebinding blocking rule. * There is no trick (that I know of) for hidden rebinding of function locals and nonlocals (short of using ctypes), but I am not sure that this is a language guarantee. However, I an sure that the absence is intentional. even though it's easier to implement. No kidding. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: API for custom Unicode error handlers
On 10/4/2013 3:35 PM, Serhiy Storchaka wrote: 04.10.13 16:56, Steven D'Aprano написав(ла): I have some custom Unicode error handlers, and I'm looking for advice on the right API for dealing with them. I'm planning to built this error handler in 3.4 (see http://comments.gmane.org/gmane.comp.python.ideas/21296). Should the module holding the error handlers automatically register them? This question interesting me too. I did not respond on the p-i thread, but +1 for 'namereplace' also. Like others, I would prefer auto-register unless that creates a problem. If it is a problem, perhaps the registry mechanism needs improvement. On the other hand, it is it built-in, it will be pre-registered. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Hyper-spacial ray-tracer
On 10/04/2013 04:23 PM, Tony the Tiger wrote: On Wed, 02 Oct 2013 17:05:32 -0400, Rouslan Korneychuk wrote: game Sorry, but that sounds awful. I hate games. This... isn't a game or even related to gaming. Is it because of the use of Pygame that you thought it was. I use Pygame because it's a wrapper for SDL, which gives you cross-platform graphics, input and even thread support, and because the additional drawing and font modules are useful for prototyping and implementing user-interfaces for navigating higher-dimensional space. The point of this was to explore the concept of hyperspace, which is a mathematical curiosity and also has relevance in theoretical physics. One idea I had for this was to simulate some sort of 3D scene involving physics (probably in another program, such as Blender), take the resulting coordinates of the geometry at every time interval and plot it as one 4D static scene. Every pair of connected vertexes would be extruded from one instant in time, to the next, so each object is a continuous 4D extrusion. When viewing with your local XYZ axes aligned with the global XYZ axes, you would see one instant of the scene as normal. Moving along the fourth axis, which I'll call T, will let you see the same, earlier or later in time, but if you rotate parallel to the T axis, you will effectively replace one of X, Y or Z with T. In essence you will turn the time axis into a spacial axis and the spacial axis into a time axis. Looking at a scene with space and time lumped into one 4D space might help in trying to better understand time, why it's different, and its relationship with space. I was also wondering about general relativity. I'm not going to go into too much detail, but basically: if an object with synchronized clocks on either end of it, passes by a static observer while traveling near the speed of light, to the outside observer, the object will appear shorter and the clocks will appear desynchronized, and from the object's perspective, it is the outside observer that becomes distorted this way. I was wondering if this seemingly strange effect is actually the natural consequence of a simple geometric transformation, such as rotation into the time axis. -- https://mail.python.org/mailman/listinfo/python-list
Re: Hyper-spacial ray-tracer
On Sat, Oct 5, 2013 at 10:17 AM, Rouslan Korneychuk rousl...@msn.com wrote: The point of this was to explore the concept of hyperspace, which is a mathematical curiosity and also has relevance in theoretical physics. I don't have any actual use-case for what you've done, but it sure sounds cool! Having worked with 3D ray-tracing (with POV-Ray), I'm slightly in awe of the possibility of going to ten dimensions... yup, cool! ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Hyper-spacial ray-tracer
On 10/04/2013 09:41 PM, Chris Angelico wrote: On Sat, Oct 5, 2013 at 10:17 AM, Rouslan Korneychuk rousl...@msn.com wrote: The point of this was to explore the concept of hyperspace, which is a mathematical curiosity and also has relevance in theoretical physics. I don't have any actual use-case for what you've done, but it sure sounds cool! Having worked with 3D ray-tracing (with POV-Ray), I'm slightly in awe of the possibility of going to ten dimensions... yup, cool! Thanks. For a while, I was worried nobody else thought it was interesting. It's funny that you say that about ten dimensions, considering I was thinking I should add scroll bars to the example script so the controls don't get cut off when going to 100 dimensions. -- https://mail.python.org/mailman/listinfo/python-list
[issue19087] bytearray front-slicing not optimized
Serhiy Storchaka added the comment: I don't see much sense in differences between bytea_slice2.patch and bytea_slice3.patch, because bytea_slice3.patch is not smaller and simpler than bytea_slice2.patch. I meant that you can continue use self-ob_bytes instead of PyByteArray_AS_STRING(self) if self-ob_bytes points not to the start of physical buffer, but to the start of logical byte array. *This* will simplify the patch a lot. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19087 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19156] Enum helper functions test-coverage
Changes by Ethan Furman et...@stoneleaf.us: -- assignee: - ethan.furman nosy: +ethan.furman stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19156 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19159] 2to3 incorrectly converts two parameter unicode() constructor to str()
Serhiy Storchaka added the comment: This is not a bug, str accepts the encoding argument in Python 3. And in contrast to the decode method it works with arbitrary byte-like objects (i.e. array.array). -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19159 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19087] bytearray front-slicing not optimized
Antoine Pitrou added the comment: I meant that you can continue use self-ob_bytes instead of PyByteArray_AS_STRING(self) if self-ob_bytes points not to the start of physical buffer, but to the start of logical byte array. *This* will simplify the patch a lot. It will make the diff smaller but it will not simplify the patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19087 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10049] Add a no-op (null) context manager to contextlib
Changes by Piotr Dobrogost p...@bugs.python.dobrogost.net: -- nosy: +piotr.dobrogost ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10049 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1673203] add identity function
Changes by Piotr Dobrogost p...@bugs.python.dobrogost.net: -- nosy: +piotr.dobrogost ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1673203 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11011] More functools functions
Changes by Piotr Dobrogost p...@bugs.python.dobrogost.net: -- nosy: +piotr.dobrogost ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11011 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19161] collections Counter handles nan strangely
New submission from Adam Davison: If you pass an array containing nan to collections.Counter, rather than counting the number of 'nan's it outputs 'nan': 1 n times into the dictionary. I appreciate using this on an array of floats is a bit of an unusual case but I don't think this is the expected behaviour based on the documentation. To reproduce, try e.g.: a = [1, 1, 1, 2, 'nan', 'nan', 'nan'] collections.Counter(map(float, a)) Based on the documentation I expected to see: {1.0: 3, 2.0: 1, nan: 3} But it actually returns: {1.0: 3, 2.0: 1, nan: 1, nan: 1, nan: 1} Presumably this relates to the fact that nan != nan. I'm not 100% sure if this is a bug or maybe just something that should be mentioned in the documentation... Certainly it's not what I wanted it to do :) Thanks, Adam -- components: Library (Lib) messages: 198938 nosy: Adam.Davison priority: normal severity: normal status: open title: collections Counter handles nan strangely type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19161 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19161] collections Counter handles nan strangely
Mark Dickinson added the comment: Presumably this relates to the fact that nan != nan. Yep. What you're seeing is pretty much expected behaviour, and it matches how NaNs behave with respect to containment in other Python contexts: x = float('nan') y = float('nan') s = {x} x in s True y in s False There's a much-discussed compromise between object model sanity and respect for IEEE 754 here. You can find the discussions on the mailing lists, but the summary is that this isn't going to change in a hurry. One way you can work around this is to make sure you only have single NaN object (possibly referenced multiple times) in your list. Then you get the behaviour that you're looking for: nan = float('nan') a = [1, 1, 2, nan, nan, nan] collections.Counter(a) Counter({nan: 3, 1: 2, 2: 1}) By the way, when you say 'array of floats', do you mean a NumPy ndarray, a standard library array.array object, or a plain Python list? The example you show is a list containing a mixture of ints and strings. I suggest closing this as 'wont fix'. Raymond? -- nosy: +mark.dickinson, rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19161 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19161] collections Counter handles nan strangely
Adam Davison added the comment: Thanks for the quick response. I'm really using a pandas Series, which is effectively a numpy array behind the scenes as far as I understand, the example I pasted was just to illustrate the behaviour. So the nans are being produced elsewhere, I don't really have control over that step. It seems like perhaps collections.Counter should handle nans as a special case. But I can appreciate the counter-arguments too. Thanks, Adam -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19161 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19162] datetime.datetime.min.strftime('%Y') not working
New submission from Filip Zyzniewski: The datetime class provides a min datetime object which is not formattable: on Python 2: $ python Python 2.7.3 (default, Apr 10 2013, 05:13:16) [GCC 4.7.2] on linux2 Type help, copyright, credits or license for more information. import datetime datetime.datetime.min.strftime('%Y') Traceback (most recent call last): File stdin, line 1, in module ValueError: year=1 is before 1900; the datetime strftime() methods require year = 1900 and on Python 3: $ python3 Python 3.2.3 (default, Apr 10 2013, 05:07:54) [GCC 4.7.2] on linux2 Type help, copyright, credits or license for more information. import datetime datetime.datetime.min.strftime('%Y') Traceback (most recent call last): File stdin, line 1, in module ValueError: year=1 is before 1000; the datetime strftime() methods require year = 1000 It seems to me that either datetime.datetime.min.year should be increased to 1900/1000 or strftime should be able to format year=1 - it is strange that the API doesn't support its own constants. -- components: Library (Lib) messages: 198941 nosy: filip.zyzniewski priority: normal severity: normal status: open title: datetime.datetime.min.strftime('%Y') not working type: behavior versions: Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19162 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19163] PyString_Format with dict
New submission from hiroaki itoh: http://docs.python.org/2.7/c-api/string.html#PyString_Format The documents says `The args argument must be a tuple.', But if format is like '%(key)s', PyString_Format claims args must be mapping protocol. (At least 2.7.3.) -- assignee: docs@python components: Documentation messages: 198942 nosy: docs@python, xwhhsprings priority: normal severity: normal status: open title: PyString_Format with dict type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19163 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19164] Update uuid.UUID TypeError exception: integer should not be an argument.
New submission from Marco Buccini: When you try to use uuid.UUID() without arguments you get a TypeError exception saying that you can actually use an integer (while you cannot). Python 2.6.8 (default, Apr 26 2013, 16:24:53) [GCC 4.6.3] on linux2 uuid.UUID() Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python2.6/uuid.py, line 129, in __init__ raise TypeError('need one of hex, bytes, bytes_le, fields, or int') TypeError: need one of hex, bytes, bytes_le, fields, or int uuid.UUID(uuid.uuid4().int) Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python2.6/uuid.py, line 131, in __init__ hex = hex.replace('urn:', '').replace('uuid:', '') AttributeError: 'long' object has no attribute 'replace' So, let's check with an integer - maybe an int has 'replace'. uuid.UUID(1231231) Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python2.6/uuid.py, line 131, in __init__ hex = hex.replace('urn:', '').replace('uuid:', '') AttributeError: 'int' object has no attribute 'replace' No, it doesn't. Anyway, with a propery hex value, it works (of course!). uuid.UUID(uuid.uuid4().hex) UUID('89b1283d-c32e-4b8a-a9e3-a699445fdd4d') -- assignee: docs@python components: Documentation messages: 198943 nosy: docs@python, makronized priority: normal severity: normal status: open title: Update uuid.UUID TypeError exception: integer should not be an argument. type: behavior versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19164 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19162] datetime.datetime.min.strftime('%Y') not working
tomasz.zaleski added the comment: works correctly on python3.3: Python 3.3.2 (default, Oct 4 2013, 12:21:07) [GCC 4.2.1 20070831 patched [FreeBSD]] on freebsd9 Type help, copyright, credits or license for more information. import datetime datetime.datetime.min.strftime('%Y') '0001' issue on 2.7: Python 2.7.5 (default, Sep 17 2013, 12:11:31) [GCC 4.2.1 20070831 patched [FreeBSD]] on freebsd9 Type help, copyright, credits or license for more information. import datetime datetime.datetime.min.strftime('%Y') Traceback (most recent call last): File stdin, line 1, in module ValueError: year=1 is before 1900; the datetime strftime() methods require year = 1900 -- nosy: +krzaq ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19162 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19153] Embedding into a shared library fails again
Antoine Pitrou added the comment: No custom builds. Every package from ubuntu repository. Psycopg2 installed by pip You may have to rebuild packages using the custom Python, not the system Python, since the linker options have to be different (especially the shared part: Ubuntu's Python is a static build, not a shared library build). Or perhaps you can dlopen the CPython shared library with the RTLD_GLOBAL flag. I don't know. I don't know if this is something that we can alleviate in Python itself. -- nosy: +doko, pitrou, sandro.tosi versions: +Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19153 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19164] Update uuid.UUID TypeError exception: integer should not be an argument.
Vajrasky Kok added the comment: The exception message is correct. You can give an integer argument. But you have to use keyword argument. uuid.UUID(int=uuid.uuid4().int) UUID('62ad61e5-b492-4f01-81e6-790049051c4f') From the documentation: __init__(self, hex=None, bytes=None, bytes_le=None, fields=None, int=None, v ersion=None) | Create a UUID from either a string of 32 hexadecimal digits, | a string of 16 bytes as the 'bytes' argument, a string of 16 bytes | in little-endian order as the 'bytes_le' argument, a tuple of six | integers (32-bit time_low, 16-bit time_mid, 16-bit time_hi_version, | 8-bit clock_seq_hi_variant, 8-bit clock_seq_low, 48-bit node) as | the 'fields' argument, or a single 128-bit integer as the 'int' | argument. When a string of hex digits is given, curly braces, | hyphens, and a URN prefix are all optional. For example, these | expressions all yield the same UUID: -- nosy: +vajrasky ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19164 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19161] collections Counter handles nan strangely
Mark Dickinson added the comment: perhaps collections.Counter should handle nans as a special case I don't think that would be a good idea: I'd rather that collections.Counter didn't special case NaNs in any way, but instead treated NaNs following the same (admittedly somewhat awkward) rules that all the other Python collections do---namely, for NaNs, containment effectively works by object identity. I'm really using a pandas Series Okay, that makes sense. It's a bit unfortunate that NumPy creates a new NaN object every time you read a NaN value out of an array, so that you get e.g., from numpy import array, nan, isnan import numpy as np my_list = [1.2, 2.3, np.nan, np.nan] my_list[2] is my_list[3] True my_array = np.array(my_list) my_array[2] is my_array[3] False Or even: my_array[2] is my_array[2] False I guess you're stuck with using Pandas functionality like `dropna` and `isnull` to deal with missing and non-missing values separately. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19161 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19158] BoundedSemaphore.release() subject to races
Richard Oudkerk added the comment: Is BoundedSemaphore really supposed to be robust in the face of too many releases, or does it just provide a sanity check? I think that releasing a bounded semaphore too many times is a programmer error, and the exception is just a debugging aid for the programmer. Raising an exception 99% of the time should be sufficient for that purpose. -- nosy: +sbt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19158 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19155] Display stack info with color in pdb (the w command)
R. David Murray added the comment: I think we are unlikely to do this, as pdb is a very simple text interface. I'm sure a patch would be considered if one was offered, but the increase in complexity of the codebase would need to be minimal for it to be accepted, and I suspect the feature would need to be off by default. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19155 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19155] Display stack info with color in pdb (the w command)
Ezio Melotti added the comment: Agreed with David. You can use https://bitbucket.org/antocuni/pdb/src instead. -- nosy: +ezio.melotti resolution: - rejected stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19155 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19162] datetime.datetime.min.strftime('%Y') not working
R. David Murray added the comment: Indeed, this is already fixed. This issue is a duplicate of issue 1777412. The bug will not be fixed in earlier versions for the reasons discussed in that issue. -- nosy: +r.david.murray resolution: - duplicate stage: - committed/rejected status: open - closed superseder: - datetime.strftime dislikes years before 1900 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19162 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14455] plistlib unable to read json and binary plist files
Ronald Oussoren added the comment: I'd really like to include this patch in 3.4, but haven't managed to do any opensource work in the previous period and don't know when I'll be able to actually commit this (and more importantly, be available when issues crop up) :-( -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14455 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16803] Make test_importlib run tests under both _frozen_importlib and importlib._bootstrap
Brett Cannon added the comment: It looks like as long as you block _frozen_importlib and do a fresh import of importlib you can make sure to use the source version of importlib._bootstrap instead of _frozen_importlib. from test.support import import_fresh_module mod = import_fresh_module('importlib.abc', fresh=('importlib',), blocked=('_frozen_importlib',)) mod module 'importlib.abc' from '/Users/bcannon/Repositories/cpython/default/Lib/importlib/abc.py' mod._bootstrap module 'importlib._bootstrap' from '/Users/bcannon/Repositories/cpython/default/Lib/importlib/_bootstrap.py' mod._frozen_importlib import importlib importlib._bootstrap module 'importlib._bootstrap' (frozen) mod2 = import_fresh_module('importlib', blocked=('_frozen_importlib',)) mod2 module 'importlib' from '/Users/bcannon/Repositories/cpython/default/Lib/importlib/__init__.py' mod2._bootstrap module 'importlib._bootstrap' from '/Users/bcannon/Repositories/cpython/default/Lib/importlib/_bootstrap.py' -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16803 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16803] Make test_import test_importlib run tests under both _frozen_importlib and importlib._bootstrap
Changes by Brett Cannon br...@python.org: -- title: Make test_importlib run tests under both _frozen_importlib and importlib._bootstrap - Make test_import test_importlib run tests under both _frozen_importlib and importlib._bootstrap ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16803 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19163] PyString_Format with dict
Roundup Robot added the comment: New changeset 405245885569 by Benjamin Peterson in branch '2.7': dict is also allowed (closes #19163) http://hg.python.org/cpython/rev/405245885569 -- nosy: +python-dev resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19163 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19164] Update uuid.UUID TypeError exception: integer should not be an argument.
Georg Brandl added the comment: Yeah, the first message should probably say one of the hex, bytes, bytes_le, fields, or int arguments must be given -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19164 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18716] Deprecate the formatter module
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/issue18716 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18716] Deprecate the formatter module
Roundup Robot added the comment: New changeset 04ff1cc40d62 by Brett Cannon in branch 'default': Issue #18716: Deprecate the formatter module http://hg.python.org/cpython/rev/04ff1cc40d62 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18716 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19165] Change formatter warning to DeprecationWarning in 3.5
Changes by Brett Cannon br...@python.org: -- assignee: brett.cannon components: Library (Lib) nosy: brett.cannon priority: normal severity: normal status: open title: Change formatter warning to DeprecationWarning in 3.5 versions: Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19165 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19166] Unusued variable in test_keys in Lib/test/test_dict.py
New submission from Vajrasky Kok: This is the test. def test_keys(self): d = {} self.assertEqual(set(d.keys()), set()) d = {'a': 1, 'b': 2} k = d.keys() self.assertIn('a', d) self.assertIn('b', d) self.assertRaises(TypeError, d.keys, None) self.assertEqual(repr(dict(a=1).keys()), dict_keys(['a'])) As you can see, the variable k is never used. Attached the patch to give purpose to variable k. -- components: Tests files: fix_test_dict_unused_variable.patch keywords: patch messages: 198957 nosy: vajrasky priority: normal severity: normal status: open title: Unusued variable in test_keys in Lib/test/test_dict.py versions: Python 3.4 Added file: http://bugs.python.org/file31958/fix_test_dict_unused_variable.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19166 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16803] Make test_import test_importlib run tests under both _frozen_importlib and importlib._bootstrap
Brett Cannon added the comment: Turns out this isn't as clean-cut as simply using test.support.import_fresh_module() as you end up with different instances of importlib._bootstrap which kills any possible subclass checks, etc. between e.g. importlib.abc and importlib.machinery as the source versions will have different instances of importlib._bootstrap. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16803 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6028] Interpreter aborts when chaining an infinite number of exceptions
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6028 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19158] BoundedSemaphore.release() subject to races
Tim Peters added the comment: Richard, that's a strange argument ;-) Since, e.g., a BoundedSemaphore(1) is semantically equivalent to a mutex, it's like saying some_mutex.release() usually raises an exception if the mutex isn't held at the time - but maybe it won't. If the docs _say_ it's not reliable, fair enough. But they don't say that. When a thread gimmick is _intended_ to be probabilistic, the docs say so (e.g., Queue.qsize()). Probably would have been better if a bounded=False optional argument to Semaphore.__init__() had been added, rather than creating a new BoundedSemaphore class. But, as is, it could easily be made reliable: 1. Change Semaphore's condition variable to use an RLock (instead of the current Lock). 2. Stuff the body of BoundedSemaphore.release() in a `with self._cond:` block. Curiously, there doesn't appear to be a test that BoundedSemaphore.release ever raises ValueError. So I'll readily agree that nobody ever took this seriously ;-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19158 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16803] Make test_import test_importlib run tests under both _frozen_importlib and importlib._bootstrap
Roundup Robot added the comment: New changeset f0416b2b5654 by Brett Cannon in branch 'default': Issue #16803: Run test.test_importlib.test_abc under both http://hg.python.org/cpython/rev/f0416b2b5654 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16803 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19153] Embedding into a shared library fails again
Rinat added the comment: Or perhaps you can dlopen the CPython shared library with the RTLD_GLOBAL flag. I don't know. Yes, it works. I made it is my shared library before boost block like this { void* handle = dlopen(libpython2.7.so, RTLD_LAZY | RTLD_GLOBAL); // boost wrapper for python call dlclose(handle); } I think if nothing helps, i'll put this code into __attribute__((ctor|dtor)) functions Thanks a lot -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19153 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16195] Difficult or impossible to figure out how garbage collector and weak references should interact for user-defined extension types
Changes by Phil Connell pconn...@gmail.com: -- nosy: +pconnell ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16195 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19153] Embedding into a shared library fails again
Antoine Pitrou added the comment: Ok, making it a documentation issue in case it deserves clarification in the docs. -- assignee: - docs@python components: +Documentation -Library (Lib) nosy: +docs@python ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19153 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19119] duplicate test name in Lib/test/test_heapq.py
STINNER Victor added the comment: @Xavier de Gaye: Nice, you found many similar issues. How did you find them? Would it be possible to automate the detection of duplicated test names? -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19119 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19167] sqlite3 cursor.description varies across Linux (3.3.1), Win32 (3.3.2), when selecting from a view.
New submission from mpb: On Win32, when I select from an SQLite view, and enclose the column name in double quotes in the select query, the cursor description (erroneously?) contains the double quotes. On Linux (or on Win32 when selecting from a table rather than a view) the cursor description does not contain the double quotes. I expect the Linux behavior, not the Win32 behavior. The following code demonstrates the problem. import sqlite3, sys print (sys.platform) print (sys.version) conn = sqlite3.connect (':memory:') cur = conn.cursor () cur.execute ('create table Foo ( foo_id integer primary key ) ;') cur.execute ('create view Foo_View as select * from Foo ;') cur.execute ('select foo_id from Foo;') print (cur.description[0][0]) cur.execute ('select foo_id from Foo;') print (cur.description[0][0]) cur.execute ('select foo_id from Foo_View;') print (cur.description[0][0]) cur.execute ('select foo_id from Foo_View;') print (cur.description[0][0]) Sample output on Linux and Win32. linux 3.3.1 (default, Apr 17 2013, 22:32:14) [GCC 4.7.3] foo_id foo_id foo_id foo_id win32 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 32 bit (Intel)] foo_id foo_id foo_id foo_id Above, please note the (erroneous?) double quotes around the final foo_id. -- components: Library (Lib) messages: 198964 nosy: mpb priority: normal severity: normal status: open title: sqlite3 cursor.description varies across Linux (3.3.1), Win32 (3.3.2), when selecting from a view. type: behavior versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19167 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18679] include a codec to handle escaping only control characters but not any others
Derek Wilson added the comment: Any update on this? Just so you can see what my work around is, I'll paste in the code I'm using. The major issue I have with this is that performance doesn't scale to large strings. This is also a bytes-to-bytes or str-to-str encoding, because this is the type of operation that one plans to do with the data one has. Having a full fledged streaming codec to handle this would be very helpful when writing applications that stream tab and newline separated utf-8 data over stdin/stdout. text_types = (str, ) escape_tm = dict((k, repr(chr(k))[1:-1]) for k in range(32)) escape_tm[0] = '\0' escape_tm[7] = '\a' escape_tm[8] = '\b' escape_tm[11] = '\v' escape_tm[12] = '\f' escape_tm[ord('\\')] = '' def escape_control(s): if isinstance(s, text_types): return s.translate(escape_tm) else: return s.decode('utf-8', 'surrogateescape').translate(escape_tm).encode('utf-8', 'surrogateescape') def unescape_control(s): if isinstance(s, text_types): return s.encode('latin1', 'backslashreplace').decode('unicode_escape') else: return s.decode('utf-8', 'surrogateescape').encode('latin1', 'backslashreplace').decode('unicode_escape').encode('utf-8', 'surrogateescape') -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18679 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19159] 2to3 incorrectly converts two parameter unicode() constructor to str()
Gregory P. Smith added the comment: Correct, my characterization above was wrong (I shouldn't write these up without the interpreter right in front of me). What is wrong with the conversion is: unicode(, utf-8) in python 2.x should become either str(b, utf-8) or, better, just in Python 3.x. The better version could be done if the codec and value can be represented in the encoding of the output 3.x source code file as is but that optimization is not critical. In order for str() to take a second arg (the codec) the first cannot be a unicode string already: str(foo, utf-8) Traceback (most recent call last): File stdin, line 1, in module TypeError: decoding str is not supported -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19159 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19119] duplicate test name in Lib/test/test_heapq.py
Xavier de Gaye added the comment: It was proposed, in issue 16056, to enhance `make patchcheck` with the detection of duplicate code names. This triggered the creation of issue 16079. The script named duplicate_code_names_2.py, in issue 16079, listed about 20 duplicate names among all the non-nested functions, classes or methods in the whole repository (default branch), mostly duplicated test names. I have entered an issue for each one of these cases, they are listed in issue 16079. Yes, this detection can be automated. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19119 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19159] 2to3 incorrectly converts two parameter unicode() constructor to str()
Serhiy Storchaka added the comment: Just add the b prefix to literal string argument of unicode() in Python 2. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19159 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19168] pprint.pprint(..., compact=True) not implemented
New submission from Alexis Layton: Documentation for 3.4 states that the compact keyword-only argument has been added to 3.4. However: Python 3.4.0a3 (default, Oct 2 2013, 14:05:02) [GCC 4.6.3] on linux Type help, copyright, credits or license for more information. import pprint pprint(3, compact=True) Traceback (most recent call last): File stdin, line 1, in module TypeError: 'module' object is not callable pprint.pprint(3, compact=True) Traceback (most recent call last): File stdin, line 1, in module TypeError: pprint() got an unexpected keyword argument 'compact' -- components: Library (Lib) messages: 198969 nosy: AlexisLayton priority: normal severity: normal status: open title: pprint.pprint(..., compact=True) not implemented type: behavior versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19168 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18986] Add a case-insensitive case-preserving dict
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- assignee: - rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18986 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19168] pprint.pprint(..., compact=True) not implemented
Ezio Melotti added the comment: This a very recent change, see #19132. Python 3.4.0a3+ (default:f0416b2b5654, Oct 5 2013, 02:10:25) [GCC 4.7.3] on linux Type help, copyright, credits or license for more information. import pprint pprint.pprint(3, compact=True) 3 -- nosy: +ezio.melotti, serhiy.storchaka resolution: - invalid stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19168 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18594] C accelerator for collections.Counter is slow
Roundup Robot added the comment: New changeset e4cec1116e5c by Raymond Hettinger in branch '3.3': Issue #18594: Make the C code more closely match the pure python code. http://hg.python.org/cpython/rev/e4cec1116e5c -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18594 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19166] Unusued variable in test_keys in Lib/test/test_dict.py
Roundup Robot added the comment: New changeset 92c2e76ca595 by Ezio Melotti in branch '2.7': #19166: use an unused var in a test. Patch by Vajrasky Kok. http://hg.python.org/cpython/rev/92c2e76ca595 New changeset 33bbc60705e8 by Ezio Melotti in branch '3.3': #19166: use an unused var in a test. Patch by Vajrasky Kok. http://hg.python.org/cpython/rev/33bbc60705e8 New changeset 16a88d026571 by Ezio Melotti in branch 'default': #19166: merge with 3.3. http://hg.python.org/cpython/rev/16a88d026571 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19166 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com