ANN: kryptomime 0.1.3
kryptomime 0.1.3 has been released. https://pypi.python.org/pypi/kryptomime/0.1.3 About kryptomime A package for encrypted MIME messages. It currently supports PGP/MIME via GnuPG. S/MIME support is planned for future releases. Disclaimer -- Proper kryptography requires security audits of the complete system. Even though the author is not aware of any bugs in this software, it comes with ABSOLUTELY NO WARRANTY. USE THIS SOFTWARE AT YOUR OWN RISK. Installation From PyPI: [sudo] pip install kryptomime To install this package from this git repository, do: git clone https://github.com/ttanner/kryptomime.git cd kryptomime python setup.py install python setup.py test Optionally to build the documentation after installation, do: cd docs make html This is a simple example of how to use kryptomime:: from kryptomime import create_mail, GPGMIME import gnupg gpg = gnupg.GPG(home='gpghome') krypto = GPGMIME(gpg,default_key=('f...@bar.com','passphrase')) msg = create_mail('f...@bar.com','b...@fnord.net','subject','body\nmessage') sgnmsg,results = krypto.sign(msg) verified, results = krypto.verify(sgnmsg) rawmsg,signed = krypto.strip_signature(sgnmsg) encmsg,results = krypto.encrypt(msg,sign=True) verified, results = krypto.verify(encmsg) decmsg, verified, results = krypto.decrypt(encmsg) Bug Reports Feature Requests -- Please use the bugtracker https://github.com/ttanner/kryptomime/issues on Github. -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
ANNOUNCE: wxPython 3.0.0.0
Announcing -- wxPython 3.0.0.0 (classic) has been released and is now available for download at http://wxpython.org/download.php. No new features but lots of bug fixes in wxWidgets and of course the bump (finally!) up to 3.0. Various binaries are available for 32-bit and 64-bit Windows, and also for OSX using the Carbon and Cocoa APIs, for Python 2.6 and 2.7. Source code is also available at http://wxpython.org/download.php of course, for building your own. What is wxPython? - wxPython is a GUI toolkit for the Python programming language. It allows Python programmers to create programs with a robust, highly functional graphical user interface, simply and easily. It is implemented as a set of Python extension modules that wrap the GUI components of the popular wxWidgets cross platform library, which is written in C++. wxPython is a cross-platform toolkit. This means that the same program will usually run on multiple platforms without modifications. Currently supported platforms are 32-bit and 64-bit Microsoft Windows, most Linux or other Unix-like systems using GTK2, and Mac OS X 10.4+. In most cases the native widgets are used on each platform to provide a 100% native look and feel for the application. -- Robin Dunn Software Craftsman http://wxPython.org -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
isort - the automatic Python import sorter - version 3.0.0 released
isort v 3.0.0 released with the following major features: - Built-in support for editorconfig config files (http://editorconfig.org/) - Support for consistent syntax when adding or removing imports - Improved handling of files that a user doesn't have permission to read - The ability to separate import sections with custom comments see more here: http://timothycrosley.github.io/isort/ -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
PyDev 3.2.0 Released
Hi All, PyDev 3.2.0 has been released Details on PyDev: http://pydev.org Details on its development: http://pydev.blogspot.com LiClipse (PyDev standalone with goodies such as support for Django Templates, Mako Templates, Html, Javascript, etc): http://brainwy.github.io/liclipse/ Release Highlights: --- * **Important**: PyDev requires Eclipse 3.8 or 4.3 onwards and Java 7! For older versions, keep using PyDev 2.x. * **General**: * Added option to sort imports on save. * Showing dialog suggesting user to customize settings in Eclipse which are more suitable for PyDev. * Memory improvements on situations where an OutOfMemoryError could happen. * Search references (Ctrl+Shift+G) when initial is on external module works (for matches in workspace). * **Rename refactoring**: * Added option to rename module without updating references. * Bugfixes. * **Performance**: * Code completion: Builtins gotten from a shell are now cached for subsequent requests. * Doing a full build (reindex) is faster. * **Debugger**: * Improvements on stackless integration. * Providing a view which shows the current caught exception. * Providing way to ignore current caught exception. * Providing option to show progress on taskbar when breakpoint is hit to get the users attention (windows 7). * Fixed issue in while getting referrers when getting __dict__ and having an exception. What is PyDev? --- PyDev is a plugin that enables users to use Eclipse for Python, Jython and IronPython development -- making Eclipse a first class Python IDE -- It comes with many goodies such as code completion, syntax highlighting, syntax analysis, refactor, debug and many others. Cheers, -- Fabio Zadrozny -- Software Developer LiClipse http://brainwy.github.io/liclipse PyDev - Python Development Environment for Eclipse http://pydev.org http://pydev.blogspot.com -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Re: On a scrollbar for tkinter
@Terry Quite sorry but had to write that message in a hurry, didn't notice the name. @Rick I found some solutions for python 2.x, but still, as I am with the future, I need a futuristic solution or 2, so if anyone else could help me, I'd be grateful! -- https://mail.python.org/mailman/listinfo/python-list
Re: Ifs and assignments
On 1/2/2014 8:20 PM, Mark Lawrence wrote: On 03/01/2014 00:57, Gary Herron wrote: On 01/02/2014 01:44 PM, John Allsup wrote: The point of my original post was that, whilst C's if( x = 2 ) { do something } and if( x == 2 ) { do something } are easy to confuse, and a source of bugs, having a construct like follows: if x == 2: do something # what happens at present if testFunc() as x: do something with x using the 'as' syntax that appears with 'with' and 'except', would allow for the advantages of C style assignments in conditionals but without the easy confusion, since here the syntax is significantly different between assignment and equality testing (rather than a character apart as happens with C). This occurs further down in my original post (past the point where you inserted your reply). Another post suggested a workaround by defining a 'pocket' class, for which I am grateful. John Sorry. I shot off my answer before reading the whole post. That's never a good idea. After reading to the end, I rather like your suggestion. It works well in your example, , nicely avoids the C/C++ trap, and has some consistency with other parts of Python. Gary Herron I liked the look of this as well. It ought to go to python ideas, or has it been suggested there in the past? Yes, and rejected (I am quite sure). Consistency would 'demand' at least while expr as target and possibly for i in iterable_expr as target. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Debugging on the Mac question.
Team, I am a Vision Impaired programmer on the Mac and Window platforms. I have started to learn Python. The biggest road block I have is the ability of debugging my simple scripts. The IDLE program does not work with the screen readers I use on the Mac or Windows. A screen reader is a program that grabs the text on the screen and converts it into speech output, at least this is the 5 feet explanation. I cannot see the screen at all. I have looked at eclipse and it doesn't work with Voice-Over (the screen reader on the Mac). I have java issues on my windows machine preventing me running this app. If I use $python -d script.py the debugger doesn't seem to trigger on the mac. So how I can perform a debug on a script so I can step through it, set up break points, watch variables, etc. It is really annoying me, since under Perl I just added the -d switch and had a full debugger that worked at the console level. Sean -- https://mail.python.org/mailman/listinfo/python-list
Re: Blog about python 3
On 1/2/2014 11:49 PM, Steven D'Aprano wrote: Robin Becker wrote: For fairly sensible reasons we changed the internal default to use unicode rather than bytes. After doing all that and making the tests compatible etc etc I have a version which runs in both and passes all its tests. However, for whatever reason the python 3.3 version runs slower For whatever reason is right, unfortunately there's no real way to tell from the limited information you give what that might be. Are you comparing a 2.7 wide or narrow build? Do your tests use any so-called astral characters (characters in the Supplementary Multilingual Planes, i.e. characters with ord() 0x)? If I remember correctly, some early alpha(?) versions of Python 3.3 consistently ran Unicode operations a small but measurable amount slower than 3.2 or 2.7. That especially effected Windows. But I understand that this was sped up in the release version of 3.3. There was more speedup in 3.3.2 and possibly even more in 3.3.3, so OP should run the latter. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Debugging on the Mac question.
Sean Murphy mhysnm1...@gmail.com writes: I am a Vision Impaired programmer on the Mac and Window platforms. I have started to learn Python. The biggest road block I have is the ability of debugging my simple scripts. The IDLE program does not work with the screen readers I use on the Mac or Windows. A screen reader is a program that grabs the text on the screen and converts it into speech output, at least this is the 5 feet explanation. I cannot see the screen at all. I have looked at eclipse and it doesn't work with Voice-Over (the screen reader on the Mac). I have java issues on my windows machine preventing me running this app. If I use $python -d script.py the debugger doesn't seem to trigger on the mac. So how I can perform a debug on a script so I can step through it, set up break points, watch variables, etc. It is really annoying me, since under Perl I just added the -d switch and had a full debugger that worked at the console level. For command line debugging see http://docs.python.org/3/library/pdb.html. More generally you might want to investigate http://emacspeak.sourceforge.net/ (disclaimer - I have never used this, but from what you say you might find it useful). -- https://mail.python.org/mailman/listinfo/python-list
Is Python really Lisp without parentheses? So would it be easy to *implement* a lot of Python in Scheme/Lisp?
I've heard it said, by no less a guru than Peter Norvig, that Python is a lot like Lisp without the parentheses at least for the basics of Python. For pedagogical reasons, I'm wondering if it would be easy to implement a big subset of Python in Scheme. The basics of Scheme or Lisp are amazingly easy to implement. Would implementing a subset of Python in a Scheme subset be a clever way to easily implement a lot of Python? (This isn't for practical reasonsI'm just curious.) Chris -- https://mail.python.org/mailman/listinfo/python-list
Re: Is Python really Lisp without parentheses? So would it be easy to *implement* a lot of Python in Scheme/Lisp?
On Fri, Jan 3, 2014 at 12:16 PM, Chris Seberino cseber...@gmail.com wrote: I've heard it said, by no less a guru than Peter Norvig, that Python is a lot like Lisp without the parentheses at least for the basics of Python. For pedagogical reasons, I'm wondering if it would be easy to implement a big subset of Python in Scheme. The basics of Scheme or Lisp are amazingly easy to implement. Because parsing and unparsing (aka printing) are so trivial for s-expressions Would implementing a subset of Python in a Scheme subset be a clever way to easily implement a lot of Python? At the innards of lisp and python are garbage collected data structures. Building one with the other gets you that for free [Doing it in a lower level language like C is what invokes the humorous: Greenspuns tenth law] So yes in that one respect what you say is true. But then theres also (apart from parsing) all kinds of semantic differences eg: - exceptions - modules - OOP milarky - C interfacing in Baskin Robbins number of flavours - carefully crafted portable veneer on top of intrinsically non portable OSes All these have to be handled one way or other (This isn't for practical reasonsI'm just curious.) A crucial difference between python and lisp is that python is practical and lisp is utopian -- https://mail.python.org/mailman/listinfo/python-list
Re: Blog about python 3
It's time to understand the Character Encoding Models and the math behind it. Unicode does not differ from any other coding scheme. How? With a sheet of paper and a pencil. jmf -- https://mail.python.org/mailman/listinfo/python-list
Re: Blog about python 3
On Fri, Jan 3, 2014 at 9:10 PM, wxjmfa...@gmail.com wrote: It's time to understand the Character Encoding Models and the math behind it. Unicode does not differ from any other coding scheme. How? With a sheet of paper and a pencil. One plus one is two, therefore Python is better than Haskell. Four times five is twelve, and four times six is thirteen, and four times seven is enough to make Alice think she's Mabel, and London is the capital of Paris, and the crocodile cheerfully grins. Therefore, by obvious analogy, Unicode times new-style classes equals a 64-bit process. I worked that out with a sheet of paper and a pencil. The pencil was a little help, but the paper was three sheets in the wind. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Blog about python 3
On 02/01/2014 18:25, David Hutto wrote: Just because it's 3.3 doesn't matter...the main interest is in compatibility. Secondly, you used just one piece of code, which could be a fluke, try others, and check the PEP. You need to realize that evebn the older versions are benig worked on, and they have to be refined. So if you have a problem, use the older and import from the future would be my suggestion Suggesting that I use another piece of code to test python3 against python2 is a bit silly. I'm sure I can find stuff which runs faster under python3, but reportlab is the code I'm porting and that is going the wrong way. -- Robin Becker -- https://mail.python.org/mailman/listinfo/python-list
Re: On a scrollbar for tkinter
2014/1/3 eneskri...@gmail.com: @Rick I found some solutions for python 2.x, but still, as I am with the future, I need a futuristic solution or 2, so if anyone else could help me, I'd be grateful! -- Hi, I usually don't use tkinter myself, hence others may have more idiomatic suggestions, but you can of course use ScrolledWindow tix with python3; cf.: from tkinter import tix root = tix.Tk() root.title(scrolled window) root.geometry(50x500+50+50) sw= tix.ScrolledWindow(root) sw.pack(fill=tix.BOTH, expand=1) for i in range(1,101): cb = tix.Checkbutton(sw.window, text=str(i)) cb.pack(fill=tix.BOTH, expand=0) root.mainloop() hth, vbr -- https://mail.python.org/mailman/listinfo/python-list
Re: Blog about python 3
On 02/01/2014 18:37, Terry Reedy wrote: On 1/2/2014 12:36 PM, Robin Becker wrote: I just spent a large amount of effort porting reportlab to a version which works with both python2.7 and python3.3. I have a large number of functions etc which handle the conversions that differ between the two pythons. I am imagine that this was not fun. indeed :) For fairly sensible reasons we changed the internal default to use unicode rather than bytes. Do you mean 'from __future__ import unicode_literals'? No, previously we had default of utf8 encoded strings in the lower levels of the code and we accepted either unicode or utf8 string literals as inputs to text functions. As part of the port process we made the decision to change from default utf8 str (bytes) to default unicode. Am I correct in thinking that this change increases the capabilities of reportlab? For instance, easily producing an article with abstracts in English, Arabic, Russian, and Chinese? It's made no real difference to what we are able to produce or accept since utf8 or unicode can encode anything in the input and what can be produced depends on fonts mainly. After doing all that and making the tests ... I know some of these tests are fairly variable, but even for simple things like paragraph parsing 3.3 seems to be slower. Since both use unicode internally it can't be that can it, or is python 2.7's unicode faster? The new unicode implementation in 3.3 is faster for some operations and slower for others. It is definitely more space efficient, especially compared to a wide build system. It is definitely less buggy, especially compared to a narrow build system. Do your tests use any astral (non-BMP) chars? If so, do they pass on narrow 2.7 builds (like on Windows)? I'm not sure if we have any non-bmp characters in the tests. Simple CJK etc etc for the most part. I'm fairly certain we don't have any ability to handle composed glyphs (multi-codepoint) etc etc For one thing, indexing and slicing just works on all machines for all unicode strings. Code for 2.7 and 3.3 either a) does not index or slice, b) does not work for all text on 2.7 narrow builds, or c) has extra conditional code only for 2.7. probably -- Robin Becker -- https://mail.python.org/mailman/listinfo/python-list
Re: Blog about python 3
On 02/01/2014 23:57, Antoine Pitrou wrote: .. Running a test suite is a completely broken benchmarking methodology. You should isolate workloads you are interested in and write a benchmark simulating them. I'm certain you're right, but individual bits of code like generating our reference manual also appear to be slower in 3.3. Regards Antoine. -- Robin Becker -- https://mail.python.org/mailman/listinfo/python-list
WebSocket for Python 2 and 3 on Twisted and asyncio
Hi, Autobahn provides open-source implementations of * The WebSocket Protocol * The Web Application Messaging Protocol (WAMP) https://github.com/tavendo/AutobahnPython https://pypi.python.org/pypi/autobahn Starting with the release 0.7.0, Autobahn now fully supports (with all features) both * Twisted (on Python 2/3) and * asyncio (on Python 3.3+) as the underlying networking framework. Here is a complete example of WebSocket server and client: Twisted: https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/echo Asyncio: https://github.com/tavendo/AutobahnPython/tree/master/examples/asyncio/websocket/echo The application code is very similar or even identical. Cheers, /Tobias -- https://mail.python.org/mailman/listinfo/python-list
pip's wheel support requires setuptools = 0.8 for dist-info support
I have a Jenkins server running Ubuntu which has been running perfectly fine for as long as I've been using it, and in one of the jobs, it runs a few things under the shiningpanda plugin (a python virtual environment wrapper). At some point today, or over the weekend, the job that uses it started failing, with the main error seemingly being the title, full error reported is pip install Jinja2 Wheel installs require setuptools = 0.8 for dist-info support. pip's wheel support requires setuptools = 0.8 for dist-info support. I've googled for this error, or anything like it, but I haven't been able to find anything useful towards solving it. -- https://mail.python.org/mailman/listinfo/python-list
Re: Blog about python 3
On 03/01/2014 09:01, Terry Reedy wrote: There was more speedup in 3.3.2 and possibly even more in 3.3.3, so OP should run the latter. python 3.3.3 is what I use on windows. As for astral / non-bmp etc etc that's almost irrelevant for the sort of tests we're doing which are mostly simple english text. -- Robin Becker -- https://mail.python.org/mailman/listinfo/python-list
Re: Debugging on the Mac question.
On 2014-01-03 04:17, Sean Murphy wrote: Team, I am a Vision Impaired programmer on the Mac and Window platforms. I have started to learn Python. The biggest road block I have is the ability of debugging my simple scripts. The IDLE program does not work with the screen readers I use on the Mac or Windows. A screen reader is a program that grabs the text on the screen and converts it into speech output, at least this is the 5 feet explanation. I cannot see the screen at all. I have looked at eclipse and it doesn't work with Voice-Over (the screen reader on the Mac). I have java issues on my windows machine preventing me running this app. If I use $python -d script.py the debugger doesn't seem to trigger on the mac. So how I can perform a debug on a script so I can step through it, set up break points, watch variables, etc. It is really annoying me, since under Perl I just added the -d switch and had a full debugger that worked at the console level. Python also has a console debugger. -d does not invoke it; -d is for something else. $ python -m pdb myscript.py http://docs.python.org/3.3/library/pdb -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- https://mail.python.org/mailman/listinfo/python-list
Re: Blog about python 3
In article mailman.4850.1388752146.18130.python-l...@python.org, Robin Becker ro...@reportlab.com wrote: On 03/01/2014 09:01, Terry Reedy wrote: There was more speedup in 3.3.2 and possibly even more in 3.3.3, so OP should run the latter. python 3.3.3 is what I use on windows. As for astral / non-bmp etc etc that's almost irrelevant for the sort of tests we're doing which are mostly simple english text. The sad part is, if you're accepting any text from external sources, you need to be able to deal with astral. I was doing a project a while ago importing 20-something million records into a MySQL database. Little did I know that FOUR of those records contained astral characters (which MySQL, at least the version I was using, couldn't handle). My way of dealing with those records was to nuke them. Longer term we ended up switching to Postgress. -- https://mail.python.org/mailman/listinfo/python-list
Creating a list with holes
I think I know the answer is no, but is there any package that allows creating a list with holes in it? E.g. I'd want to do something like: x[10] = 12 x[20] = 30 I'm thinking of something like defaultdict but for lists (I know that's very different, but ... ) Thanks! -larry -- https://mail.python.org/mailman/listinfo/python-list
Re: Creating a list with holes
On Friday, January 3, 2014 4:19:09 PM UTC+1, larry@gmail.com wrote: I think I know the answer is no, but is there any package that allows creating a list with holes in it? E.g. I'd want to do something like: x[10] = 12 x[20] = 30 I'm thinking of something like defaultdict but for lists (I know that's very different, but ... ) Thanks! -larry Hello Larry! The thing is, where to put the holes? A costum function can be made if you want the hole to be placed for example: 1. In random 2. Every nth hole(Or with another sequence) 3. In the beginning or end. Please tell me how do you want them, and I will try my best to help! - Enes -- https://mail.python.org/mailman/listinfo/python-list
Re: Creating a list with holes
On Sat, Jan 4, 2014 at 2:19 AM, Larry Martell larry.mart...@gmail.com wrote: I think I know the answer is no, but is there any package that allows creating a list with holes in it? E.g. I'd want to do something like: x[10] = 12 x[20] = 30 I'm thinking of something like defaultdict but for lists (I know that's very different, but ... ) Depending on what exactly you need, it's probably worth just using a dict. In what ways do you need it to function as a list? You can always iterate over sorted(some_dict.keys()) if you need to run through them in order. Alternatively, if you expect to fill in most of the elements, it's possible you'd be happier working with a subclass of list that auto-expands by filling in the spare space with a singleton meaning no element here. The code probably exists somewhere, but if not, it wouldn't be hard to write. Then it'd be a list, but you can start with it empty and assign as you describe above. What's the use case? I expect that one or the other of those options would cover most cases, but maybe yours is different. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Creating a list with holes
In article mailman.4852.1388762356.18130.python-l...@python.org, Larry Martell larry.mart...@gmail.com wrote: I think I know the answer is no, but is there any package that allows creating a list with holes in it? E.g. I'd want to do something like: x[10] = 12 x[20] = 30 Whenever you ask, What data structure do I want, you need to be able to answer, What operations do I want to perform?, and, What constraints do I have on memory use? Why do you want holes? Is the issue that you're storing sparse data and don't want to waste memory on unused keys? If so, a dictionary should do you fine. Do you need to be able to read the values back out in a specific order? You can still do that with a dictionary if you're willing to re-sort the keys; that's O(n log n) on the number of keys, but if n is small, it doesn't matter. -- https://mail.python.org/mailman/listinfo/python-list
Re: need to print seconds from the epoch including the millisecond
On Sat, Jan 4, 2014 at 2:33 AM, Grant Edwards invalid@invalid.invalid wrote: time.time() returns a Python float. A Python float will have 16 digits of precision. Perhaps the OS always sets some of those digits to 0 (or even random values), but they're still there. Perhaps the accuracy or granularity of the values returned is problematic on some OSes, but the precision of the value doesn't change: there's no way he's only getting 2 decimal places from time.time() unless (as you mention below) he's printing them using a method that truncates/rounds. If I print out the value float(1.01), I get just three digits. When those trailing digits are all zeroes, they won't be displayed. That's exactly what the OP was seeing. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Creating a list with holes
On Fri, Jan 3, 2014 at 10:30 AM, eneskri...@gmail.com wrote: On Friday, January 3, 2014 4:19:09 PM UTC+1, larry@gmail.com wrote: I think I know the answer is no, but is there any package that allows creating a list with holes in it? E.g. I'd want to do something like: x[10] = 12 x[20] = 30 I'm thinking of something like defaultdict but for lists (I know that's very different, but ... ) Hello Larry! The thing is, where to put the holes? A costum function can be made if you want the hole to be placed for example: 1. In random 2. Every nth hole(Or with another sequence) 3. In the beginning or end. Please tell me how do you want them, and I will try my best to help! The holes would be between the items I put in. In my example above, if I assigned to [10] and [20], then the other items ([0..9] and [11..19]) would have None. -- https://mail.python.org/mailman/listinfo/python-list
Re: need to print seconds from the epoch including the millisecond
On 2014-01-03, Dave Angel da...@davea.name wrote: On Thu, 2 Jan 2014 16:23:22 + (UTC), Grant Edwards invalid@invalid.invalid wrote: AFAIK, that's irrelevent. time.time() returns a float. On all the CPython implementations I know of, that is a 64-bit IEEE format, which provides 16 decimal digits of precision regardless of the granularity of the system time value. At this point in time, that means 10 digits left of the decimal point and 6 to the right. Correction: no more than about 6 to the right. You can certainly get less, from an os with a smaller resolution. time.time() returns a Python float. A Python float will have 16 digits of precision. Perhaps the OS always sets some of those digits to 0 (or even random values), but they're still there. Perhaps the accuracy or granularity of the values returned is problematic on some OSes, but the precision of the value doesn't change: there's no way he's only getting 2 decimal places from time.time() unless (as you mention below) he's printing them using a method that truncates/rounds. Or you can lose some of what you do get by printing in a sub-optimal way. Yes, depending on how you print the value, you can hide some of the digits. But, there's no way for time.time() to return a value with less than ~16 decimal digits of precicsion. -- Grant Edwards grant.b.edwardsYow! ! Everybody out of at the GENETIC POOL! gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Creating a list with holes
On Sat, Jan 4, 2014 at 2:38 AM, Roy Smith r...@panix.com wrote: Why do you want holes? Is the issue that you're storing sparse data and don't want to waste memory on unused keys? If so, a dictionary should do you fine. Do you need to be able to read the values back out in a specific order? You can still do that with a dictionary if you're willing to re-sort the keys; that's O(n log n) on the number of keys, but if n is small, it doesn't matter. There's another factor, which is iteration time. Maybe you don't care about the memory usage, but compare these: foo = [None]*1000 foo[123] = 234 foo[543] = 432 for key,value in enumerate(foo): if value: print(Slot %d is %d%(key,value)) # versus foo = {} foo[123] = 234 foo[543] = 432 for key in sorted(foo.keys()): value = foo[key] if value: print(Slot %d is %d%(key,value)) Which one's going to be faster? The dictionary, by far, in this example. I'm not sure how populated the list would have to be to beat it (as the dict will get slower on O(n log n) on keys, as you mention, while the list will run at O(n) on the highest element, which may well be a constant), but it's something to consider. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Blog about python 3
On Sat, Jan 4, 2014 at 1:57 AM, Roy Smith r...@panix.com wrote: I was doing a project a while ago importing 20-something million records into a MySQL database. Little did I know that FOUR of those records contained astral characters (which MySQL, at least the version I was using, couldn't handle). My way of dealing with those records was to nuke them. Longer term we ended up switching to Postgress. Look! Postgres means you don't lose data!! Seriously though, that's a much better long-term solution than destroying data. But MySQL does support the full Unicode range - just not in its UTF8 type. You have to specify UTF8MB4 - that is, maximum bytes 4 rather than the default of 3. According to [1], the UTF8MB4 encoding is stored as UTF-16, and UTF8 is stored as UCS-2. And according to [2], it's even possible to explicitly choose the mindblowing behaviour of UCS-2 for a data type that calls itself UTF8, so that a vague theoretical subsequent version of MySQL might be able to make UTF8 mean UTF-8, and people can choose to use the other alias. To my mind, this is a bug with backward-compatibility concerns. That means it can't be fixed in a point release. Fine. But the behaviour change is this used to throw an error, now it works. Surely that can be fixed in the next release. Or surely a version or two of deprecating UTF8 in favour of the two MB? types (and never ever returning UTF8 from any query), followed by a reintroduction of UTF8 as an alias for MB4, and the deprecation of MB3. Or am I spoiled by the quality of Python (and other) version numbering, where I can (largely) depend on functionality not changing in point releases? ChrisA [1] http://dev.mysql.com/doc/refman/5.7/en/charset-unicode-utf8mb4.html [2] http://dev.mysql.com/doc/refman/5.7/en/charset-unicode-utf8mb3.html -- https://mail.python.org/mailman/listinfo/python-list
Re: Creating a list with holes
On Fri, Jan 3, 2014 at 10:37 AM, Chris Angelico ros...@gmail.com wrote: On Sat, Jan 4, 2014 at 2:19 AM, Larry Martell larry.mart...@gmail.com wrote: I think I know the answer is no, but is there any package that allows creating a list with holes in it? E.g. I'd want to do something like: x[10] = 12 x[20] = 30 I'm thinking of something like defaultdict but for lists (I know that's very different, but ... ) Depending on what exactly you need, it's probably worth just using a dict. In what ways do you need it to function as a list? You can always iterate over sorted(some_dict.keys()) if you need to run through them in order. Alternatively, if you expect to fill in most of the elements, it's possible you'd be happier working with a subclass of list that auto-expands by filling in the spare space with a singleton meaning no element here. The code probably exists somewhere, but if not, it wouldn't be hard to write. Then it'd be a list, but you can start with it empty and assign as you describe above. What's the use case? I expect that one or the other of those options would cover most cases, but maybe yours is different. Yeah, googled and didn't find anything, then started writing it myself last night, then this morning decided to ask if it already existed. The use case is that I'm parsing a XML file like this: Parameter Name=DefaultVersion Values Value DefaultTrue/Default /Value /Values Values Value CurrentFalse/Current /Value /Values Values Value DefaultTrue/Default CurrentFalse/Current /Value /Values Values DefaultTrue/Default /Values This is an existing program that is putting the data into a dict. The dict keys are ['DefaultVersion','Default'] and ['DefaultVersion','Current']. These contain lists that have the True/False values. It's currently not correctly handling the missing items so it ends up with: ['DefaultVersion','Default'][0] = True ['DefaultVersion','Default'][1] = True ['DefaultVersion','Current'][0] = False When it should be: ['DefaultVersion','Default'][0] = True ['DefaultVersion','Default'][1] = None ['DefaultVersion','Current'][0] = None And so on. This dict/list is then processed by other existing code, so I don't want to have to rewrite a ton of code - I just want to fix the list so the items end up in their correct slots. -- https://mail.python.org/mailman/listinfo/python-list
Re: Ifs and assignments
Chris Angelico ros...@gmail.com wrote: Maybe a for loop isn't the best other example, but I frequently work with places where I want to call some function and keep iterating with the result of that until it returns false: while (var = func()) { } In Python, that gets a lot clunkier. The most popular way is to turn it into an infinite loop: while True: var = func() if not var: break My preferred way would be to write it as a `for` loop: for var in iter(func, False): ... Though you do have to be sure to get the sentinel value correct as it will only break for the expected terminal False, not for 0, , or None. -- Duncan Booth -- https://mail.python.org/mailman/listinfo/python-list
Re: Creating a list with holes
On Sat, Jan 4, 2014 at 2:51 AM, Roy Smith r...@panix.com wrote: In article mailman.4853.1388763434.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: Alternatively, if you expect to fill in most of the elements, it's possible you'd be happier working with a subclass of list that auto-expands by filling in the spare space with a singleton meaning no element here. And, if you know ahead of time the maximum number of elements you will ever have: x = [None] * max_count will preallocate them all with a minimum of fuss. Yes, as I use in the trivial example in the subsequent post. But as a general solution this is usually insufficient. (Whether or not None is valid as a sentinel is, of course, quite orthogonal to the discussion. I avoided assuming that it was, the OP's now shown that it does seem to be.) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Creating a list with holes
In article mailman.4853.1388763434.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: Alternatively, if you expect to fill in most of the elements, it's possible you'd be happier working with a subclass of list that auto-expands by filling in the spare space with a singleton meaning no element here. And, if you know ahead of time the maximum number of elements you will ever have: x = [None] * max_count will preallocate them all with a minimum of fuss. -- https://mail.python.org/mailman/listinfo/python-list
Re: Creating a list with holes
On Sat, Jan 4, 2014 at 2:55 AM, Larry Martell larry.mart...@gmail.com wrote: The use case is that I'm parsing a XML file like this: Parameter Name=DefaultVersion Values Value DefaultTrue/Default /Value /Values Values Value CurrentFalse/Current /Value /Values Values Value DefaultTrue/Default CurrentFalse/Current /Value /Values Values DefaultTrue/Default /Values This is an existing program that is putting the data into a dict. The dict keys are ['DefaultVersion','Default'] and ['DefaultVersion','Current']. These contain lists that have the True/False values. Are you assigning keys by value, or are you simply appending to the lists? It looks to me like you could simply append another element to both lists for each Value /Value unit, with the given Default and Current if available, or with None for any that aren't set. Alternatively, when you get up to the Value, append None to each list, and then when you see a value, assign to [-1] and overwrite the None. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Is Python really Lisp without parentheses? So would it be easy to *implement* a lot of Python in Scheme/Lisp?
Exceptions, modules, OOP, etc. would be tricky to implement in Scheme but at least the basics like for loops, while loops, assignment etc. would seem doable and very instructive for students.they would thereafter, for all time, have a mental image of what the Python interpreter is doing. But then theres also (apart from parsing) all kinds of semantic differences eg: - exceptions - modules - OOP milarky - C interfacing in Baskin Robbins number of flavours - carefully crafted portable veneer on top of intrinsically non portable OSes -- https://mail.python.org/mailman/listinfo/python-list
Re: Is Python really Lisp without parentheses? So would it be easy to *implement* a lot of Python in Scheme/Lisp?
On Thu, Jan 2, 2014 at 10:46 PM, Chris Seberino cseber...@gmail.com wrote: I've heard it said, by no less a guru than Peter Norvig, that Python is a lot like Lisp without the parentheses at least for the basics of Python. There are plenty of non-superficial differences. Python has lexical scope, lisps usually have dynamic scope. Python has statements and expressions, lisps have expressions and maybe only a few tiny extra restrictions. Python has dynamic dispatch everywhere, lisps have it usually almost nowhere. And the unifying thing that makes a lisp a lisp is macros, which Python lacks. For pedagogical reasons, I'm wondering if it would be easy to implement a big subset of Python in Scheme. A lecturer of mine back in university did this (implemented a subset of Python in Racket). My understanding is that this is primarily interesting to show that Racket is not as crazily different as it looks from the syntax. When I TA'd for him, he had a really neat lecture where he gave the following three snippets of code: // C++ Foo x = y; x.bar = 3; // Java Foo x = y; x.bar = 3; // Scheme (define x y) (foo-bar x 3) The syntax of the first two is identical, so the uneducated would assume they do the same thing. But actually, the latter two are the ones with the identical behaviour. It is definitely true that the syntax differences hide how similar Scheme and Python are. These two languages are close enough together that any The basics of Scheme or Lisp are amazingly easy to implement. Would implementing a subset of Python in a Scheme subset be a clever way to easily implement a lot of Python? If it's easy to implement in terms of Scheme, which is itself easy to implement, then it would be easy to implement directly, so this doesn't seem like a useful question to ask. Anyway, most of the useful bits of Python aren't present or have different semantics than how they work in lisps. -- Devin -- https://mail.python.org/mailman/listinfo/python-list
Re: Blog about python 3
On 01/03/2014 02:24 AM, Chris Angelico wrote: I worked that out with a sheet of paper and a pencil. The pencil was a little help, but the paper was three sheets in the wind. Beautiful! -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list
Re: Is Python really Lisp without parentheses? So would it be easy to *implement* a lot of Python in Scheme/Lisp?
On Friday, January 3, 2014 11:10:07 AM UTC-6, Devin Jeanpierre wrote: A lecturer of mine back in university did this (implemented a subset of Python in Racket). My understanding is that this is primarily interesting to show that Racket is not as crazily different as it looks from the syntax. Is that on the web anywhere? That would be very interesting to look at. I'm sure others would find it useful too. -- https://mail.python.org/mailman/listinfo/python-list
Re: Is Python really Lisp without parentheses? So would it be easy to *implement* a lot of Python in Scheme/Lisp?
In article mailman.4862.1388769050.18130.python-l...@python.org, Devin Jeanpierre jeanpierr...@gmail.com wrote: // C++ Foo x = y; x.bar = 3; // Java Foo x = y; x.bar = 3; // Scheme (define x y) (foo-bar x 3) The syntax of the first two is identical, so the uneducated would assume they do the same thing. This is one of the things that tripped me up when I first tried to learn JavaScript. They syntax is superficially identical to C++, so I assumed it worked the same way. Bad assumption. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 2.x and 3.x usage survey
On 01/02/2014 08:55 AM, Grant Edwards wrote: On 2013-12-31, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: You laugh, but there was at least one attendee at the last PyCon who was still using 1.5 professionally. Software never quite dies so long as there is hardware capable of running it. ITYM: ... so long as there is hardware capable of running an emulator that is capable of running it. ...or as long as there's business value in keeping it running. As I recall it took the banking industry decades to move things forward. I still maintain software for customers that I originally wrote 35 years ago. Rule one is don't fix it if it ain't broke, so yes, I've got python projects deployed that run under everything from 1.5.2 on. Fortunately, they all work without issue so maintenance isn't a problem. Emile -- https://mail.python.org/mailman/listinfo/python-list
Re: Is Python really Lisp without parentheses? So would it be easy to *implement* a lot of Python in Scheme/Lisp?
On Fri, Jan 3, 2014 at 10:20 PM, Chris Seberino cseber...@gmail.com wrote: Exceptions, modules, OOP, etc. would be tricky to implement in Scheme but at least the basics like for loops, while loops, assignment etc. would seem doable and very instructive for students.they would thereafter, for all time, have a mental image of what the Python interpreter is doing. If thats the intent, sure, scheme is heaven for such In particular, take a language, break it up into a dozen or so 'little-languages' eg one for types, one for control structures, one for scoping/parameter passing etc while 'stubbing out' the rest -- for such scheme is simply unbeatable. And this includes IDEAS of oop modules etc. Its only when you then start demanding: Why cant this become realistic? that things start creaking and groaning at the edges A simple example: One of the much touted features of modern functional languages like Haskell (actually its the SML family) is pattern matching. I implemented a macro -- destruct -- to do it in scheme -- all of 91 lines! Now one gets greedy and says: Hey! Neat! Only small catch is that haskell patterns looks so much neater than these home-cooked Lots-of-Irritating-Single-Parenthesis (aka Lisp-y) patterns. And Wham! The shit begins to hit the ceiling To my mind, scheme is so powerful that even Abelson and Sussman dont get how powerful. I wrote a blog post on that but then diluted the title :D http://blog.languager.org/2013/08/applying-si-on-sicp.html On the whole though, functional languages are distinctly weaker than lisps but much easier for students. Heres an old Wadler paper explaining that: http://www.cs.kent.ac.uk/people/staff/dat/miranda/wadler87.pdf -- https://mail.python.org/mailman/listinfo/python-list
Re: Creating a list with holes
On Fri, 03 Jan 2014 10:41:21 -0500, Larry Martell wrote: The holes would be between the items I put in. In my example above, if I assigned to [10] and [20], then the other items ([0..9] and [11..19]) would have None. dic = { 10:6, 20:11} dic.get(10) 6 dic.get(14) dic.get(27,oh god there's nothing here) oh god there's nothing here dic.get(99,None) dic.get(168,False) False dic.get(20,Boo Yah) 11 So a standard dictionary does this returning None (or any other default value you care to pass it) as long as you use the dict.get(key[,default]) method rather than dict[key] to return the value. See also: http://stackoverflow.com/questions/6130768/return-none-if-dictionary-key- is-not-available -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Is Python really Lisp without parentheses? So would it be easy to *implement* a lot of Python in Scheme/Lisp?
On Fri, Jan 3, 2014 at 9:26 AM, Chris Seberino cseber...@gmail.com wrote: On Friday, January 3, 2014 11:10:07 AM UTC-6, Devin Jeanpierre wrote: A lecturer of mine back in university did this (implemented a subset of Python in Racket). My understanding is that this is primarily interesting to show that Racket is not as crazily different as it looks from the syntax. Is that on the web anywhere? That would be very interesting to look at. I'm sure others would find it useful too. As far as I know, no. There was an early version of it that was part of a course, but as I understand it he did something much more thorough later on. Even that course content seems to be offline and not very available by archive.org; the relevant bits aren't archived: https://web.archive.org/web/2019221012/http://www.cs.toronto.edu/~gfb/csc324/2010F/content.shtml Feel free to dig around and try to find something, but as I recall the assignment on that page was to write some very minor interpreter actions with a list generated from the AST of a python source file. His later work was translating Python to Racket, with macros to implement various Python operations. That wasn't an assignment or course content, it was stuff he'd show to students during office hours and such. I believe the end goal was to turn it into a real tool for teaching programming. The idea there was that Python is 90% irrelevant to teaching students how to program, and the full generality of Python makes it harder for students to learn due to weird behaviours or unreasonable complexity. If you decide to only implement the 10% of Python that you care to teach, then it's much easier to implement (in fact, without that, the goal isn't even achievable for one person), plus it serves your goals potentially better than Python does. Regardless of if it's a particularly good idea, this is what Python must look like if you try to elegantly directly translate it to Scheme (or any lisp), just because the semantics will be so different once you get out of the basics and the trivial things. If the translation is to be clean, the input language can't actually be Python. If the input language is Python, the output will be a horrible mess that isn't useful for the student, and also it will take a lot of work until it is even correct. Scheme is far simpler and smaller than Python is. -- Devin -- https://mail.python.org/mailman/listinfo/python-list
The Economic System of Islam
The Economic System of Islam 1-An introduction to the principles Islam has legislated to guide the economic system of society. Part 1: The sources from which the laws that guide economical activity are derived. 2-The Ideological Basis of Economic Activity and the general principles by which they are guided Introduction As a complete way of life, Islam has provided guidelines and rules for every sphere of life and society. Naturally, a functioning economic system is vital for a healthy society, as the consumption of goods and services, and the facilitation of this by a common medium of exchange, play a major role in allowing people to realize their material and other goals in life. Islam has set some standards, based on justice and practicality, for such economic systems to be established. These standards aim to prevent the enmity that often occurs between different socioeconomic sections. Of course, it is true that the gathering of money concerns almost every human being who participates in transactions with others. Yet, while these standards recognize money as being among the most important elements in society, they do not lose sight of the fact that its position is secondary to the real purpose of human existence, which is the worship of God. An Islamic economic system is not necessarily concerned with the precise amount of financial income and expenditure, imports and exports, and other economic statistics. While such matters are no doubt important, Islam is more concerned with the spirit of the economic system. A society that implements Islamic laws and promotes Islamic manners will find that it bring together all the systems – social, economic, and so forth – that it deals with. Islam teaches that God has created provision for every person who He has brought to life. Therefore, the competition for natural resources that is presumed to exist among the nations of the world is an illusion. While the earth has sufficient bounty to satisfy the needs of mankind, the challenge for humans lies in discovering, extracting, processing, and distributing these resources to those who need them. Islam consists of a set of beliefs which organizes the relationship between the individual and his Creator; between the person and other human beings; between the person and universe; and even the relationship of the person to himself. In that sense, Islam regulates human behavior, and one type of human behavior is economic behavior. Economic behavior is dealt by Muslims as a means of production, distribution, and consumption of goods and services. In Islam, human behavior -whether in the economic area or others - is not value free; nor is it value neutral. It is connected with the ideological foundation of the faith. The Sources of Islamic Economics The fundamental sources of Islam - the Quran and the Sunnah of the Prophet[1] - provide guidelines for economic behavior and a blueprint of how the economic system of a society should be organized. Therefore, the values and objectives of all “Islamic” economic systems must necessarily conform to, and comply with, the principles derived from these fundamental sources. The purpose of these articles is to outline the most salient characteristics of an economic system based on the fundamental sources of Islam. The focus here is on the principal features of the Islamic system. The Islamic economic system is defined by a network of rules called the Shariah. The rules which are contained in the Shariah are both constitutive and regulative, meaning that they either lay the rules for the creation of economic entities and systems, as well the rules which regulate existing one. As an integral part of the revelation, the Shariah is the guide for human action which encompasses every aspect of life – spiritual, individual, social, political, cultural, and economic. It provides a scale by which all actions, whether on the part of the individual agents, society, and the state, are classified in regards to their legality. Thus there are five types of actions recognized, namely: obligatory; recommended; permissible; discouraged; and forbidden. This classification is also inclusive of economic behavior. The basic source of the Shariah in Islam is the Quran and the Sunnah, which include all the necessary rules of the Shariah as guidance for mankind. The Sunnah further explains these rules by the practical application of Prophet Muhammad, may the mercy and blessings of God be upon him. The expansion of the regulative rules of the Shariah and their extensions to new situations in later times was accomplished with the aid of consensus of the scholars, analogical reasoning - which derived rules by discerning an analogy between new problems and those existing in the primary sources - and finally, through textual reasoning of scholars specialized in the Shariah. These five sources - the Quran, the Sunnah, consensus
Re: About some problem
* Steven D'Aprano wrote: Mark Lawrence wrote: raise Not Valid DB Type is perfectly valid in Python 2. Actually, no it isn't. It's only valid up to Python 2.4. In Python 2.5, string exceptions display a warning but continue to work, and in Python 2.6 they generate a compile-time SyntaxError. Oh? Doesn't look like it. $ cat x.py try: raise foo except: print bar $ python2.7 x.py bar $ python2.6 x.py bar A lone '''raise foo''' raises a TypeError, though. nd -- sub the($){+shift} sub answer (){ord q [* It is always 42! *] } print the answer # André Malo # http://pub.perlig.de/ # -- https://mail.python.org/mailman/listinfo/python-list
Re: Is Python really Lisp without parentheses? So would it be easy to *implement* a lot of Python in Scheme/Lisp?
Chris Seberino wrote: The basics of Scheme or Lisp are amazingly easy to implement. Would implementing a subset of Python in a Scheme subset be a clever way to easily implement a lot of Python? I don't know how easy it was, but it was done: http://common-lisp.net/project/clpython/ -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Python 2.x vs 3.x survey
The results of the survey are at: https://wiki.python.org/moin/2.x-vs-3.x-survey -- https://mail.python.org/mailman/listinfo/python-list
Re: About some problem
André Malo wrote: * Steven D'Aprano wrote: Mark Lawrence wrote: raise Not Valid DB Type is perfectly valid in Python 2. Actually, no it isn't. It's only valid up to Python 2.4. In Python 2.5, string exceptions display a warning but continue to work, and in Python 2.6 they generate a compile-time SyntaxError. Oh? Doesn't look like it. Oh, it's a runtime TypeError, not SyntaxError. I learn something new everyday, thanks for the correction. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Debugging on the Mac question.
PETER, thanks Peter, I have already found the PDB module and have had a play with it. It will do for now. On 03/01/2014, at 8:08 PM, Paul Rudin paul.nos...@rudin.co.uk wrote: Sean Murphy mhysnm1...@gmail.com writes: I am a Vision Impaired programmer on the Mac and Window platforms. I have started to learn Python. The biggest road block I have is the ability of debugging my simple scripts. The IDLE program does not work with the screen readers I use on the Mac or Windows. A screen reader is a program that grabs the text on the screen and converts it into speech output, at least this is the 5 feet explanation. I cannot see the screen at all. I have looked at eclipse and it doesn't work with Voice-Over (the screen reader on the Mac). I have java issues on my windows machine preventing me running this app. If I use $python -d script.py the debugger doesn't seem to trigger on the mac. So how I can perform a debug on a script so I can step through it, set up break points, watch variables, etc. It is really annoying me, since under Perl I just added the -d switch and had a full debugger that worked at the console level. For command line debugging see http://docs.python.org/3/library/pdb.html. More generally you might want to investigate http://emacspeak.sourceforge.net/ (disclaimer - I have never used this, but from what you say you might find it useful). -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: About some problem
On 01/03/2014 12:55 PM, Steven D'Aprano wrote: André Malo wrote: * Steven D'Aprano wrote: Mark Lawrence wrote: raise Not Valid DB Type is perfectly valid in Python 2. Actually, no it isn't. It's only valid up to Python 2.4. In Python 2.5, string exceptions display a warning but continue to work, and in Python 2.6 they generate a compile-time SyntaxError. Oh? Doesn't look like it. Oh, it's a runtime TypeError, not SyntaxError. The main point being that in 2.6 and 2.7 string exceptions do /not/ work. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list
Re: Blog about python 3
On 1/3/2014 7:28 AM, Robin Becker wrote: On 03/01/2014 09:01, Terry Reedy wrote: There was more speedup in 3.3.2 and possibly even more in 3.3.3, so OP should run the latter. python 3.3.3 is what I use on windows. As for astral / non-bmp etc etc that's almost irrelevant for the sort of tests we're doing which are mostly simple english text. If you do not test the cases where 2.7 is buggy and requires nasty workarounds, then I can understand why you do not so much appreciate 3.3 ;-). -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
[newbie] Recursive algorithm - review
Hi, it's my first post on this newsgroup so welcome everyone. :) I'm still learning Python (v3.3), and today I had idea to design (my first) recursive function, that generates board to 'Towers' Puzzle: http://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/towers.html (so I could in future write algorithm to solve it ;-)) I'm pretty proud of myself - that it works, and that took me only 4 hours to debug. ;-) But on Project Euler site sometimes I'm also proud, that I solved some problem in 30-line script, and then on forum there's one lined solution... So maybe You might look at this script, and tell me if this can be more pythonic. It's nothing urgent. I can wait - it works after all. ;-) Idea is that function generate() 'finds' one number at a time (well, besides first row), then checks if there are no repetitions in column (because in row there cannot be by design - I pop out numbers from shuffled list [1, 2, 3, ..., size] for every row.) If no repetition - calls the same function to find next number, and so on. If there is repetition at some point - recursion jumps back, and try different number on previous position. import random def check(towers, x=None): if x: c = x % len(towers) # check only column with column = [] # value added on pos. x for i in range(len(towers)): column.append(towers[i][c]) column = [x for x in column if x != 0] # print(column) # debugging leftovers ;-) return len(column) == len(set(column)) else: for c in range(len(towers)): # 'x' not provided, column = [] # so check all columns for i in range(len(towers)): column.append(towers[i][c]) column = [x for x in column if x != 0] # print(column) if len(column) != len(set(column)): return False return True def generate(size=4, towers=None, row=None, x=0): if not towers: # executed only once. row = [a for a in range(1, size+1)]# Then I'll pass towers list random.shuffle(row)# at every recursion towers = [] # not so pretty way to generate for i in range(size): # matrix filled with 0's towers.append([]) # I tried: towers = [[0]*size]*size for j in range(size): # but this doesn't work. ;-) towers[i].append(0)# I don't know how to do this with # list comprehension (one inside row_ = row[:] # other?) towers[0] = row_# after adding first row, columns will be row = []# always unique, so I add entire row at once. x = size - 1# Then I will be adding only one num at time. # 'x' is pretty much position of last added el. if not row: row = [a for a in range(1, size+1)] random.shuffle(row) if x + 1 size**2: repeat = True attempt = 0 while repeat: # print(towers, row, x) x += 1 num = row.pop(0) # take num from right, and towers[x // size][x % size] = num # if doesn't match - put repeat = not check(towers, x) # back (append) on left - # - to rotate if repeat: # I'll repeat 'matching' next row.append(num) # number as long as last x -= 1 # changed column is unique attempt += 1 # after some attempts I give if attempt len(row) - 1: # up and jump back from return False # current recursion else: if not generate(size, towers, row, x): repeat = True row.append(num) # after some failed attempts x -= 1 # on this 'level' I give up attempt += 1 # again... if attempt len(row) - 1: return False# ...and jump back one # more time... return towers def main(): towers6by6 = generate(6) # print(check(towers6by6)) print(towers6by6) if __name__ == __main__: main() Footnote: English isn't my native language, so forgive me my bad grammar and/or vocabulary. :-) -- Best regrds, Wiktor Matuszewski 'py{}@wu{}em.pl'.format('wkm', 'ka') # spam trap -- https://mail.python.org/mailman/listinfo/python-list
Re: Creating a list with holes
On Fri, Jan 3, 2014 at 1:07 PM, Denis McMahon denismfmcma...@gmail.com wrote: On Fri, 03 Jan 2014 10:41:21 -0500, Larry Martell wrote: The holes would be between the items I put in. In my example above, if I assigned to [10] and [20], then the other items ([0..9] and [11..19]) would have None. dic = { 10:6, 20:11} dic.get(10) 6 dic.get(14) dic.get(27,oh god there's nothing here) oh god there's nothing here dic.get(99,None) dic.get(168,False) False dic.get(20,Boo Yah) 11 So a standard dictionary does this returning None (or any other default value you care to pass it) as long as you use the dict.get(key[,default]) method rather than dict[key] to return the value. See also: http://stackoverflow.com/questions/6130768/return-none-if-dictionary-key- is-not-available Thanks, but I know all that about dicts. I need to use a list for compatibility with existing code. -- https://mail.python.org/mailman/listinfo/python-list
Re: Creating a list with holes
On Fri, Jan 3, 2014 at 11:07 AM, Chris Angelico ros...@gmail.com wrote: On Sat, Jan 4, 2014 at 2:55 AM, Larry Martell larry.mart...@gmail.com wrote: The use case is that I'm parsing a XML file like this: Parameter Name=DefaultVersion Values Value DefaultTrue/Default /Value /Values Values Value CurrentFalse/Current /Value /Values Values Value DefaultTrue/Default CurrentFalse/Current /Value /Values Values DefaultTrue/Default /Values This is an existing program that is putting the data into a dict. The dict keys are ['DefaultVersion','Default'] and ['DefaultVersion','Current']. These contain lists that have the True/False values. Are you assigning keys by value, or are you simply appending to the lists? It looks to me like you could simply append another element to both lists for each Value /Value unit, with the given Default and Current if available, or with None for any that aren't set. Alternatively, when you get up to the Value, append None to each list, and then when you see a value, assign to [-1] and overwrite the None. Your last suggestion is what I ended up doing, but I had to key off the Values /Values unit - I couldn't use Value because that isn't present for ones that have no Current - that messed me up for hours. But it's working now. Thanks all! -- https://mail.python.org/mailman/listinfo/python-list
[newbie] Recursive algorithm - review
Hi, it's my first post on this newsgroup so welcome everyone. :) I'm still learning Python (v3.3), and today I had idea to design (my first) recursive function, that generates (filled out) board to 'Towers' Puzzle: http://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/towers.html (so I could in future write algorithm to solve it ;-)) I'm pretty proud of myself - that it works, and that took me only 4 hours to debug. ;-) But on Project Euler site sometimes I'm also proud, that I solved some problem in 30-line script, and then on forum there's one lined solution... So maybe You might look at this script, and tell me if this can be more pythonic. It's nothing urgent. I can wait - it works after all. ;-) Idea is that function generate() 'finds' one number at a time (well, besides first row), then checks if there are no repetitions in column (because in row there cannot be by design - I pop out numbers from shuffled list [1, 2, 3, ..., size] for every row.) If no repetition - calls the same function to find next number, and so on. If there is repetition at some point - recursion jumps back, and try different number on previous position. import random def check(towers, x=None): if x: c = x % len(towers) # check only column with column = [] # value added on pos. x for i in range(len(towers)): column.append(towers[i][c]) column = [x for x in column if x != 0] # print(column) # debugging leftovers ;-) return len(column) == len(set(column)) else: for c in range(len(towers)): # 'x' not provided, column = [] # so check all columns for i in range(len(towers)): column.append(towers[i][c]) column = [x for x in column if x != 0] # print(column) if len(column) != len(set(column)): return False return True def generate(size=4, towers=None, row=None, x=0): if not towers: # executed only once. row = [a for a in range(1, size+1)]# Then I'll pass towers list random.shuffle(row)# at every recursion towers = [] # not so pretty way to generate for i in range(size): # matrix filled with 0's towers.append([]) # I tried: towers = [[0]*size]*size for j in range(size): # but this doesn't work. ;-) towers[i].append(0)# I don't know how to do this with # list comprehension (one inside row_ = row[:] # other?) towers[0] = row_# after adding first row, columns will be row = []# always unique, so I add entire row at once. x = size - 1# Then I will be adding only one num at time. # 'x' is pretty much position of last added el. if not row: row = [a for a in range(1, size+1)] random.shuffle(row) if x + 1 size**2: repeat = True attempt = 0 while repeat: # print(towers, row, x) x += 1 num = row.pop(0) # take num from right, and towers[x // size][x % size] = num # if doesn't match - put repeat = not check(towers, x) # back (append) on left - # - to rotate if repeat: # I'll repeat 'matching' next row.append(num) # number as long as last x -= 1 # changed column is unique attempt += 1 # after some attempts I give if attempt len(row) - 1: # up and jump back from return False # current recursion else: if not generate(size, towers, row, x): repeat = True row.append(num) # after some failed attempts x -= 1 # on this 'level' I give up attempt += 1 # again... if attempt len(row) - 1: return False# ...and jump back one # more time... return towers def main(): towers6by6 = generate(6) # print(check(towers6by6)) print(towers6by6) if __name__ == __main__: main() Footnote: English isn't my native language, so forgive me my bad grammar and/or vocabulary. :-) -- Best regrds, Wiktor Matuszewski 'py{}@wu{}em.pl'.format('wkm', 'ka') # spam trap -- https://mail.python.org/mailman/listinfo/python-list
Re: Creating a list with holes
In article mailman.4871.1388794533.18130.python-l...@python.org, Larry Martell larry.mart...@gmail.com wrote: Thanks, but I know all that about dicts. I need to use a list for compatibility with existing code. Generalizing what I think the situation is, A dict is the best data structure for the parsing phase, but I need a list later to hand off to legacy interfaces. No problem. Parse the data using a dict, then convert the dict to a list later. I haven't been following all the details here, but just wanted to point out that using different data structures to hold the same data at different phases of a program is a perfectly reasonable approach. -- https://mail.python.org/mailman/listinfo/python-list
Re: Creating a list with holes
On Sat, Jan 4, 2014 at 11:18 AM, Larry Martell larry.mart...@gmail.com wrote: Your last suggestion is what I ended up doing, but I had to key off the Values /Values unit - I couldn't use Value because that isn't present for ones that have no Current - that messed me up for hours. But it's working now. Thanks all! Sure, you know your data better than I do after a quick glance. Sounds good! Such a classic problem. I have this data, I need that structure. How can I turn the one into the other? So many different answers. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: [newbie] Recursive algorithm - review
On 1/3/2014 7:16 PM, Wiktor wrote: Hi, it's my first post on this newsgroup so welcome everyone. :) I'm still learning Python (v3.3), and today I had idea to design (my first) recursive function, that generates (filled out) board to 'Towers' Puzzle: http://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/towers.html (so I could in future write algorithm to solve it ;-)) I'm pretty proud of myself - that it works, and that took me only 4 hours to debug. ;-) But on Project Euler site sometimes I'm also proud, that I solved some problem in 30-line script, and then on forum there's one lined solution... So maybe You might look at this script, and tell me if this can be more pythonic. It's nothing urgent. I can wait - it works after all. ;-) Idea is that function generate() 'finds' one number at a time (well, besides first row), then checks if there are no repetitions in column (because in row there cannot be by design - I pop out numbers from shuffled list [1, 2, 3, ..., size] for every row.) If no repetition - calls the same function to find next number, and so on. If there is repetition at some point - recursion jumps back, and try different number on previous position. import random def check(towers, x=None): if x: c = x % len(towers) # check only column with column = [] # value added on pos. x for i in range(len(towers)): column.append(towers[i][c]) column = [x for x in column if x != 0] # print(column) # debugging leftovers ;-) return len(column) == len(set(column)) else: for c in range(len(towers)): # 'x' not provided, column = [] # so check all columns for i in range(len(towers)): column.append(towers[i][c]) column = [x for x in column if x != 0] # print(column) if len(column) != len(set(column)): return False return True def generate(size=4, towers=None, row=None, x=0): if not towers: # executed only once. row = [a for a in range(1, size+1)]# Then I'll pass towers list random.shuffle(row)# at every recursion towers = [] # not so pretty way to generate for i in range(size): # matrix filled with 0's towers.append([]) # I tried: towers = [[0]*size]*size for j in range(size): # but this doesn't work. ;-) towers[i].append(0)# I don't know how to do this with # list comprehension (one inside [0]*size] is fine for one row towers = [[0]*size] for i in range(size)] should do what you want for a 2-d array instead of the above. I cannot look at the rest right now. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: [newbie] Recursive algorithm - review
On Sat, Jan 4, 2014 at 11:13 AM, Wiktor look@signature.invalid wrote: Hi, it's my first post on this newsgroup so welcome everyone. :) Hi! Welcome! I'm still learning Python (v3.3), and today I had idea to design (my first) recursive function, that generates board to 'Towers' Puzzle: http://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/towers.html (so I could in future write algorithm to solve it ;-)) Yep, that's the way to do things. When I wrote some code for a sort of binary sudoku system (they're a lot of fun, btw), I went through this sequence: 0) Figure out a data structure to hold a board state 1) Write code that will ascertain whether a given board state is valid 2) Write code that will deduce more information from a given board state 3) Write code that will completely solve a board 4) Write code that can solve an empty board, thus generating a puzzle. But on Project Euler site sometimes I'm also proud, that I solved some problem in 30-line script, and then on forum there's one lined solution... That's not a problem in itself. In fact, in many situations the 30-liner is better. But mainly, once you get a working-but-slightly-verbose script, it's fairly straight-forward to simplify it a little bit at a time. def check(towers, x=None): column = [] # value added on pos. x for i in range(len(towers)): column.append(towers[i][c]) column = [x for x in column if x != 0] Any time you iterate over range(len(something)), you probably want to iterate over the thing instead: for t in towers: column.append(t[c]) And any time you iterate over something and append to another list, you probably want a list comprehension: column = [t[c] for t in towers] And two comprehensions can usually be combined into one: column = [t[c] for t in towers if t[c] != 0] That has a little bit of redundancy in there (mentioning t[c] twice), but I think it's cleaner than having the separate pass. Finally, since you're working here with integers, you can drop the != 0 check and simply test the truthiness of t[c] itself: column = [t[c] for t in towers if t[c]] for c in range(len(towers)): # 'x' not provided, column = [] # so check all columns I wouldn't normally wrap a comment onto an unrelated line; I'd put the comment above the loop, since it's too long to be a part of the loop header itself. It goes as much with the else as with the loop, anyhow. This is one case where you probably _do_ want to iterate up to range(len(towers)), though, which is why I said probably above. :) for i in range(len(towers)): column.append(towers[i][c]) column = [x for x in column if x != 0] This is the same code you had above, so it can benefit from the same translation. But maybe it'd be even cleaner to simply call yourself? if not check(towers, i): return False # print(column) if len(column) != len(set(column)): return False return True And in fact, you might want to turn this whole branch into something that harks to a more functional programming style: return all((check(towers, i) for i in range(len(towers))) But that's a stylistic choice. def generate(size=4, towers=None, row=None, x=0): if not towers: # executed only once. row = [a for a in range(1, size+1)]# Then I'll pass towers list row = list(range(1, size+1)) random.shuffle(row)# at every recursion Again, I wouldn't wrap comments onto unrelated lines. You see how confusing this looks, now that I take this line out of context? Same will happen if it throws an exception. towers = [] # not so pretty way to generate for i in range(size): # matrix filled with 0's towers.append([]) # I tried: towers = [[0]*size]*size for j in range(size): # but this doesn't work. ;-) towers[i].append(0)# I don't know how to do this with # list comprehension (one inside row_ = row[:] # other?) towers[0] = row_# after adding first row, columns will be row = []# always unique, so I add entire row at once. x = size - 1# Then I will be adding only one num at time. # 'x' is pretty much position of last added el. When you multiply a list of lists, you get references to the same list, yes. But you could use multiplication for one level: towers = [[0]*size for _ in range(size)] That'll give you independent lists. I'm not wholly sure what the rest of your code is trying to do here, so I can't comment on it. if not row: row = [a for a in range(1, size+1)] random.shuffle(row) This is the same
Re: Creating a list with holes
On Fri, 03 Jan 2014 20:18:06 -0500, Roy Smith wrote: In article mailman.4871.1388794533.18130.python-l...@python.org, Larry Martell larry.mart...@gmail.com wrote: Thanks, but I know all that about dicts. I need to use a list for compatibility with existing code. Generalizing what I think the situation is, A dict is the best data structure for the parsing phase, but I need a list later to hand off to legacy interfaces. No problem. Parse the data using a dict, then convert the dict to a list later. I haven't been following all the details here, but just wanted to point out that using different data structures to hold the same data at different phases of a program is a perfectly reasonable approach. Indeed, assuming the requirement is to have a list of some length n units representing integer keys into a range of values from start to end, and he creates a dict initially: list = [ dict.get(x,None) for x in range(start,end + 1) ] Examples: dic = {1:fred, 9:jim, 15:susan, 25:albert } l = [ dic.get(x,None) for x in range(1,20) ] l ['fred', None, None, None, None, None, None, None, 'jim', None, None, None, None, None, 'susan', None, None, None, None] l = [ dic.get(x,None) for x in range(-10,50) ] l [None, None, None, None, None, None, None, None, None, None, None, 'fred', None, None, None, None, None, None, None, 'jim', None, None, None, None, None, 'susan', None, None, None, None, None, None, None, None, None, 'albert', None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None] len(l) 60 then the value of l[offset] will either be None or some string depending on the offset into the list -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list
How to make a tkinter GUI work on top of a CUI program?
I know how to make a GUI program work on top of a console program like ls, which exits immediately. But some console programs have their own shell or ncurse-like CUI, such as cscope. So I figured that I need to first subprocess.popen a bidirectional pipe and send command through stdin and get results from stdout and stderr. But in such a case I found that communicate('cmd') will freeze. Am I in the right direction? Here is my code, in which the application connects to cscope through pipe, the GUI has only one button that tries to invoke a cscope search command and get the result, the Enter key is represented as \n in the stdin argument of communicate(): import sys, os, os.path, subprocess, shlex if sys.version_info.major 3: import Tkinter as Tk else: import tkinter as Tk class MyGUI(object): ''' Frontend of the main command-line module. ''' def __init__(self): self.subProc = None self.root = Tk.Tk() self.frame = Tk.Frame(self.root) self.btn = Tk.Button(self.frame, text='My Command') self.btn.pack() self.btn.bind('Button-1', self.OnClickBtn) def MainLoop(self): os.chdir('path/to/myfolder') cmd = shlex.split('/usr/local/bin/cscope -d') self.subProc = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=0) self.root.mainloop() def OnClickBtn(self, event): print('OnClickBtn') (stdOut, stdErr) = self.subProc.communicate('symbolName\n') print(stdOut) if __name__ == '__main__': gui = MyGUI() gui.MainLoop() -- https://mail.python.org/mailman/listinfo/python-list
Re: How to make a tkinter GUI work on top of a CUI program?
On Sat, Jan 4, 2014 at 1:44 PM, Beinan Li li.bei...@gmail.com wrote: But some console programs have their own shell or ncurse-like CUI, such as cscope. So I figured that I need to first subprocess.popen a bidirectional pipe and send command through stdin and get results from stdout and stderr. But in such a case I found that communicate('cmd') will freeze. You can't use communicate(), as it'll wait for the process to end. But there are several quite different types of console UI, some of which you'll be able to use and some you won't: 1) There's the simple, straight-forward writing to stdout/stderr. Maybe it's a long-running 'make' or the burning of a DVD, but whatever it does, it takes no input and writes to the standard streams. Easy to work with - just read and handle incoming text. 2) There are interactive shell-type systems. You'll need to send them more than just lines of text, probably, as you might need to send command keys and such. But still fairly workable. 3) Then there's stuff that doesn't actually use the standard streams at all, or uses them and uses something else as well. You can pipe something into 'less', but it'll still look for actual keyboard input for its control. You'll have a lot more trouble manipulating those programs. Something that uses ncurses is most likely to land in box 3. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Creating a list with holes
On Fri, Jan 3, 2014 at 7:37 AM, Chris Angelico ros...@gmail.com wrote: Depending on what exactly you need, it's probably worth just using a dict. In what ways do you need it to function as a list? You can always iterate over sorted(some_dict.keys()) if you need to run through them in order. FWIW, sorting inside a loop is rarely a good idea, unless your lists are pretty small. For that, there are many tree datastructures available. -- https://mail.python.org/mailman/listinfo/python-list
Re: Creating a list with holes
On Sat, Jan 4, 2014 at 1:58 PM, Dan Stromberg drsali...@gmail.com wrote: On Fri, Jan 3, 2014 at 7:37 AM, Chris Angelico ros...@gmail.com wrote: Depending on what exactly you need, it's probably worth just using a dict. In what ways do you need it to function as a list? You can always iterate over sorted(some_dict.keys()) if you need to run through them in order. FWIW, sorting inside a loop is rarely a good idea, unless your lists are pretty small. What do you mean by sorting inside a loop? I was thinking of this: for key in sorted(some_dict.keys()): # blah blah which will sort once and then iterate over it. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Creating a list with holes
On Fri, Jan 3, 2014 at 7:00 PM, Chris Angelico ros...@gmail.com wrote: On Sat, Jan 4, 2014 at 1:58 PM, Dan Stromberg drsali...@gmail.com wrote: On Fri, Jan 3, 2014 at 7:37 AM, Chris Angelico ros...@gmail.com wrote: Depending on what exactly you need, it's probably worth just using a dict. In what ways do you need it to function as a list? You can always iterate over sorted(some_dict.keys()) if you need to run through them in order. FWIW, sorting inside a loop is rarely a good idea, unless your lists are pretty small. What do you mean by sorting inside a loop? I was thinking of this: for key in sorted(some_dict.keys()): # blah blah which will sort once and then iterate over it. That is fine, sorting once at then end of a script is a good use of sorted(some_dict.keys()). However, it probably should be pointed out that this, while similar, is not so good: for thing in range(n): for key in sorted(some_dict.keys()): do_something(thing, key) ...because it's sorting n times. -- https://mail.python.org/mailman/listinfo/python-list
Re: Creating a list with holes
On Sat, Jan 4, 2014 at 2:32 PM, Dan Stromberg drsali...@gmail.com wrote: That is fine, sorting once at then end of a script is a good use of sorted(some_dict.keys()). However, it probably should be pointed out that this, while similar, is not so good: for thing in range(n): for key in sorted(some_dict.keys()): do_something(thing, key) ...because it's sorting n times. Oh! Yeah. Yeah, that would be inefficient. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Blog about python 3
On 03/01/2014 22:00, Terry Reedy wrote: On 1/3/2014 7:28 AM, Robin Becker wrote: On 03/01/2014 09:01, Terry Reedy wrote: There was more speedup in 3.3.2 and possibly even more in 3.3.3, so OP should run the latter. python 3.3.3 is what I use on windows. As for astral / non-bmp etc etc that's almost irrelevant for the sort of tests we're doing which are mostly simple english text. If you do not test the cases where 2.7 is buggy and requires nasty workarounds, then I can understand why you do not so much appreciate 3.3 ;-). Are you crazy? Surely everybody prefers fast but incorrect code in preference to something that is correct but slow? Except that Python 3.3.3 is often faster. And always (to my knowledge) correct. Upper Class Twit of the Year anybody? :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: Suggest an open-source log analyser?
Web interface (and/or SQL-like query interface); is useful for drilling down and rolling up multiparametric analyses. Currently looking at logstash, kibana, graylog2 and a few others. Might end up writing my own to escape the Java dependency. Would welcome further suggestions. On Fri, Jan 3, 2014 at 1:13 AM, William Ray Wing w...@mac.com wrote: On Jan 2, 2014, at 12:40 AM, Alec Taylor alec.tayl...@gmail.com wrote: I use the Python logger class; with the example syntax of: Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') Can of course easily use e.g.: a JSON syntax here instead. Are there any open-source log viewers (e.g.: with a web-interface) that you'd recommend; for drilling down into my logs? Thanks for your suggestions, Alec Taylor -- https://mail.python.org/mailman/listinfo/python-list Why web interface? That's a ton of overhead just to look at a text file. If you are on UNIX or Linux, I'd just use my favorite editor (or possibly View, which is vi in read-only mode, or More or Less). If you give them the extension .log you can use whatever app you use to look at console logs. -Bill -- https://mail.python.org/mailman/listinfo/python-list
Highest performance HTTP REST microframework?
What is the highest performance REST microframework? Happy if it's mostly written in C or C++; as long as it provides a simple routes interface in Python. Currently using bottle and utilising its application, @route and app.merge(app2) extra features. -- https://mail.python.org/mailman/listinfo/python-list
Strange behaviour with a for loop.
Hello all. This is a newly question. But I wish to understand why the below code is providing different results. import os, sys if len(sys.argv) 2: filenames = sys.argv[1:] else print (no parameters provided\n) sys.edit() for filename in filenames: print (filename is: %s\n %filename) The above code will return results like: filename is test.txt If I modify the above script slightly as shown below, I get a completely different result. if len(sys.argv) 2: filenames = sys.argv[1] else print (no parameters provided\n) sys.exit() for filename in filenames: print (filename is: %s\n % filename) The result is the filename is spelled out a character at a time. The bit I am missing is something to do with splicing or referencing in Python. Why am I getting different results? In other languages I would have got the whole content of the element when using the index of the array (list). Sean filename is: t filename -- https://mail.python.org/mailman/listinfo/python-list
Re: Strange behaviour with a for loop.
On Fri, Jan 3, 2014 at 11:03 PM, Sean Murphy mhysnq1...@icloud.com wrote: Hello all. This is a newly question. But I wish to understand why the below code is providing different results. import os, sys if len(sys.argv) 2: filenames = sys.argv[1:] else print (no parameters provided\n) sys.edit() for filename in filenames: print (filename is: %s\n %filename) The above code will return results like: filename is test.txt If I modify the above script slightly as shown below, I get a completely different result. if len(sys.argv) 2: filenames = sys.argv[1] else print (no parameters provided\n) sys.exit() for filename in filenames: print (filename is: %s\n % filename) The result is the filename is spelled out a character at a time. The bit I am missing is something to do with splicing or referencing in Python. Why am I getting different results? In other languages I would have got the whole content of the element when using the index of the array (list). Sean filename is: t filename argv[1] gives just the second item in the list argv[1:] gives a list containing the items in the list, from the second to the end x = ['foo', 'bar', 'baz'] print x[1] bar print x[1:] ['bar', 'baz'] -- https://mail.python.org/mailman/listinfo/python-list
Re: Strange behaviour with a for loop.
On Sat, Jan 4, 2014 at 3:03 PM, Sean Murphy mhysnq1...@icloud.com wrote: filenames = sys.argv[1:] for filename in filenames: print (filename is: %s\n %filename) versus filenames = sys.argv[1] for filename in filenames: print (filename is: %s\n % filename) The first one is slicing sys.argv, so it returns another list. For instance, sys.argv might be: ['foo.py', 'test', 'zxcv'] in which case sys.argv[1:] would be: ['test', 'zxcv'] which is still a list. But sys.argv[1] is a single string: 'test' Now, when you use that in a for loop, you iterate over it. Iterating over a list yields its items, as you'd expect. Iterating over a string yields its characters. That's why you see it spelled out. Instead of iterating over a list of file names, you're iterating over a single file name, which isn't (in this case) all that useful. Does that explain what you're seeing? ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Highest performance HTTP REST microframework?
On Sat, Jan 4, 2014 at 3:26 PM, Alec Taylor alec.tayl...@gmail.com wrote: What is the highest performance REST microframework? Happy if it's mostly written in C or C++; as long as it provides a simple routes interface in Python. Currently using bottle and utilising its application, @route and app.merge(app2) extra features. What do you mean by performance? Most of the time is going to be spent waiting for the network. Are you looking for maximum concurrent requests handled? Minimum latency/overhead? Something else? ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Strange behaviour with a for loop.
On 04/01/2014 04:03, Sean Murphy wrote: Hello all. This is a newly question. But I wish to understand why the below code is providing different results. import os, sys if len(sys.argv) 2: filenames = sys.argv[1:] else print (no parameters provided\n) sys.edit() for filename in filenames: print (filename is: %s\n %filename) The above code will return results like: filename is test.txt If I modify the above script slightly as shown below, I get a completely different result. if len(sys.argv) 2: filenames = sys.argv[1] else print (no parameters provided\n) sys.exit() for filename in filenames: print (filename is: %s\n % filename) The result is the filename is spelled out a character at a time. The bit I am missing is something to do with splicing or referencing in Python. Why am I getting different results? In other languages I would have got the whole content of the element when using the index of the array (list). Sean filename is: t filename As you've already had answers I'd like to point out that your test for len(sys.argv) is wrong, else is missing a colon and sys.edit() is very unlikely to work :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: How to make a tkinter GUI work on top of a CUI program?
On Fri, Jan 3, 2014 at 9:44 PM, Beinan Li li.bei...@gmail.com wrote: But some console programs have their own shell or ncurse-like CUI, such as cscope. So I figured that I need to first subprocess.popen a bidirectional pipe and send command through stdin and get results from stdout and stderr. But in such a case I found that communicate('cmd') will freeze. Right. communicate() waits for the subprocess to end, and the subprocess is still waiting for you to do something. Instead, you'll need to read() and write() to the subprocess' stdin and stdout attributes, probably something like this (untested): def OnClickBtn(self, event): print('OnClickBtn') self.subProc.stdin.write('symbolName\n') print(self.subProc.stdout.read()) It looks like cscope has both a screen-oriented mode and a line-based mode. When you're working with a subprocess like this, you're going to want to be in the line-based mode, so you'll probably want to add -l or -L to your command line. -- Jerry -- https://mail.python.org/mailman/listinfo/python-list
Re: Suggest an open-source log analyser?
On Thu, 02 Jan 2014 16:40:19 +1100, Alec Taylor wrote: I use the Python logger class; with the example syntax of: Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') Can of course easily use e.g.: a JSON syntax here instead. Are there any open-source log viewers (e.g.: with a web-interface) that you'd recommend; for drilling down into my logs? If you want to do in-depth analysis, why not just stick it into an SQL database; e.g. SQLite or Postgres? -- https://mail.python.org/mailman/listinfo/python-list
Re: Creating a list with holes
Larry Martell larry.mart...@gmail.com wrote in message news:CACwCsY5P47-dB1NLQTUTQ=0aF6B+-M3y4hCxcUGmcVmHM8=-x...@mail.gmail.com... I think I know the answer is no, but is there any package that allows creating a list with holes in it? E.g. I'd want to do something like: x[10] = 12 x[20] = 30 I'm thinking of something like defaultdict but for lists (I know that's very different, but ... ) Thanks! -larry Just out of interest, I asked the same question on this list many years ago, and someone actually gave me an answer. It was something like the following - class MyList(list): ... def __getitem__(self, pos): ... try: ... return list.__getitem__(self, pos) ... except IndexError: ... return None ... def __setitem__(self, pos, value): ... try: ... list.__setitem__(self, pos, value) ... except IndexError: ... diff = pos - list.__len__(self) ... self.extend([None] * diff) ... self.append(value) ... ml = MyList() ml[3] ml[3] = 'a' ml [None, None, None, 'a'] I wanted it because I was familiar with it from a previous language I had used. As is turns out, I never actually used it, but I was impressed! Frank Millman -- https://mail.python.org/mailman/listinfo/python-list
Re: Blog about python 3
On 02/01/2014 17:36, Robin Becker wrote: On 31/12/2013 15:41, Roy Smith wrote: I'm using 2.7 in production. I realize that at some point we'll need to upgrade to 3.x. We'll keep putting that off as long as the effort + dependencies + risk metric exceeds the perceived added value metric. We too are using python 2.4 - 2.7 in production. Different clients migrate at different speeds. To be honest, the perceived added value in 3.x is pretty low for us. What we're running now works. Switching to 3.x isn't going to increase our monthly average users, or our retention rate, or decrease our COGS, or increase our revenue. There's no killer features we need. In summary, the decision to migrate will be driven more by risk aversion, when the risk of staying on an obsolete, unsupported platform, exceeds the risk of moving to a new one. Or, there will be some third-party module that we must have which is no longer supported on 2.x. +1 If I were starting a new project today, I would probably start it in 3.x. +1 I just spent a large amount of effort porting reportlab to a version which works with both python2.7 and python3.3. I have a large number of functions etc which handle the conversions that differ between the two pythons. For fairly sensible reasons we changed the internal default to use unicode rather than bytes. After doing all that and making the tests compatible etc etc I have a version which runs in both and passes all its tests. However, for whatever reason the python 3.3 version runs slower 2.7 Ran 223 tests in 66.578s 3.3 Ran 223 tests in 75.703s I know some of these tests are fairly variable, but even for simple things like paragraph parsing 3.3 seems to be slower. Since both use unicode internally it can't be that can it, or is python 2.7's unicode faster? So far the superiority of 3.3 escapes me, but I'm tasked with enjoying this process so I'm sure there must be some new 'feature' that will help. Perhaps 'yield from' or 'raise from None' or ... In any case I think we will be maintaining python 2.x code for at least another 5 years; the version gap is then a real hindrance. Of interest https://mail.python.org/pipermail/python-dev/2012-October/121919.html ? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: Strange behaviour with a for loop.
Thanks everyone. Mark thanks for the correction on the ':'. Since I didn't cut and copy, rather typed it out. Errors crept in. :-) another question in relation to slicing strings. If you want to get a single character, just using the index position will get it. If I use the following, shouldn't it also work? when I use Python 3.3, it didn't provide anything. a = test.txt print a[3] result is: 't print a[3:1] Nothing is printed. print a[3:2] Nothing is printed. print a[3:-1] t.tx is printed. Why doesn't the positive number of characters to be splice return anything while the negative value does? sorry about these basic questions. I do like the splice feature within Python. Also what is the best method of testing for a blank string? end of paragraph line 1 new paragraph of line 1. The above example text is what I want to test for. I am planning to either load the whole file in as a single chunk of memory using fp.read() or store it into an array by using fp.readlines(). The first option I see being useful because you can create a regular expression to test for multiple '\n'. While in an array (list) I would have to test for a blank line which I assume would be . Any suggestions on this would be welcomed. Sean print a[ On 04/01/2014, at 4:38 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 04/01/2014 04:03, Sean Murphy wrote: Hello all. This is a newly question. But I wish to understand why the below code is providing different results. import os, sys if len(sys.argv) 2: filenames = sys.argv[1:] else print (no parameters provided\n) sys.edit() for filename in filenames: print (filename is: %s\n %filename) The above code will return results like: filename is test.txt If I modify the above script slightly as shown below, I get a completely different result. if len(sys.argv) 2: filenames = sys.argv[1] else print (no parameters provided\n) sys.exit() for filename in filenames: print (filename is: %s\n % filename) The result is the filename is spelled out a character at a time. The bit I am missing is something to do with splicing or referencing in Python. Why am I getting different results? In other languages I would have got the whole content of the element when using the index of the array (list). Sean filename is: t filename As you've already had answers I'd like to point out that your test for len(sys.argv) is wrong, else is missing a colon and sys.edit() is very unlikely to work :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Strange behaviour with a for loop.
Hi everyone. Worked out what I was doing wrong with the string splicing. The offset number was lower then the index number, so it was failing. E.G: On 04/01/2014, at 4:54 PM, Sean Murphy mhysnm1...@gmail.com wrote: Thanks everyone. Mark thanks for the correction on the ':'. Since I didn't cut and copy, rather typed it out. Errors crept in. :-) another question in relation to slicing strings. If you want to get a single character, just using the index position will get it. If I use the following, shouldn't it also work? when I use Python 3.3, it didn't provide anything. a = test.txt print a[3] print a[4:1] --- index is 4 and offset is one. This is invalid. So I suspect the offset number still starts at the beginning of the string and counts forward or another way to look at it you are slicing from element x to element y. If element y is less then element x, return nothing. Does this make sense? I should have used: print a[4:6]) to get: t.t The 2nd part of my original question still stands. I will expand upon this a bit more to give more context. I want to print from the beginning of the paragraph to the end. Each paragraph ends with \n\n\n. If I use \n\n\n in lines this does return true for the string. But I don't have a starting position and ending position. The list method which I mention before can be sliced by going back one element. Any suggestion on this would be welcomed. I want to achieve this using standard core python objects/methods. Sean result is: 't print a[3:1] Nothing is printed. print a[3:2] Nothing is printed. print a[3:-1] t.tx is printed. Why doesn't the positive number of characters to be splice return anything while the negative value does? sorry about these basic questions. I do like the splice feature within Python. Also what is the best method of testing for a blank string? end of paragraph line 1 new paragraph of line 1. The above example text is what I want to test for. I am planning to either load the whole file in as a single chunk of memory using fp.read() or store it into an array by using fp.readlines(). The first option I see being useful because you can create a regular expression to test for multiple '\n'. While in an array (list) I would have to test for a blank line which I assume would be . Any suggestions on this would be welcomed. Sean print a[ On 04/01/2014, at 4:38 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 04/01/2014 04:03, Sean Murphy wrote: Hello all. This is a newly question. But I wish to understand why the below code is providing different results. import os, sys if len(sys.argv) 2: filenames = sys.argv[1:] else print (no parameters provided\n) sys.edit() for filename in filenames: print (filename is: %s\n %filename) The above code will return results like: filename is test.txt If I modify the above script slightly as shown below, I get a completely different result. if len(sys.argv) 2: filenames = sys.argv[1] else print (no parameters provided\n) sys.exit() for filename in filenames: print (filename is: %s\n % filename) The result is the filename is spelled out a character at a time. The bit I am missing is something to do with splicing or referencing in Python. Why am I getting different results? In other languages I would have got the whole content of the element when using the index of the array (list). Sean filename is: t filename As you've already had answers I'd like to point out that your test for len(sys.argv) is wrong, else is missing a colon and sys.edit() is very unlikely to work :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Strange behaviour with a for loop.
On Sat, Jan 4, 2014 at 5:32 PM, Sean Murphy mhysnm1...@gmail.com wrote: So I suspect the offset number still starts at the beginning of the string and counts forward or another way to look at it you are slicing from element x to element y. If element y is less then element x, return nothing. Does this make sense? I should have used: print a[4:6]) to get: t.t Yep, it's start and end indices, not start and length. When you use a negative number, it counts from the back: asdf[-1] 'f' asdf[-2] 'd' The 2nd part of my original question still stands. I will expand upon this a bit more to give more context. I want to print from the beginning of the paragraph to the end. Each paragraph ends with \n\n\n. If I use \n\n\n in lines this does return true for the string. But I don't have a starting position and ending position. The list method which I mention before can be sliced by going back one element. The in operator just tells you whether it's there or not; strings have a .index() method that tells you where something can be found. That might be what you want here! ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Strange behaviour with a for loop.
On 04Jan2014 16:54, Sean Murphy mhysnm1...@gmail.com wrote: Thanks everyone. Mark thanks for the correction on the ':'. Since I didn't cut and copy, rather typed it out. Errors crept in. :-) another question in relation to slicing strings. If you want to get a single character, just using the index position will get it. If I use the following, shouldn't it also work? when I use Python 3.3, it didn't provide anything. a = test.txt print a[3] result is: 't As expected, yes? print a[3:1] Nothing is printed. print a[3:2] Nothing is printed. These are not requests for 1 and 2 character strings. They are requests for the character in the span from, respectively, 3 to 1 and from 3 to 2. Important: counting FORWARDS. So: zero length strings. print a[3:-1] t.tx is printed. Why doesn't the positive number of characters to be splice return anything while the negative value does? -1 is shorthand for len(a)-1 It is often convenient to refer to a position from the end of the array instead of the start. So this means: [3:7], so positions 3,4,5,6. sorry about these basic questions. I do like the splice feature within Python. Also what is the best method of testing for a blank string? Well, and empty string: a == '' or len(a) == 0. And, because an if tests the nonzeroness of a single argument and an empty string has length zero, you can also go: if a: print long string, a else: print empty string OTOH, if you mean a blank string to mean containing only whitespace, you can use the string method isspace, which tests that all characters are whitespace and that the string is not empty. The doco for isspace() actually says: Return true if there are only whitespace characters in the string and there is at least one character, false otherwise. So you might write: if not a or a.isspace(): print blank string:, repr(a) Really you'd want to put that it a (trivial) function: def isblank(s): ''' Test that the string `s` is entirely blank. ''' return not s or s.isspace() That way you can write isblank() all through your program and control the precise meaning by modifying the function. Cheers, -- The perl5 internals are a complete mess. It's like Jenga - to get the perl5 tower taller and do something new you select a block somewhere in the middle, with trepidation pull it out slowly, and then carefully balance it somewhere new, hoping the whole edifice won't collapse as a result. - Nicholas Clark, restating an insight of Simon Cozens -- https://mail.python.org/mailman/listinfo/python-list
[issue19944] Make importlib.find_spec load packages as needed
Eric Snow added the comment: find_spec() is at package level because find_module() is and for no other good reason I'm aware of. I'd be just fine with moving it to util. I don't expect it to be used enough to warrant that top-level placement. Regarding builtins.__import__(), I'm using it in the event that someone installed their own __import__() which gives a different result than import_module(). Thus the parent used by find_spec() will be the expected one. I agree that comment about this would be good. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19944 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19713] Deprecate various things in importlib thanks to PEP 451
Eric Snow added the comment: Here's a patch that updates a couple files to not use find_module/load_module. These are the only changes like this (of consequence) outside pydoc, pkgutil, and importlib, which are covered by other tickets. -- Added file: http://bugs.python.org/file33300/issue19713-switch-to-new-api.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19713 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19708] Check pkgutil for anything missing for PEP 451
New submission from Eric Snow: Here's a patch that does the minimum of updating pkgutil and its tests to move away from find_module/load_module. I'm not sure there is much more to do than this. -- keywords: +patch Added file: http://bugs.python.org/file33301/issue19708-use-new-api.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19708 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19703] Update pydoc to PEP 451
Eric Snow added the comment: Here's a patch that updates pydoc to move away from find_module/load_module. These 4 don't need to change for PEP 451: safeimport() HTMLDoc.docmodule() HTMLDoc.index() TextDoc.docmodule() -- keywords: +patch Added file: http://bugs.python.org/file33302/issue19703-use-new-api.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19703 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19699] Update zipimport for PEP 451
Eric Snow added the comment: Could this wait for 3.5? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19699 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16039] imaplib: unlimited readline() from connection
STINNER Victor added the comment: Why is this issue still open? The issue was fixed in Python 2.6.9. Why is the issue a release blocker? The issue was also fixed in the future Python 3.4 (in default). -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19699] Update zipimport for PEP 451
Nick Coghlan added the comment: I don't see any problem with postponing the zipimport updates until 3.5 (we won't be updating the extension module handling until then anyway, since that requires C API additions). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19699 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20113] os.readv() and os.writev() don't raise an OSError on readv()/writev() failure
New submission from STINNER Victor: Example: $ python3 Python 3.3.2 (default, Nov 8 2013, 13:38:57) [GCC 4.8.2 20131017 (Red Hat 4.8.2-1)] on linux Type help, copyright, credits or license for more information. import os os.fstat(19) Traceback (most recent call last): File stdin, line 1, in module OSError: [Errno 9] Bad file descriptor buf=bytearray(10) os.readv(19, [buf]) -1 I would expect an OSError on os.readv() instead of -1. Moreover, empty list of buffers are not handled correctly: $ python3 Python 3.3.2 (default, Nov 8 2013, 13:38:57) [GCC 4.8.2 20131017 (Red Hat 4.8.2-1)] on linux Type help, copyright, credits or license for more information. import os os.readv(0, []) Traceback (most recent call last): File stdin, line 1, in module SystemError: error return without exception set Attached patch should fix both issues. -- messages: 207220 nosy: haypo priority: normal severity: normal status: open title: os.readv() and os.writev() don't raise an OSError on readv()/writev() failure versions: Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20113 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20113] os.readv() and os.writev() don't raise an OSError on readv()/writev() failure
STINNER Victor added the comment: os.readv() and os.writev() were added in Python 3.3 with the issue #10812. -- keywords: +patch nosy: +serhiy.storchaka Added file: http://bugs.python.org/file33303/readv_writev.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20113 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18294] zlib module is not completly 64-bit safe
Roundup Robot added the comment: New changeset 0cca6c5513d2 by Victor Stinner in branch 'default': Issue #18294: Fix uint_converter() in zlibmodule.c, fix the UINT_MAX check http://hg.python.org/cpython/rev/0cca6c5513d2 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18294 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20114] Sporadic failure of test_semaphore_tracker() of test_multiprocessing_forkserver on FreeBSD 9 buildbot
New submission from STINNER Victor: http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%203.x/builds/6085/steps/test/logs/stdio == FAIL: test_semaphore_tracker (test.test_multiprocessing_forkserver.TestSemaphoreTracker) -- Traceback (most recent call last): File /usr/home/buildbot/buildarea/3.x.krah-freebsd/build/Lib/test/_test_multiprocessing.py, line 3661, in test_semaphore_tracker _multiprocessing.sem_unlink(name2) AssertionError: OSError not raised -- keywords: buildbot messages: 207223 nosy: haypo, sbt priority: normal severity: normal status: open title: Sporadic failure of test_semaphore_tracker() of test_multiprocessing_forkserver on FreeBSD 9 buildbot versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20114 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16039] imaplib: unlimited readline() from connection
R. David Murray added the comment: Presumably because it has not been fixed in 2.7. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16113] SHA-3 (Keccak) support may need to be removed before 3.4
Roundup Robot added the comment: New changeset 52350d325b41 by Martin v. Löwis in branch 'default': * Issue #16113: Remove sha3 module again. http://hg.python.org/cpython/rev/52350d325b41 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16113 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16113] SHA-3 (Keccak) support may need to be removed before 3.4
Martin v. Löwis added the comment: I have now removed the aha code. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16113 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20113] os.readv() and os.writev() don't raise an OSError on readv()/writev() failure
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +rosslagerwall ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20113 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16039] imaplib: unlimited readline() from connection
STINNER Victor added the comment: Since the merge 2.6 - 2.7 did not apply cleanly, and had other problems. I null merged the 2.6 changes. I'll leave it to Benjamin to work out whatever patches 2.7 needs. So Benjamin, is there a reason to not fix this security vulnerability in Python 2.7? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com