[ANN] bcolz 0.7.2
== Announcing bcolz 0.7.2 == What's new == This is a maintenance release that fixes various bits and pieces. Importantly, compatibility with Numpy 1.9 and Cython 0.21 has been fixed and the test suit no longer segfaults on 32 bit UNIX. Feature-wise a new ``carray.view()`` method has been introduced which allows carrays to share the same raw data. ``bcolz`` is a renaming of the ``carray`` project. The new goals for the project are to create simple, yet flexible compressed containers, that can live either on-disk or in-memory, and with some high-performance iterators (like `iter()`, `where()`) for querying them. Together, bcolz and the Blosc compressor, are finally fulfilling the promise of accelerating memory I/O, at least for some real scenarios: http://nbviewer.ipython.org/github/Blosc/movielens-bench/blob/master/querying-ep14.ipynb#Plots For more detailed info, see the release notes in: https://github.com/Blosc/bcolz/wiki/Release-Notes What it is == bcolz provides columnar and compressed data containers. Column storage allows for efficiently querying tables with a large number of columns. It also allows for cheap addition and removal of column. In addition, bcolz objects are compressed by default for reducing memory/disk I/O needs. The compression process is carried out internally by Blosc, a high-performance compressor that is optimized for binary data. bcolz can use numexpr internally so as to accelerate many vector and query operations (although it can use pure NumPy for doing so too). numexpr optimizes the memory usage and use several cores for doing the computations, so it is blazing fast. Moreover, the carray/ctable containers can be disk-based, and it is possible to use them for seamlessly performing out-of-memory computations. bcolz has minimal dependencies (NumPy), comes with an exhaustive test suite and fully supports both 32-bit and 64-bit platforms. Also, it is typically tested on both UNIX and Windows operating systems. Installing == bcolz is in the PyPI repository, so installing it is easy:: $ pip install -U bcolz Resources = Visit the main bcolz site repository at: http://github.com/Blosc/bcolz Manual: http://bcolz.blosc.org Home of Blosc compressor: http://blosc.org User's mail list: bc...@googlegroups.com http://groups.google.com/group/bcolz License is the new BSD: https://github.com/Blosc/bcolz/blob/master/LICENSES/BCOLZ.txt **Enjoy data!** -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Caching: Access a local file, but ensure it is up-to-date from a remote URL
Howdy all, I'm hoping that the problem I currently have is one already solved, either in the Python standard library, or with some well-tested obvious code. A program I'm working on needs to access a set of files locally; they're just normal files. But those files are local cached copies of documents available at remote URLs — each file has a canonical URL for that file's content. I'd like an API for ‘get_file_from_cache’ that looks something like:: file_urls = { foo.txt: http://example.org/spam/;, bar.data: https://example.net/beans/flonk.xml;, } for (filename, url) in file_urls.items(): infile = get_file_from_cache(filename, canonical=url) do_stuff_with(infile.read()) * If the local file's modification timestamp is not significantly earlier than the Last-Modified timestamp for the document at the corresponding URL, ‘get_file_from_cache’ just returns the file object without changing the file. * The local file might be out of date (its modification timestamp may be significantly older than the Last-Modified timestamp from the corresponding URL). In that case, ‘get_file_from_cache’ should first read the document's contents into the file, then return the file object. * The local file may not yet exist. In that case, ‘get_file_from_cache’ should first read the document content from the corresponding URL, create the local file, and then return the file object. * The remote URL may not be available for some reason. In that case, ‘get_file_from_cache’ should simply return the file object, or if that can't be done, raise an error. So this is something similar to an HTTP object cache. Except where those are usually URL-focussed with the local files a hidden implementation detail, I want an API that focusses on the local files, with the remote requests a hidden implementation detail. Does anything like this exist in the Python library, or as simple code using it? With or without the specifics of HTTP and URLs, is there some generic caching recipe already implemented with the standard library? This local file cache (ignoring the spcifics of URLs and network access) seems like exactly the kind of thing that is easy to get wrong in countless ways, and so should have a single obvious implementation available. Am I in luck? What do you advise? -- \ “If consumers even know there's a DRM, what it is, and how it | `\ works, we've already failed.” —Peter Lee, Disney corporation, | _o__) 2005 | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: Caching: Access a local file, but ensure it is up-to-date from a remote URL
On Mon, Oct 13, 2014 at 5:36 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: So this is something similar to an HTTP object cache. Except where those are usually URL-focussed with the local files a hidden implementation detail, I want an API that focusses on the local files, with the remote requests a hidden implementation detail. Potential issue: You may need some metadata storage as well as the actual files. Or can you just ignore the Varies header etc etc etc, and pretend that this URL represents a single blob of data no matter what? I'm also dubious about relying on FS timestamps for critical data, as it's very easy to bump the timestamp to current, which would make your program think that the contents are fresh; but if that's truly the only metadata needed, that might be safe to accept. One way you could possibly do this is to pick up a URL-based cache (even something stand-alone like Squid), and then create symlinks from your canonically-named local files to the implementation-detail storage space for the cache. Then you probe the URL and return its contents. That guarantees that you're playing nicely with the rules of HTTP (particularly if you have chained proxies, proxy authentication, etc, etc - if you're deploying this to arbitrary locations, that might be an issue), but at the expense of complexity. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: what is the easiest way to install multiple Python versions?
On Mon, Oct 13, 2014 at 1:31 PM, Rustom Mody rustompm...@gmail.com wrote: Hearing a bit about docker nowadays. Here's why its supposedly better than a VM: https://www.docker.com/whatisdocker/ Downsides?? No idea! One obvious downside is that it doesn't allow guests to modify the OS at all. A VM gives you an entire OS, so you can use and manipulate anything. If you don't *need* all that flexibility, then a VM is paying an unnecessary cost, ergo Docker will have no downside. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: what is the easiest way to install multiple Python versions?
On Monday, October 13, 2014 1:24:27 PM UTC+5:30, Chris Angelico wrote: On Mon, Oct 13, 2014 at 1:31 PM, Rustom Mody wrote: Hearing a bit about docker nowadays. Here's why its supposedly better than a VM: https://www.docker.com/whatisdocker/ Downsides?? No idea! One obvious downside is that it doesn't allow guests to modify the OS at all. A VM gives you an entire OS, so you can use and manipulate anything. If you don't *need* all that flexibility, then a VM is paying an unnecessary cost, ergo Docker will have no downside. Was talking of more pragmatic downsides eg Does it really work? :-) [Docker is still quite new] -- https://mail.python.org/mailman/listinfo/python-list
Re: Toggle
On Mon, 13 Oct 2014 05:43:10 +1100, Chris Angelico wrote: On Mon, Oct 13, 2014 at 5:38 AM, Tony the Tiger tony@tiger.invalid wrote: colour = 'red' if colour == 'blue' else 'blue' I call that a subtle bug that most likely will jump up and bite your behind when you least expect it. More generally, I'd say that this is solving a (very) slightly different problem: it's providing a toggle with default feature, where the part after the else is the default. If you don't want a default, that's a bug. I've known times when that default makes life a lot easier, in which case it'd be a feature. ChrisA if the value of colour is being set by user input an incorrect value can be set the the error is in not validating user input and more complex solutions are definitely req. If the value is being set within the program itself and colour gets set to an incorrect value the bug lies elsewhere in the program. this looks like a simple requirement to alternate the colour of a GUI element so it is unlikely that incorrect values will be set. sometimes it is easy to get carried away overcomplicate a simple task, I tend to follow the KISS principle wherever possible -- 40 isn't old. If you're a tree. -- https://mail.python.org/mailman/listinfo/python-list
Re: while loop - multiple condition
On 10/12/2014 07:08 PM, Shiva wrote: while ans.lower() != 'yes' or ans.lower()[0] != 'y': ans = input('Do you like python?') I personally consider double negations less intuitive than following: while not( ans.lower() == 'yes' and ans.lower()[0] == 'y' ): Reading this line yoy would have noticed as wellm that what you really wanted would have been: while not( ans.lower() == 'yes' or ans.lower()[0] == 'y' ): I would write the coder differently. With your code you have to pre-initialze the variable ans. I personally consider it also more 'intuitive' / easier to understand if I can see the break conditiion. to many nots / != / negations can be confusing as you noticed yourself. Taking into account the Steven's suggestion about using the 'in' expression it could be: while True: ans = input('Do you like python?') if ans.lower() in ('yes', 'y'): break -- https://mail.python.org/mailman/listinfo/python-list
windows 7 pysqlite build error
I am getting this error trying to use a python27 pip install of stuff which ends up requiring pysqlite=2.6.3,2.7 building 'pysqlite2._sqlite' extension creating build\temp.win-amd64-2.7 creating build\temp.win-amd64-2.7\Release creating build\temp.win-amd64-2.7\Release\src c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DMODULE_NAM E=\pysqlite2.dbapi2\ -DSQLITE_OMIT_LOAD_EXTENSION=1 -IC:\python27\include -IC:\Users\rptlab\tmp\tenv\PC /Tcsrc/ module.c /Fobuild\temp.win-amd64-2.7\Release\src/module.obj module.c c:\users\rptlab\tmp\tmcallister\build\pysqlite\src\connection.h(33) : fatal error C1083: Cannot open include file: 'sqli te3.h': No such file or directory error: command 'c:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\BIN\\amd64\\cl.exe' failed with exit status 2 Cleaning up... I do have the various compilers installed and other extensions are building OK, so is this an error in pysqlite or in my general setup? The include path looks like it might relate to Python builds. I suppose it's feasible that pyqslite builds need to be installed specially. I don't remember this happening on my old win32 XP system, but that died and I now am forced to use 64bit win7. -- Robin Becker -- https://mail.python.org/mailman/listinfo/python-list
Re: TypeError: 'kwarg' is an invalid keyword argument for this function
Ian Kelly ian.g.ke...@gmail.com Wrote in message: On Sun, Oct 12, 2014 at 6:55 AM, roro codeath rorocode...@gmail.com wrote: How to implement it in my class? class Str(str): def __init__(self, *args, **kwargs): pass Str('smth', kwarg='a') The error is coming from the __new__ method. Because str is an immutable type, you should override the __new__ method, not __init__. Example: class Str(str): def __new__(cls, *args, **kwargs): return super().__new__(cls, args[0]) Str('smth', kwarg='a') 'smth' It would also help to spell it the same. In the OP's implementation, he defined kwargs, and tried to use it as kwarg. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list
Re: TypeError: 'kwarg' is an invalid keyword argument for this function
Dave Angel wrote: Ian Kelly ian.g.ke...@gmail.com Wrote in message: On Sun, Oct 12, 2014 at 6:55 AM, roro codeath rorocode...@gmail.com wrote: How to implement it in my class? class Str(str): def __init__(self, *args, **kwargs): pass Str('smth', kwarg='a') The error is coming from the __new__ method. Because str is an immutable type, you should override the __new__ method, not __init__. Example: class Str(str): def __new__(cls, *args, **kwargs): return super().__new__(cls, args[0]) Str('smth', kwarg='a') 'smth' It would also help to spell it the same. In the OP's implementation, he defined kwargs, and tried to use it as kwarg. That is consistent as should become clear when using something completely different: class Str(str): ... def __init__(self, *args, **kwargs): pass ... Str(smth, alpha=beta) Traceback (most recent call last): File stdin, line 1, in module TypeError: 'alpha' is an invalid keyword argument for this function -- https://mail.python.org/mailman/listinfo/python-list
Jython or Pyton issue-- Kindly Help me....
Dear All, How to write a program for reading or parsing the XML file in Sub root Wise. For ex: Below XMl, I want to read/ parse first country details and here also two year tag values are there.. Here I need to read/parse first year value only measn '2008' Only..After that I need to read second country details. Please help me .. i am struggling to get this solution.. ?xml version=1.0? data country name=Liechtenstein rank1/rank year2008/year year2009/year gdppc141100/gdppc neighbor name=Austria direction=E/ neighbor name=Switzerland direction=W/ /country country name=Singapore rank4/rank year2011/year gdppc59900/gdppc neighbor name=Malaysia direction=N/ /country country name=Panama rank68/rank year2011/year gdppc13600/gdppc neighbor name=Costa Rica direction=W/ neighbor name=Colombia direction=E/ /country /data -- https://mail.python.org/mailman/listinfo/python-list
Re: while loop - multiple condition
On Mon, Oct 13, 2014 at 7:31 PM, Gelonida N gelon...@gmail.com wrote: Taking into account the Steven's suggestion about using the 'in' expression it could be: while True: ans = input('Do you like python?') if ans.lower() in ('yes', 'y'): break Or, even simpler: Use an active condition. while input('Do you like python?') not in ('yes', 'y'): pass ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: while loop - multiple condition
Chris Angelico ros...@gmail.com: Or, even simpler: Use an active condition. while input('Do you like python?') not in ('yes', 'y'): pass Instead of the traditional pull technology, you could take advantage of the state-of-the-art push approach: print(You must love python -- everybody does!) Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: while loop - multiple condition
On Mon, Oct 13, 2014 at 6:59 AM, Chris Angelico ros...@gmail.com wrote: while input('Do you like python?') not in ('yes', 'y'): pass Unfortunately, you probably have to account for people who SHOUT: while input('Do you like python?').lower() not in ('yes', 'y'): pass wink Skip -- https://mail.python.org/mailman/listinfo/python-list
Re: while loop - multiple condition
On Mon, Oct 13, 2014 at 11:10 PM, Skip Montanaro skip.montan...@gmail.com wrote: On Mon, Oct 13, 2014 at 6:59 AM, Chris Angelico ros...@gmail.com wrote: while input('Do you like python?') not in ('yes', 'y'): pass Unfortunately, you probably have to account for people who SHOUT: while input('Do you like python?').lower() not in ('yes', 'y'): pass wink Welcome to collaborative editing. I make a change and introduce a bug. Fortunately, someone else can, just like that, fix that bug. Thanks! :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: while loop - multiple condition
On Mon, Oct 13, 2014 at 11:09 PM, Marko Rauhamaa ma...@pacujo.net wrote: Chris Angelico ros...@gmail.com: Or, even simpler: Use an active condition. while input('Do you like python?') not in ('yes', 'y'): pass Instead of the traditional pull technology, you could take advantage of the state-of-the-art push approach: print(You must love python -- everybody does!) Nay, there is love in excess. I thank heaven there are many pythons in England; but if thou lovest them all, I withdraw my thanks! -- Colonel Fairfax ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: what is the easiest way to install multiple Python versions?
On Mon, Oct 13, 2014 at 7:00 PM, Rustom Mody rustompm...@gmail.com wrote: On Monday, October 13, 2014 1:24:27 PM UTC+5:30, Chris Angelico wrote: On Mon, Oct 13, 2014 at 1:31 PM, Rustom Mody wrote: Hearing a bit about docker nowadays. Here's why its supposedly better than a VM: https://www.docker.com/whatisdocker/ Downsides?? No idea! One obvious downside is that it doesn't allow guests to modify the OS at all. A VM gives you an entire OS, so you can use and manipulate anything. If you don't *need* all that flexibility, then a VM is paying an unnecessary cost, ergo Docker will have no downside. Was talking of more pragmatic downsides eg Does it really work? :-) [Docker is still quite new] Ah, I can't help you there. I've never used Docker. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: what is the easiest way to install multiple Python versions?
On 10/12/14 9:33 AM, Albert-Jan Roskam wrote: Hi, (sorry for cross-posting) A few days ago I needed to check whether some Python code ran with Python 2.6. What is the easiest way to install another Python version along side the default Python version? My own computer is Debian Linux 64 bit, but a platform-independent solution would be best. Possible solutions that I am aware of -make altinstall *). This is what I tried (see below), but not all modules could be built. I gave up because I was in a hurry -Pythonbrew. This project is dead -Deadsnakes -Anaconda -Tox? I only know this is as a cross-version/implementation test runner -Vagrant. This is what I eventually did, and this was very simple. I ran Ubuntu 10.0.4 LTS, which uses Python 2.6, and used Vagrant SSH to run and check my code in Python 2.6 (and I replaced a dict comprehension with a list comprehension, for example) - ... What is the recommended way? I don't expect/hope that I'd ever need something lower than Python 2.5 I use pythonz: http://saghul.github.io/pythonz/ It lets me specify not just the version I want, but the implementation I want: I can install CPython 2.6.1, PyPy 2.0.2, and Jython 2.5.3 all the same way. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Jython or Pyton issue-- Kindly Help me....
On Mon, Oct 13, 2014 at 5:39 AM, Venugopal Reddy venugopal.re...@tspl.com wrote: Dear All, How to write a program for reading or parsing the XML file in Sub root Wise. I don't know what Sub root Wise is. You can find an overview of Python's XML parsing interfaces at https://docs.python.org/2/library/xml.html. I would recommend using the ElementTree API unless you have a specific reason to use something else. -- https://mail.python.org/mailman/listinfo/python-list
Re: while loop - multiple condition
On Mon, 13 Oct 2014 09:56:02 +1100 Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: When you have multiple clauses in the condition, it's easier to reason about them if you write the clauses as positive statements rather than negative statements, that is, something is true rather than something is not true, and then use `not` to reverse it if you want to loop *until* the overall condition is true. I was just explaining this concept to a young pup the other day. De Morgan's lets you say that (not (p and q)) == ((not p) or (not q)), but the positive logic flavor is substantially less error-prone. People are fundamentally not as good at thinking about inverted logic. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix. -- https://mail.python.org/mailman/listinfo/python-list
Re: while loop - multiple condition
On Monday, October 13, 2014 9:43:03 PM UTC+5:30, Rob Gaddi wrote: On Mon, 13 Oct 2014 09:56:02 +1100 Steven D'Aprano wrote: When you have multiple clauses in the condition, it's easier to reason about them if you write the clauses as positive statements rather than negative statements, that is, something is true rather than something is not true, and then use `not` to reverse it if you want to loop *until* the overall condition is true. I was just explaining this concept to a young pup the other day. De Morgan's lets you say that (not (p and q)) == ((not p) or (not q)), but the positive logic flavor is substantially less error-prone. People are fundamentally not as good at thinking about inverted logic. Curious: Which of - (not (p and q)) - ((not p) or (not q)) is more positive (less negative)?? -- https://mail.python.org/mailman/listinfo/python-list
Re: while loop - multiple condition
On Mon, 13 Oct 2014 09:26:57 -0700 (PDT) Rustom Mody rustompm...@gmail.com wrote: On Monday, October 13, 2014 9:43:03 PM UTC+5:30, Rob Gaddi wrote: On Mon, 13 Oct 2014 09:56:02 +1100 Steven D'Aprano wrote: When you have multiple clauses in the condition, it's easier to reason about them if you write the clauses as positive statements rather than negative statements, that is, something is true rather than something is not true, and then use `not` to reverse it if you want to loop *until* the overall condition is true. I was just explaining this concept to a young pup the other day. De Morgan's lets you say that (not (p and q)) == ((not p) or (not q)), but the positive logic flavor is substantially less error-prone. People are fundamentally not as good at thinking about inverted logic. Curious: Which of - (not (p and q)) - ((not p) or (not q)) is more positive (less negative)?? The first is asking you to compare positive conditions (p and q) and negate the entire thing (NAND). The second asks you to think about the combination of two different not true pieces of logic (OR of two inverted inputs). The first is pretty straightforward, and I usually see people get it right. The second gets screwed up as often as not. And of course, any combination of ands and ors should be broken into multiple statements with a descriptive variable name in the middle or all hope is lost. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix. -- https://mail.python.org/mailman/listinfo/python-list
Re: while loop - multiple condition
On Monday, October 13, 2014 10:13:20 PM UTC+5:30, Rob Gaddi wrote: On Mon, 13 Oct 2014 09:26:57 -0700 (PDT) Rustom Mody wrote: On Monday, October 13, 2014 9:43:03 PM UTC+5:30, Rob Gaddi wrote: On Mon, 13 Oct 2014 09:56:02 +1100 Steven D'Aprano wrote: When you have multiple clauses in the condition, it's easier to reason about them if you write the clauses as positive statements rather than negative statements, that is, something is true rather than something is not true, and then use `not` to reverse it if you want to loop *until* the overall condition is true. I was just explaining this concept to a young pup the other day. De Morgan's lets you say that (not (p and q)) == ((not p) or (not q)), but the positive logic flavor is substantially less error-prone. People are fundamentally not as good at thinking about inverted logic. Curious: Which of - (not (p and q)) - ((not p) or (not q)) is more positive (less negative)?? The first is asking you to compare positive conditions (p and q) and negate the entire thing (NAND). The second asks you to think about the combination of two different not true pieces of logic (OR of two inverted inputs). The first is pretty straightforward, and I usually see people get it right. The second gets screwed up as often as not. And of course, any combination of ands and ors should be broken into multiple statements with a descriptive variable name in the middle or all hope is lost. Yeah I guess 2 nots is one more than one! However (to my eyes) while i N and a[i] != X: looks less negative than while not (i==N or a[i] == X): [Of course i N is not identical to i != N ] -- https://mail.python.org/mailman/listinfo/python-list
How to select every other line from a text file?
Hi, I have a text file. Now it is required to select every other line of that text to generate a new text file. I have read through Python grammar, but still lack the idea at the beginning of the task. Could you tell me some methods to get this? Thanks, -- https://mail.python.org/mailman/listinfo/python-list
Re: How to select every other line from a text file?
On Tue, Oct 14, 2014 at 4:38 AM, Rff rw...@avnera.com wrote: I have a text file. Now it is required to select every other line of that text to generate a new text file. I have read through Python grammar, but still lack the idea at the beginning of the task. Could you tell me some methods to get this? There are a few ways of doing this. I'm guessing this is probably a homework assignment, so I won't give you the code as-is, but here are a few ideas: 1) Iterate over the file (line by line), alternating between writing the line out and not writing the line out. 2) Read the file into a list of lines, then slice the list with a step of 2, and write those lines out. 3) Iterate over the file, but also consume an extra line at the top or bottom of the loop. 4) Read the entire file into a string, then abuse regular expressions violently until they do what you want. And there are other ways, too. Show us some code and we can help you with it; but at the moment, this is fairly open-ended. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: How to select every other line from a text file?
In 3be64ca8-d2e7-493a-b4f3-ef114f581...@googlegroups.com Rff rw...@avnera.com writes: Hi, I have a text file. Now it is required to select every other line of that text to generate a new text file. I have read through Python grammar, but still lack the idea at the beginning of the task. Could you tell me some methods to get this? Initialize a counter variable to zero. (Or one, depending if you want to select odd or even lines.) Each time you read a line from the file, add one to the counter. If the counter is odd, process the line; otherwise use the 'continue' statement to start the loop over and read another line. -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list
Re: How to select every other line from a text file?
On 10/13/2014 10:38 AM, Rff wrote: Hi, I have a text file. Now it is required to select every other line of that text to generate a new text file. I have read through Python grammar, but still lack the idea at the beginning of the task. Could you tell me some methods to get this? Thanks, Read in your lines, keeping a counter as you go. Select those lines whose counter is even (or odd -- you didn't say which you wanted). So now some questions for you: * Do you know how to open a file and read in all the lines? * Do you know how to count as you do so? * Do you know how to test for evenness? (Use count%2 will be zero for even count values.) * Do you know how to write lines to an output file? Gary Herron -- https://mail.python.org/mailman/listinfo/python-list
Re: How to select every other line from a text file?
On 13/10/2014 18:48, John Gordon wrote: In 3be64ca8-d2e7-493a-b4f3-ef114f581...@googlegroups.com Rff rw...@avnera.com writes: Hi, I have a text file. Now it is required to select every other line of that text to generate a new text file. I have read through Python grammar, but still lack the idea at the beginning of the task. Could you tell me some methods to get this? Initialize a counter variable to zero. (Or one, depending if you want to select odd or even lines.) Each time you read a line from the file, add one to the counter. If the counter is odd, process the line; otherwise use the 'continue' statement to start the loop over and read another line. Why bother to initialise a counter when you can get the enumerate function to do all the work for you? -- 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 select every other line from a text file?
On 10/13/2014 11:02 AM, Mark Lawrence wrote: Why bother to initialise a counter when you can get the enumerate function to do all the work for you? I see it as a question of addressing the audience. Emile -- https://mail.python.org/mailman/listinfo/python-list
scipy errors and gfortran
Trying to get scipy 0.14 running on python 3.4.1 on SLES 11 SP2 LINUX system. Scipy seemed to compile fine using the command python setup.py install but when I try the scipy.test(full), I get errors regarding gfortran. I am using GCC(gfortran) version 4.9.1. The error states that /usr/lib/libgfortran.so.3: version 'gfortran_1.4' was not found (required by). Google tells me that this is the name of the symbol node whatever that means. What do I need to do to fix these errors? Please help. -- https://mail.python.org/mailman/listinfo/python-list
Re: How to select every other line from a text file?
On Mon, Oct 13, 2014 at 2:11 PM, emile em...@fenx.com wrote: On 10/13/2014 11:02 AM, Mark Lawrence wrote: Why bother to initialise a counter when you can get the enumerate function to do all the work for you? I see it as a question of addressing the audience. Emile I don't agree with the idea of using a counter. Its not pythonic, and I'm assuming the OP is just starting to learn python. Not apropos to the OP, but what came up in my mind was to write a generator function that returns every other line. This would separate the reading from the writing code. -- https://mail.python.org/mailman/listinfo/python-list -- Joel Goldstick http://joelgoldstick.com -- https://mail.python.org/mailman/listinfo/python-list
Re: How to select every other line from a text file?
On 2014-10-13, Chris Angelico ros...@gmail.com wrote: On Tue, Oct 14, 2014 at 4:38 AM, Rff rw...@avnera.com wrote: I have a text file. Now it is required to select every other line of that text to generate a new text file. I have read through Python grammar, but still lack the idea at the beginning of the task. Could you tell me some methods to get this? There are a few ways of doing this. I'm guessing this is probably a homework assignment, so I won't give you the code as-is, but here are a few ideas: 1) Iterate over the file (line by line), alternating between writing the line out and not writing the line out. 2) Read the file into a list of lines, then slice the list with a step of 2, and write those lines out. 3) Iterate over the file, but also consume an extra line at the top or bottom of the loop. 4) Read the entire file into a string, then abuse regular expressions violently until they do what you want. I'd vote for #3. Or write a generator that does something similar when given a parameter object that implements readline(). Of course, the _real_ answer is: os.system(sed -n 'g;n;p' '%s' % filename) ;) -- Grant Edwards grant.b.edwardsYow! Didn't I buy a 1951 at Packard from you last March gmail.comin Cairo? -- https://mail.python.org/mailman/listinfo/python-list
Re: How to select every other line from a text file?
On 2014-10-13 10:38, Rff wrote: Hi, I have a text file. Now it is required to select every other line of that text to generate a new text file. I have read through Python grammar, but still lack the idea at the beginning of the task. Could you tell me some methods to get this? You could force a re-read from the file each line: with open(x.txt) as f: for line in f: do_something(line) next(f) # discard/consume the next line Or, if you have it read into memory already, you could use slicing with a stride of 2: with open(x.txt) as f: data = f.readlines() interesting = data[::2] # start with the 1st line # interesting = data[1::2] # start with the 2nd line Or, if the file was large and you didn't want to have it all in memory at the same time, you could use itertools.islice() from itertools import islice with open(x.txt) as f: interesting = islice(f, 0, None, 2) # start with 1st line #interesting = islice(f, 1, None, 2) # start with 2nd line Note that in the last one, you get an iterator back, so you'd have to either turn it into a list or iterate over it. -tkc -- https://mail.python.org/mailman/listinfo/python-list
Re: How to select every other line from a text file?
On 2014-10-13 14:45, Joel Goldstick wrote: Not apropos to the OP, but what came up in my mind was to write a generator function that returns every other line. This would separate the reading from the writing code. You mean like offset = 0 # or 1 if you prefer for line in itertools.islice(source_iter, offset, None, 2): do_something(line) ? -tkc -- https://mail.python.org/mailman/listinfo/python-list
Re: How to select every other line from a text file?
On 10/13/2014 12:12 PM, Tim Chase wrote: You mean like offset = 0 # or 1 if you prefer for line in itertools.islice(source_iter, offset, None, 2): do_something(line) I certainly did. Learning the python standard library is different from learning python and each in its own time. Emile -- https://mail.python.org/mailman/listinfo/python-list
Re: windows 7 pysqlite build error
On 10/13/2014 4:31 PM, Dennis Lee Bieber wrote: On Mon, 13 Oct 2014 10:49:27 +0100, Robin Becker ro...@reportlab.com declaimed the following: c:\users\rptlab\tmp\tmcallister\build\pysqlite\src\connection.h(33) : fatal error C1083: Cannot open include file: 'sqli te3.h': No such file or directory Did \n get stuck in the name of the file in connection.h, or is that purely an artifact of the error reporting? error: command 'c:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\BIN\\amd64\\cl.exe' failed with exit status 2 I do have the various compilers installed and other extensions are building OK, so is this an error in pysqlite or in my general setup? The include path looks like it might relate to Python builds. I suppose it's feasible that pyqslite builds need to be installed specially. I don't remember this happening on my old win32 XP system, but that died and I now am forced to use 64bit win7. Off hand, you don't have the SQLite3 /development package/. PySQLite is just an adapter to the sqlite3 DLL; the sqlite3.h file would be part of the source code for sqlite3, not part of pysqlite itself. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Flask and Django
On 10/10/2014 04:22 PM, Juan Christian wrote: Maybe that's because I feel the Django doc a bit confuse, I tried reading (and practicing!) tutorials, official doc, books, and so on, but I can't quite understand the whole thing. Is Flask really underestimated? Can you guys mention big name companies or people using it? Does it have real value in real world business? Nothing wrong with using Flask, especially for a personal project, or even something commercial. That said, Django is pretty easy to get started with. I have done very little web development ever, and I can fairly easily get going with Django. The tutorials are quite good. If you have problems with them, you can get help on the django mailing lists and forums, I am sure. Django does seem to get a lot of attention. It's getting to be a huge framework, with lots of bells and whistles, but I'm pretty sure you can still use as much or as little of it as you need, and even discard parts of it, such as the native Django database persistance API, and use, say, sqalchemy. -- https://mail.python.org/mailman/listinfo/python-list
Re: while loop - multiple condition
On 10/13/2014 11:12 AM, Rustom Mody wrote: On Monday, October 13, 2014 10:13:20 PM UTC+5:30, Rob Gaddi wrote: On Mon, 13 Oct 2014 09:26:57 -0700 (PDT) Rustom Mody wrote: On Monday, October 13, 2014 9:43:03 PM UTC+5:30, Rob Gaddi wrote: On Mon, 13 Oct 2014 09:56:02 +1100 Steven D'Aprano wrote: When you have multiple clauses in the condition, it's easier to reason about them if you write the clauses as positive statements rather than negative statements, that is, something is true rather than something is not true, and then use `not` to reverse it if you want to loop *until* the overall condition is true. I was just explaining this concept to a young pup the other day. De Morgan's lets you say that (not (p and q)) == ((not p) or (not q)), but the positive logic flavor is substantially less error-prone. People are fundamentally not as good at thinking about inverted logic. Curious: Which of - (not (p and q)) - ((not p) or (not q)) is more positive (less negative)?? The first is asking you to compare positive conditions (p and q) and negate the entire thing (NAND). The second asks you to think about the combination of two different not true pieces of logic (OR of two inverted inputs). The first is pretty straightforward, and I usually see people get it right. The second gets screwed up as often as not. And of course, any combination of ands and ors should be broken into multiple statements with a descriptive variable name in the middle or all hope is lost. Yeah I guess 2 nots is one more than one! However (to my eyes) while i N and a[i] != X: looks less negative than while not (i==N or a[i] == X): [Of course i N is not identical to i != N ] Right it should have been not (i = N or a[i] == X) to be equivalent. In assembler it's often best to reverse the condition and then use the opposite jump mnemonic. IE, if the test is to see if a number not zero, use the jump if zero command instead. Often it reduces the number of jumps required and eliminates the need to jump over the body of the if block. if a != 0 then jump to bigger jump to end bigger: blah blah end: vs if a == 0 then jump to end blah blah end: -- https://mail.python.org/mailman/listinfo/python-list
Re: How to select every other line from a text file?
On Mon, 13 Oct 2014 10:38:48 -0700, Rff wrote: I have a text file. Now it is required to select every other line of that text to generate a new text file. I have read through Python grammar, but still lack the idea at the beginning of the task. Could you tell me some methods to get this? So this could be written as an algorithm something like: 1/ open the input file 2/ open the output file 3/ while there are lines to read from the input file 3/1/ read a line from the input file 3/2/ if I should output this line 3/2/1/ write line to output file 4/ close the input file 5/ close the output file Or in several other ways, and once you have an algorithm, you can start coding it (or implementing it in the programming language of your choice, whichever form of words best pleases your perfesser). -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: How to select every other line from a text file?
On Mon, Oct 13, 2014 at 10:38 AM, Rff rw...@avnera.com wrote: Hi, I have a text file. Now it is required to select every other line of that text to generate a new text file. I have read through Python grammar, but still lack the idea at the beginning of the task. Could you tell me some methods to get this? Perhaps something like: http://stromberg.dnsalias.org/svn/every-nth/trunk It uses zip and itertools.cycle. It's CPython 3.x though - if you need 2.x, you'd probably use xrange instead of range, and izip instead of zip. -- https://mail.python.org/mailman/listinfo/python-list
Need help in pulling SQL query out of log file...
Hi, I have a log file which has lot of information like..SQL query.. number of records read...records loaded etc.. My requirement is i would like to read the SQL query completly and write it to another txt file.. also the log file may not be always same so can not make static choices... my logfile is like below : *LOg file starts** Fri Aug 08 16:00:04 2014 : WRITER_1_*_1 WRT_8005 Writer run started. Fri Aug 08 16:00:04 2014 : READER_1_2_1 BLKR_16007 Reader run started. Fri Aug 08 16:00:04 2014 : WRITER_1_*_1 WRT_8158 *START LOAD SESSION* Load Start Time: Fri Aug 08 16:00:04 2014 Target tables: EIS_REQUEST_LOG_26MAYBKP T_delta_parm_file Fri Aug 08 16:00:04 2014 : READER_1_2_1 RR_4010 SQ instance [SQ_Shortcut_to_EIS_REQUEST_LOG] SQL Query [SELECT EIS_REQUEST_LOG_26MAYBKP.RqstId, EIS_REQUEST_LOG_26MAYBKP.RQSTLoadStatCd FROM EIS_REQUEST_LOG_26MAYBKP] Fri Aug 08 16:00:04 2014 : READER_1_2_1 RR_4049 RR_4049 SQL Query issued to database : (Fri Aug 08 16:00:04 2014) Fri Aug 08 16:00:04 2014 : READER_1_2_1 RR_4035 SQL Error [ FnName: Prepare -- [Teradata][ODBC Teradata Driver][Teradata Database] Object 'EIS_REQUEST_LOG_26MAYBKP' does not exist. ]. Fri Aug 08 16:00:04 2014 : READER_1_2_1 BLKR_16004 ERROR: Prepare failed. Fri Aug 08 16:00:04 2014 : READER_1_1_1 RR_4029 SQ Instance [SQ_RSTS_Tables] User specified SQL Query [--- Approved By ICC Team--- ---SELECT A.LOGSYS , ---D./BIC/NIGNRCSYS , ---B.ODSNAME , ---C.ODSNAME_TECH , ---C.PARTNO , ---C.REQUEST , ---E.SID ---FROM ---sapbzd.RSISOSMAP A, ---sapbzd.RSTSODS B, ---sapbzd.RSTSODSPART C, ---sapbzd./BIC/PNIGNRCSYS D, ---sapbzd./BI0/SREQUID E, ---sapbzd.RSMONMESSF ---WHERE A.OLTPSOURCE = ('ZNK_SHP_DDLN_CREATE_BE','ZNK_KNVP2_BD','ZNK_ZVBW_RTN_ORD_ITM_BN','2LIS_02_SCL_BE','ZNK_FX_CRCY_HIS_BE','ZNK_PO_FX_CALC_LOG_BD','2LIS_12_VCHDR_BE','2LIS_02_HDR_BN','ZNK_SHP_DDLN_CHANGE_BD','1_CO_PAGL11000N1_BE','0CUSTOMER_ATTR_BE','2LIS_08TRTLP_BD','2LIS_02_SCN_BD','2LIS_02_HDR_BD','2LIS_13_VDITM_BE','0CO_OM_CCA_9_BE','ZNK_SO_BDSI_OPNDMD_BE','2LIS_11_VAHDR_BE','ZNK_ZVBW_MBEW_BE','2LIS_13_VDHDR_BN','ZNK_SHP_DDLN_CHANGE_BE','NK_ADDR_NUMBR_BN','0CUSTOMER_TEXT_BE','6DB_J_3ABD_DELTA_AFFL_AD','0MAT_PLANT_ATTR_BE','ZNK_BDCPV_BD','1_CO_PAGL11000N1_BD','2LIS_11_VASTI_BD','ZNK_ZVBW_MSKU_BE','ZNK_SHP_DDLN_CREATE_BD','0SCEM_1_BC','2LIS_11_VAHDR_BD','2LIS_11_VASCL_BD','0MATERIAL_TEXT_BE','0MATERIAL_ATTR_BE','ZNK_BDCPV_BE','2LIS_02_ITM_BN','2LIS_11_VASCL_BE','2LIS_11_VAITM_BN','NK_ADDR_NUMBR_BE','2LIS_08TRTK_BE','ZNK_SD_LIKPPS_BN','2LIS_03_BF_BE','ZNK_SO_BDBS_ALLOC_BD','ZNK_TD_3AVASSO_BN','0EC_PCA_3_BD','ZNK_TD_3AVAP_BE','2LIS_11_VAITM_BE','0CUST_SALES_ATTR_BN','0EC_PCA_3_ BE','2LIS_13_VDITM_BN','2LIS_11_VASTH_BD','2LIS_13_VDITM_BD','0CUST_SALES_ATTR_BD','ZNK_TD_3AVASSO_BD','2LIS_02_SCN_BE','2LIS_08TRTS_BD','0CUSTOMER_ATTR_BN','ZNK_TD_3AVASSO_BE','ZNK_ZVBW_MSLB_BE','ZNK_TD_3AVAP_BD','0CUSTOMER_TEXT_BN','6DB_J_3ABD_DELTA_US_AD','0CUSTOMER_TEXT_BD','2LIS_11_VAHDR_BN','ZNK_SO_BDBS_ALLOC_BN','0GL_ACCOUNT_TEXT_BE','0GL_ACCOUNT_TEXT_BD','2LIS_11_VAITM_BD','ZNK_TD_3AVATL_BE','ZNK_SO_BDBS_ALLOC_BE','ZNK_EBAN_BE','ZNK_SO_BDSI_OPNDMD_BN','ZNK_SD_LIKPPS_BD','ZNK_ZVBW_RTN_ORD_ITM_BE','2LIS_08TRTS_BN','2LIS_02_HDR_BE','ZNK_TD_3AVATL_BD','ZNK_VBPA_BE','ZNK_FX_CRCY_HIS_BD','2LIS_13_VDHDR_BE','NK_ADDR_NUMBR_BD','2LIS_12_VCITM_BD','2LIS_08TRTK_BD','2LIS_11_VASCL_BN','ZNK_ZVBW_MCHB_BE','6DB_J_3ABD_SCL_DELTA_AP_AE','ZNK_SO_BDSI_OPNDMD_BD','ZNK_KNVP2_BE','0MAT_SALES_ATTR_BE','ZNK_TD_3AVAP_BN','2LIS_13_VDHDR_BD','0GL_ACCOUNT_ATTR_BD','2LIS_02_SCL_BD','ZNK_VBPA_BD','2LIS_02_ITM_BD','ZNK_TD_3AVATL_BN','ZNK_ZVBW_RTN_ORD_ITM_BD','ZNK_PO_FX_CALC_LOG_BE','6DB_J_3ABD_DELTA_EMEA_ AD','0GL_ACCOUNT_ATTR_BE','2LIS_03_BF_BD','2! LIS_11_V ASTI_BE','0CO_OM_CCA_9_BD','0CUST_SALES_ATTR_BE','2LIS_12_VCITM_BE','0CUSTOMER_ATTR_BD','2LIS_02_ITM_BE','2LIS_08TRTLP_BE','2LIS_12_VCHDR_BD','ZNK_EBAN_BD','2LIS_08TRTS_BE','2LIS_02_SCL_BN','2LIS_11_VASTH_BE','ZNK_SD_LIKPPS_BE') ---AND A.LOGSYS = D./BIC/NKLOGSYST ---AND A.OBJVERS = 'A' ---AND A.TRANSTRU = B.ODSNAME ---AND B.DATETO = 0101 ---AND B.OBJSTAT = 'ACT' ---AND B.ODSNAME_TECH = C.ODSNAME_TECH ---AND C.DELFLAG 'X' ---AND D./BIC/NIGNRCSYS = ('R3_PRA','R3_PRD','R3_PRF','EM_EMP') ---AND D.OBJVERS = 'A' ---AND E.REQUID = C.REQUEST ---AND F.RNR = C.REQUEST ---AND F.MSGNO = '344' ---AND F.AUFRUFER = '09'--- SELECT A.LOGSYS , D./BIC/NIGNRCSYS , B.ODSNAME , C.ODSNAME_TECH , C.PARTNO , C.REQUEST , E.SID FROM sapbzd.RSISOSMAP A, sapbzd.RSTSODS B, sapbzd.RSTSODSPART C, sapbzd./BIC/PNIGNRCSYS D, sapbzd./BI0/SREQUID E, sapbzd.RSMONMESSF WHERE A.OLTPSOURCE in
Re: How to install and run a script?
On 10/12/2014 08:05 PM, ryguy7272 wrote: Ah!!! I didn't know I needed to run it from the command prompt! Ok, not it makes sense, and everything works. Thanks to all! You don't have to run python apps from the command line. Apps that throw up windows can usually be run by double-clicking the py file in windows. But apps that communicate solely on the terminal or console have to be run in that environment. -- https://mail.python.org/mailman/listinfo/python-list
Re: Need help in pulling SQL query out of log file...
On 14/10/2014 11:47 AM, Sagar Deshmukh wrote: I have a log file which has lot of information like..SQL query.. number of records read...records loaded etc.. My requirement is i would like to read the SQL query completly and write it to another txt file.. Generally we encourage people to post what they've tried to the list. It helps us identify what you know and what you need help with. However, given: the log file may not be always same so can not make static choices... You'll probably want to use regular expressions: https://docs.python.org/howto/regex.html Regexps let you search through the text for known patterns and extract any that match. To extract all SQL query sections, you'll need to come up with a way of uniquely identifying them from all other sections. Looking at your example log file, it looks like they're all of the format: SQL Query [the actual sql query] From that we can determine that all SQL queries are prefixed by 'SQL Query [' and suffixed by ']', so the content you want is everything between those markers. So a possible regular expression might be: SQL Query \[(.*?)\] To quickly explain this: 1. SQL Query matches on that string 2. Because [] have meaning for regexes, to match on literal brackets you need to escape them via \[ and \] 3. ( ) is a group, whats contained in here will be returned 4. .* means to grab all matching text 5. ? means to do an ungreedy grab ie it'll stop at the first \] it encounters. Pulling the queries out of your log file should be as simple as: import re log = open('logfile').read() queries = re.findall(SQL Query \[(.*?)\], log, re.DOTALL) Because the queries can fall across multiple lines, the re.DOTALL flag is required to treat EOL markers as characters. Hope this helps. -- https://mail.python.org/mailman/listinfo/python-list
[issue22621] Please make it possible to make the output of hash() equal between 32 and 64 bit architectures
New submission from josch: I recently realized that the output of the following is different between 32 bit and 64 bit architectures: PYTHONHASHSEED=0 python3 -c 'print(hash(a))' In my case, I'm running some test cases which involve calling a Python module which creates several hundred megabyte big graphs and other things. The fastest way to make sure that the output I get is the same that I expect is to just call the md5sum or sha256sum shell tools on the output and compare them with the expected values. Unfortunately, some libraries I use rely on the order of items in Python dictionaries for their output. Yes, they should not do that but they also don't care and thus don't fix the problem. My initial solution to this was to use PYTHONHASHSEED=0 which helped but I now found out that this is limited to producing the same hash within the set of 32 bit and 64 bit architectures, respectively. See above line which behaves different depending on the integer size of architectures. So what I'd like CPython to have is yet another workaround like PYTHONHASHSEED which allows me to temporarily influence the inner workings of the hash() function such that it behaves the same on 32 bit and 64 bit architectures. Maybe something like PYTHONHASH32BIT or similar? If I understand the CPython hash function correctly, then this environment variable would just bitmask the result of the function with 0x or cast it to int32_t to achieve the same output across architectures. Would this be possible? My only alternative seems to be to either maintain patched versions of all modules I use which wrongly rely on dictionary ordering or to go to great lengths of parsing the (more or less) random output they produce into a sorted intermediary format - which seems like a bad idea because the files are several hundred megabytes big and this would just take very long and require additional complexity in handling them compared to being able to just md5sum or sha256sum them for the sake of checking whether my test cases succeed or not. -- messages: 229219 nosy: josch priority: normal severity: normal status: open title: Please make it possible to make the output of hash() equal between 32 and 64 bit architectures versions: Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22621 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22620] pythonw does not open on windows 8.1 x64
Cristian Baboi added the comment: I don't know if it is a documentation error for I've not read it yet. Maybe the best way is to put a shortcut to idle in the main directory where the python is. On 12 octombrie 2014 22:43:48 EEST, R. David Murray rep...@bugs.python.org wrote: R. David Murray added the comment: I'm going to close this, then. If you think there's a documentation issue we can reopen it. -- nosy: +r.david.murray resolution: - not a bug stage: - resolved status: open - closed type: crash - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22620 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22620 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17667] Windows: build with build_pgo.bat -2 fails to optimize python.dll
Anselm Kruis added the comment: It's indeed a very low priority issue. You mention VS2008 and VS2010 PGO compiler bugs. I'm aware of the VS 2010 bugs, but I didn't observe any VS 2008 PGO bug with Python 2.7. Are you aware of any publicly available bug reports? About the black/white list. I started with a black list, but then I switched to a white list for the following reason: the goal of running the test suite is to generate a reasonable profile. It is not a goal to test anything. Therefore both white list and black listing is possible. I consider it more likely that a newly added test breaks the PGO build than that an existing test will be modified in a breaking way. Therefore I consider the while list superior for this particular application. But as you already stated, it is low prio. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17667 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22621] Please make it possible to make the output of hash() equal between 32 and 64 bit architectures
Georg Brandl added the comment: While I can feel your pain regarding the use case you describe, I don't think this has enough general value to add to CPython. It is not really related to PYTHONHASHSEED, since we never made guarantees about hash values being stable across platforms and Python versions. PYTHONHASHSEED was introduced to address backwards compatibility for the rare cases where stable hash values are required within a platform/version combination. Without knowing anything about your libraries, would it not be possible to create a stable representation within the test case for comparison purposes, without having to write the unstable result to a file and then parsing it? That should be acceptable, given that creating and manipulating those graphs will probably also take significant time in the first place. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22621 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9311] os.access can return bogus values when run as superuser
Changes by Georg Brandl ge...@python.org: -- resolution: - not a bug status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9311 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20567] test_idle causes test_ttk_guionly 'can't invoke event command: application has been destroyed' messages from Tk
Serhiy Storchaka added the comment: You left this issue number off your tkinter test updates, such as f6f098bdb843. This is minor change. Actually, it should be done yet in issue22236, I had just missed it, because these warnings was produced only in 2.7. By using .update_idletasks instead of .update, are you assuming that their are no user events, or that they should be ignormed? There are not only user events. When you create or configure some widgets, some actions is not executed immediately (in particular changing a theme), but they are deferred to the next call of update() or update_idletasks(). When you call update_idletasks(), these harmless events are quickly handled without errors. This is only known me way to clear events queue. I was wondering whether it would be Ok, if not a good idea, to run tests, and maybe Idle itself, with NoDefaultRoot. I support it. There are some places in IDLE or tests which should be fixed, they are used default master. I cannot use exactly the same design as AbstractTkTest since I sometimes do other things in setUp/tearDownClass, but I could define create_test_root() and delete_test_root() functions in a support file. See Lib/tkinter/test/test_tkinter/test_images.py. Image tests do other things in setUpClass/tearDownClass, but calls parent's method too. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20567 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22621] Please make it possible to make the output of hash() equal between 32 and 64 bit architectures
josch added the comment: Thank you for your quick reply. Yes, as I wrote above there are ways around it by creating a stable in-memory representation and comparing that to a stable in-memory representation of the expected output. Since both input are several hundred megabytes in size, this would be CPU intensive but do-able. I would've just likeld to avoid treating this output in a special way because I also compare other files and it is most easy to just md5sum all of the files in one fell swoop. I started using PYTHONHASHSEED to gain stable output for a certain platform/version combination. When I uploaded my package to Debian and it was built on 13 different architectures I noticed the descrepancy when the same version but different platforms are involved. From my perspective it would be nice to just be able to set PYTHONHASH32BIT (or whatever) and call it a day. But of course it is your choice whether you would allow such a hack or not. Would your decision be more favorable if you received a patch implementing this feature? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22621 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21986] Idle: disable pickleability of user code objects
Serhiy Storchaka added the comment: PyShell imports non-idlelib modules, including re, before idlelib modules, such as rpc. So the re addition is there, though I strongly doubt that compiled regexs are every sent to the user process. But we can't guarantee that this alway will be so. Other stdlib modules can register picklers, and IDLE can import them in future. This code is not protected against future changes in other places of the code. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21986 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22621] Please make it possible to make the output of hash() equal between 32 and 64 bit architectures
Georg Brandl added the comment: Would your decision be more favorable if you received a patch implementing this feature? I'll keep this on pending for other devs to weigh in with opinions. In general, we are not keen on keeping text representations stable, as they do not form part of the API. This is true for exception messages most of all, but also the representations of other types change occasionally. Doctests and other test methods that rely on exact output, such as yours, have to adapt to that. The patch wouldn't be difficult to write, but the issue is more that it isn't really generally useful (as evidenced by the fact that you are the first to request it), and it won't save you a lot of work in any case if you want to support existing versions of Python (2.7, 3.x) as well: the new feature could only go into 3.5. -- resolution: - rejected status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22621 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13664] UnicodeEncodeError in gzip when filename contains non-ascii
Serhiy Storchaka added the comment: Ah, ASCII locale... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13664 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13664] UnicodeEncodeError in gzip when filename contains non-ascii
Roundup Robot added the comment: New changeset 7657cc08d29b by Serhiy Storchaka in branch '2.7': Fixed the test of issue #13664 on platforms without unicode filenames support. https://hg.python.org/cpython/rev/7657cc08d29b -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13664 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12067] Doc: remove errors about mixed-type comparisons.
Andy Maier added the comment: @Guido: Agree to all you said in your #msg226496. There is additional information about comparison in: - Tutorial (5.8. Comparing Sequences and Other Types), - Library Reference (5.3. Comparisons), - Language Reference (3.3.1. Basic customization) that needs to be reviewed in light of this patch. I'm just not sure I want to make this patch even larger as it is already, and tend to do that in a follow on issue and patch (unless directed otherwise). Andy -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12067 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22599] traceback: errors in the linecache module at exit
Serhiy Storchaka added the comment: There is one downside of my solution. For now the code uses current builtin open() which can be overloaded (to handle reading from ZIP archive for example, or to check permissions). With my solution it uses builtin open() at the time of import. I don't know insofar current behavior is intentional. We should take a decision of yet one core developer. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22599 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22001] containers same does not always mean __eq__.
Andy Maier added the comment: I reviewed the issues discussed here and believe that the patch for #Issue 12067 adresses all of them (and yes, it is large, unfortunately). It became large because I think that more needed to be fixed. May I suggest to review that patch. Andy -- nosy: +andymaier ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22001 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22590] math.copysign buggy with nan under Windows
Mark Dickinson added the comment: Antoine: is it okay to close this as wont fix? -- assignee: - mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22590 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22590] math.copysign buggy with nan under Windows
Antoine Pitrou added the comment: Yep, it's ok. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22590 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22417] PEP 476: verify HTTPS certificates by default
Changes by Raúl Cumplido raulcumpl...@gmail.com: -- nosy: +raulcd ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22417 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22590] math.copysign buggy with nan under Windows
Changes by Mark Dickinson dicki...@gmail.com: -- resolution: - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22590 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22390] test.regrtest should complain if a test doesn't remove temporary files
Serhiy Storchaka added the comment: I don't understand why you want to remove more files than before. You may open a different issue, or at least explain the rationale. I thought it would be good idea slightly extend this cleanup while we are here. I'm not motivated enough to open a different issue. Well, here is a patch which removes only TESTFN. It is still improved, uses support.unlink and support.rmtree instead of os.unlink and shutil.rmtree. You can just drop cleanup code at all if you prefer. All is good to me. I never see any forgotten test file after running tests, so I don't see why you are worried because of them. This is because regrtest creates temporary directory and goes to it. But when you execute Python test directly, test files are created in the current directory. And with your first patch, we will now noticed forgotten files, so we can just fix tests. But we will noticed only one about test at the time if several tests forgot the same file. This will needed several iterations. -- Added file: http://bugs.python.org/file36894/regrtest_warn_lost_files2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22390 ___diff -r 1d5485471457 Lib/test/regrtest.py --- a/Lib/test/regrtest.py Mon Oct 13 00:17:23 2014 -0500 +++ b/Lib/test/regrtest.py Mon Oct 13 11:10:36 2014 +0300 @@ -1031,7 +1031,7 @@ class saved_test_environment: # to a thread, so check processes first. 'multiprocessing.process._dangling', 'threading._dangling', 'sysconfig._CONFIG_VARS', 'sysconfig._INSTALL_SCHEMES', - 'support.TESTFN', 'locale', 'warnings.showwarning', + 'files', 'locale', 'warnings.showwarning', ) def get_sys_argv(self): @@ -1187,20 +1187,16 @@ class saved_test_environment: sysconfig._INSTALL_SCHEMES.clear() sysconfig._INSTALL_SCHEMES.update(saved[2]) -def get_support_TESTFN(self): -if os.path.isfile(support.TESTFN): -result = 'f' -elif os.path.isdir(support.TESTFN): -result = 'd' -else: -result = None -return result -def restore_support_TESTFN(self, saved_value): -if saved_value is None: -if os.path.isfile(support.TESTFN): -os.unlink(support.TESTFN) -elif os.path.isdir(support.TESTFN): -shutil.rmtree(support.TESTFN) +def get_files(self): +return sorted(fn + ('/' if os.path.isdir(fn) else '') + for fn in os.listdir()) +def restore_files(self, saved_value): +fn = support.TESTFN +if fn not in saved_value and (fn + '/') not in saved_value: +if os.path.isfile(fn): +support.unlink(fn) +elif os.path.isdir(fn): +support.rmtree(fn) _lc = [getattr(locale, lc) for lc in dir(locale) if lc.startswith('LC_')] ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1610654] cgi.py multipart/form-data
Rishi added the comment: My observation is that a file with more than normal (exact numbers below) line-feed characters takes way too long. I tried porting the above patch to my default branch, but it has some boundary and CRLF/LF issues, but more importantly it relies on seeking the file-object, which in the real world is stdin for web browsers and hence is illegal in that environment. I have attached a patch which is based on the same principle as Chui mentioned, ie reading a large buffer, but this patch does not deal with line feeds at all. It instead searches the entire boundary in a large buffer. The cgi module file-object only relies on readline and read functionality - so I created a wrapper class around read and readline to introduce buffering (attached as patch). When multipart boundaries are being searched, the patch fills a huge buffer, like in the original solution. It searches for the entire boundary and returns a large chunk of the payload in one call, rather than line by line. To search, there are corner cases ( when boundary is overlapping between buffers) and CRLF issues. A boundary in itself could have repeating characters causing more search complexity. To overcome this, the patch uses simple regular exressions without any expanding or wild characters. If a boundary is not found, it returns the chunk - length of the buffer - CRLF prefixes, to ensure that no boundary is overlapping between two consecutive buffers. The expressions take care of CRLF issues. When read and readline are called, the patch looks for data in the buffer and returns appropriately. There is a overall performance improvement in cases of large files, and very significant in case of files with very high number of LF characters. To begin with I created a 20MB file with 20% of the file filled with LineFeeds. File - 20MB.bin size - 20MB description - file filled with 20% (~4MB) '\n' Parse time with default cgi module - 53 seconds Parse time with patch - 0.4s This time increases linearly with the number of LFs for the default module.ie keeping the size same at 20MB and doubling the number of LFs to 40% would double the parse time. I tried with a normal large binary file that I found on my machine. size: 88mb description - binary executable on my machine, binary image has 140k lfs. Parse time with default cgi module - 2.7s Parse time with patch- 0.7s I have tested with a few other files and noticed time is cut by atleast half for large files. Note: These numbers are consitent over multiple observations. I tested this using the script attached, and also on my localhost server. The time taken is obtained by running the following code. t1=time.time() cProfile.run(fs = cgi.FieldStorage()) print(str(len(fs['datafile'].value))) t2 = time.time() print(str(t2 - t1)) I have tried to keep the patch compatible with the current module. However I have introduced a ValueError excepiton in the module when boundary is very large ie. 1024 bytes. The RFC specifies the maximum length to be 70 bytes. -- keywords: +patch nosy: +rishi.maker.forum Added file: http://bugs.python.org/file36895/issue1610654.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1610654 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12067] Doc: remove errors about mixed-type comparisons.
Andy Maier added the comment: Uploading v10 of the patch, which addresses all review comments made on v9. There is one open question back to Martin Panter about which different types of byte sequences can be compared in Py 3.4. I also believe this patch addresses all of Issue 22001. Let me know if you find that that is not the case. If we continue to scope this patch to only the comparison chapter of the language reference, then I think we are done (see msg229229 about other places that need review and possibly updates). Please review the patch v10. -- Added file: http://bugs.python.org/file36896/issue12067-expressions-py34_v10.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12067 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22615] Argument Clinic doesn't support the type argument for the int converter
Changes by Larry Hastings la...@hastings.org: -- title: make clinic doesn't work - Argument Clinic doesn't support the type argument for the int converter ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22615 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22615] Argument Clinic doesn't support the type argument for the int converter
Roundup Robot added the comment: New changeset c0224ff67cdd by Larry Hastings in branch 'default': Issue #22615: Argument Clinic now supports the type argument for the https://hg.python.org/cpython/rev/c0224ff67cdd -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22615 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22615] Argument Clinic doesn't support the type argument for the int converter
Changes by Larry Hastings la...@hastings.org: -- assignee: - larry resolution: - fixed status: open - closed type: - compile error ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22615 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22622] ElementTree only writes declaration when passed encoding
New submission from towb: This generates an XML declaration: import xml.etree.ElementTree as ET root = ET.Element('rss', version='2.0') tree = ET.ElementTree(root) tree.write('test.xml', encoding='iso-8859-1', xml_declaration=True) However the declaration disappears if your don't pass an encoding. This doesn't match the documentation: xml_declaration controls if an XML declaration should be added to the file. Use False for never, True for always, None for only if not US-ASCII or UTF-8 or Unicode (default is None). -- components: Library (Lib) messages: 229238 nosy: towb priority: normal severity: normal status: open title: ElementTree only writes declaration when passed encoding type: behavior versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22622 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20954] Bug in subprocess._args_from_interpreter_flags causes MemoryError
Changes by Martin Dengler mar...@martindengler.com: -- nosy: +mdengler ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20954 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20954] Bug in subprocess._args_from_interpreter_flags causes MemoryError
Martin Dengler added the comment: Just got hit with this in 2.7. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20954 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12067] Doc: remove errors about mixed-type comparisons.
Andy Maier added the comment: Here is the delta between v9 and v10 of the patch, if people want to see just that. -- Added file: http://bugs.python.org/file36897/issue12067-expressions-py34_delta-v9-v10.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12067 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22615] Argument Clinic doesn't support the type argument for the int converter
Antoine Pitrou added the comment: Thanks, Larry! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22615 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20079] Add support for glibc supported locales
Serhiy Storchaka added the comment: I think there is nothing more to do here and the issue can be closed. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20079 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22623] Missing guards for some POSIX functions
New submission from Link Mauve: Many POSIX functions aren’t available on every system, especially embedded ones. The first patch introduces guards around some of these functions and add them to AC_CHECK_FUNCS in the configure.ac; the second one recompile every changed generated file, using autoreconf -fi and clinic. -- components: Build hgrepos: 276 messages: 229243 nosy: Link Mauve priority: normal severity: normal status: open title: Missing guards for some POSIX functions type: compile error versions: Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22623 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22623] Missing guards for some POSIX functions
Changes by Link Mauve b...@linkmauve.fr: -- keywords: +patch Added file: http://bugs.python.org/file36898/f3cf19e38efe.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22623 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22559] [backport] ssl.MemoryBIO
Benjamin Peterson added the comment: We can reevaluate when we know when 2.7.10 will be released. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22559 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12067] Doc: remove errors about mixed-type comparisons.
Martin Panter added the comment: About the byte sequence comparisons, I wondered if it was misleading to say that a list(), tuple() or range() can only be compared to the same type, without mentioning that bytes() and bytearray() can be compared to each other. BTW just noticed you say range() supports lexicographical ordering, which I think is incorrect. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12067 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21224] BaseHTTPRequestHandler, update the protocol version to http 1.1 by default?
Stéphane Wirtel added the comment: ping -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21224 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22619] Possible implementation of negative limit for traceback functions
Dmitry Kazakov added the comment: Here's the updated (optimized) patch -- hgrepos: +277 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22619] Possible implementation of negative limit for traceback functions
Changes by Dmitry Kazakov jsb...@gmail.com: Added file: http://bugs.python.org/file36899/9cb7aaad1d85.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22619] Possible implementation of negative limit for traceback functions
Changes by Dmitry Kazakov jsb...@gmail.com: -- hgrepos: -277 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22609] Constructors of some mapping classes don't accept `self` keyword argument
Ethan Furman added the comment: Code looks good. Only downside is the change in help and inspect.signature output, but that is minor: Help on dict object: class dict(object) [...] | __init__(self, /, *args, **kwargs) vs. Help on class Counter in module collections: class Counter(builtins.dict) [...] | __init__(*args, **kwds) +1 to accept. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22609 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22622] ElementTree only writes declaration when passed encoding
Changes by Stefan Behnel sco...@users.sourceforge.net: -- nosy: +eli.bendersky, scoder ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22622 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22594] Add a link to the regex module in re documentation
anupama srinivas murthy added the comment: I have added the link and attached the patch below. Could you review it? Thank you -- components: -Regular Expressions keywords: +patch nosy: +anupama.srinivas.murthy Added file: http://bugs.python.org/file36900/regex-link.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22594 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22609] Constructors of some mapping classes don't accept `self` keyword argument
Larry Hastings added the comment: FWIW, I agree that it should be fixed: dict(self=1) {'self': 1} -- nosy: +larry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22609 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21991] The new email API should use MappingProxyType instead of returning new dicts.
Stéphane Wirtel added the comment: David, do you have an example, I am at the CPython sprint in Dublin, and I think I can work on this issue. Thanks -- nosy: +matrixise ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21991 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21907] Update Windows build batch scripts
Zachary Ware added the comment: After the last round of changes, the buildbots appear to be mostly happy. If anybody else wants to backport the changes, I'd be happy to review and commit, but I'll leave the backporting itself to whoever wants to do it. In the meantime, closing the issue. -- resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21907 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22594] Add a link to the regex module in re documentation
Georg Brandl added the comment: currently more bugfree and intended to replace re The first part is spreading FUD if not explained in more detail. The second is probably never going to happend :( -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22594 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21991] The new email API should use MappingProxyType instead of returning new dicts.
R. David Murray added the comment: The principle example is the 'params' dictionary in headerregistry. Currently it gets recreated every time you access that attribute. You can *apparently* change it, but that has no real effect. Probably the computed value should be cached the first time the attribute is accessed, and a MappingProxy over the cached value returned. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21991 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22619] Possible implementation of negative limit for traceback functions
Changes by Dmitry Kazakov jsb...@gmail.com: -- hgrepos: -275 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22417] PEP 476: verify HTTPS certificates by default
Alex Gaynor added the comment: Patch with the implementation, and initial work on documentation. Needs review please, I suspect we need more docs in more places. Feedback please! -- keywords: +needs review Added file: http://bugs.python.org/file36901/issue22417.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22417 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22435] socketserver.TCPSocket leaks socket to garbage collector if server_bind() fails
Roundup Robot added the comment: New changeset 437002018d2d by Charles-François Natali in branch '2.7': Issue #22435: Fix a file descriptor leak when SocketServer bind fails. https://hg.python.org/cpython/rev/437002018d2d -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22435 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17636] Modify IMPORT_FROM to fallback on sys.modules
Antoine Pitrou added the comment: Actually, looking up __package__ would be wrong. Say I have: from pack.module import foo and foo doesn't exist in pack.module but exists in pack. Since pack.module.__package__ == pack, using __package__ would wrongly find the foo in pack. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17636 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17636] Modify IMPORT_FROM to fallback on sys.modules
Roundup Robot added the comment: New changeset fded07a2d616 by Antoine Pitrou in branch 'default': Issue #17636: Circular imports involving relative imports are now supported. https://hg.python.org/cpython/rev/fded07a2d616 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17636 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17636] Modify IMPORT_FROM to fallback on sys.modules
Changes by Antoine Pitrou pit...@free.fr: -- resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17636 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14102] argparse: add ability to create a man page
Changes by Aaron Meurer asmeu...@gmail.com: -- nosy: +Aaron.Meurer ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14102 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22435] socketserver.TCPSocket leaks socket to garbage collector if server_bind() fails
Roundup Robot added the comment: New changeset 9c8016af2ed8 by Charles-François Natali in branch '3.4': Issue #22435: Fix a file descriptor leak when SocketServer bind fails. https://hg.python.org/cpython/rev/9c8016af2ed8 New changeset 3bd0f2516445 by Charles-François Natali in branch 'default': Issue #22435: Fix a file descriptor leak when SocketServer bind fails. https://hg.python.org/cpython/rev/3bd0f2516445 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22435 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22624] Bogus usage of floatclock in timemodule
New submission from Link Mauve: In Modules/timemodule.c, py_process_time() still uses floatclock() even when HAVE_CLOCK isn’t defined. -- components: Build messages: 229260 nosy: Link Mauve priority: normal severity: normal status: open title: Bogus usage of floatclock in timemodule type: compile error versions: Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22624 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22625] When cross-compiling, don’t try to execute binaries
New submission from Link Mauve: ``` % make ./Programs/_freeze_importlib \ ./Lib/importlib/_bootstrap.py Python/importlib.h ./Programs/_freeze_importlib: ./Programs/_freeze_importlib: cannot execute binary file Makefile:710: recipe for target 'Python/importlib.h' failed make: *** [Python/importlib.h] Error 126 ``` I tried `make touch` as it was suggested to me on #python-dev, but it didn’t fix that issue. -- components: Cross-Build messages: 229261 nosy: Link Mauve priority: normal severity: normal status: open title: When cross-compiling, don’t try to execute binaries type: compile error versions: Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22625 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1610654] cgi.py multipart/form-data
Antoine Pitrou added the comment: Rishi, thanks for the patch. I was going to give a review but first I have to ask: is so much support code necessary for this? Another approach would be to wrap self.fp in a io.BufferedReader (if it's not already buffered) and then use the peek() method to find the boundary without advancing the file pointer. -- nosy: +serhiy.storchaka stage: needs patch - patch review versions: +Python 3.5 -Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1610654 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com