Use and usefulness of the as syntax
First, could you confirm the following syntax import foo as f equivalent to import foo f = foo Now, I was wondering about the usefulness in everyday programming of the as syntax within an import statement. Here are some instances retrieved from real code of such a syntax import numpy as np import math as _math import pickle as pickle -- In the first case, the syntax is motivated by brevity need, isn't it ? -- The second case seems to be rather widespread and causes math attribute to be private but I don't figure out why this matters. -- In the last case, I can see no point So what is the pragmatics of the as syntax ? Thanks for clarification. -- http://mail.python.org/mailman/listinfo/python-list
Re: Use and usefulness of the as syntax
On Sat, Nov 12, 2011 at 10:56 PM, candide candide@free.invalid wrote: import foo as f equivalent to import foo f = foo Not quite, it's closer to: import foo f = foo del foo without the fiddling around. What the 'import... as' syntax gives is a way to separate the thing loaded from the name bound to. Suppose importing were done thus: foo = import(foo.py) Then you'd have a standard convention of always importing into a variable of the same name (loose terminology, but you know what I mean), with the option of importing as something completely different. The import... as syntax gives the same power, without forcing you to repeat yourself in the common situation. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Use and usefulness of the as syntax
On 12 November 2011 11:56, candide candide@free.invalid wrote: First, could you confirm the following syntax import foo as f equivalent to import foo f = foo Now, I was wondering about the usefulness in everyday programming of the as syntax within an import statement. Here are some instances retrieved from real code of such a syntax import numpy as np import math as _math import pickle as pickle -- In the first case, the syntax is motivated by brevity need, isn't it ? Correct! -- The second case seems to be rather widespread and causes math attribute to be private but I don't figure out why this matters. This way math doesn't get bound in the global namespace when doing from module import * -- In the last case, I can see no point Neither can I So what is the pragmatics of the as syntax ? It can also help when you want to import two different modules with the same name. -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list
Re: Use and usefulness of the as syntax
On 11/12/11 05:56, candide wrote: First, could you confirm the following syntax import foo as f equivalent to import foo f = foo and the issuing del foo Now, I was wondering about the usefulness in everyday programming of the as syntax within an import statement. Here are some instances retrieved from real code of such a syntax import numpy as np import math as _math import pickle as pickle -- In the last case, I can see no point Without context, I'm guessing the last one is merely keeping parity in a block that reads: try: import cPickle as pickle except ImportError: import pickle as pickle So what is the pragmatics of the as syntax ? The most common use-case I see is your first: to shorten a frequently-used namespace. I do this frequently with import Tkinter as tk which makes it obvious where things are coming from. I hate trying to track down variable-names if one did something like from Tkinter import * The second big use case I see regularly is the full example (above): try to import a faster/native module that shares an interface with a pure-python implementation. However in the above, the import pickle as pickle is a uselessly redundant. -tkc -- http://mail.python.org/mailman/listinfo/python-list
Re: Use and usefulness of the as syntax
El 12/11/11 13:43, Tim Chase escribió: I hate trying to track down variable-names if one did something like from Tkinter import * +1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Use and usefulness of the as syntax
On Sat, 2011-11-12 at 12:56 +0100, candide wrote: So what is the pragmatics of the as syntax ? Another case: try: import json except: import simplejson as json (same goes for several modules where the C implementation may or may not be available) Tim -- http://mail.python.org/mailman/listinfo/python-list
Re: Use and usefulness of the as syntax
candide wrote: First, could you confirm the following syntax import foo as f equivalent to import foo f = foo Now, I was wondering about the usefulness in everyday programming of the as syntax within an import statement. [ ... ] It gives you an out in a case like Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type help, copyright, credits or license for more information. os = 5 # number of 'o's import os as opsys os 5 opsys module 'os' from '/usr/lib/python2.6/os.pyc' (This is an instance of what arnaud mentioned.) Mel. -- http://mail.python.org/mailman/listinfo/python-list
CMBBE2012 – Special Session on “Computational Methods for Bio- Imaging and Visualization”
Dear Colleague, Within the 10th International Symposium on Biomechanics and Biomedical Engineering - CMBBE2012 (http://www.cmbbe2012.cf.ac.uk), to be held in Berlin, Germany, on April 11-14, 2012, we are organizing the Special Session on “Computational Methods for Bio- Imaging and Visualization”. Due to your research activities in the related fields, we would like to invite you to submit an abstract to our special session. Your contribution is mostly welcomed, and we would be honoured if you could accept this invitation. TOPICS OF INTEREST (not restricted to): - Applications of Bio- Imaging and Visualization; - Computational Vision; - Computer Aided Diagnosis, Surgery, Therapy, and Treatment; - Image Acquisition; - Image Processing and Analysis; - Image Segmentation, Matching and Registration; - Medical Imaging; - Motion and Deformation Analysis; - Physics of Bio-Imaging; - Scientific Visualization; - Shape Reconstruction; - Simulation and Animation; - Software Development; - Telemedicine Systems and their Applications. IMPORTANT DATES: - Abstract submission cut off: December 16, 2011; - Meeting: April 11-14, 2012. ABSTRACT SUBMISSION: Please, go to the abstract submission page (http:// www.cmbbe2012.cf.ac.uk/abstract%20-%20author.asp) and select the Special Session “SS5 - Computational Methods for Bio- Imaging and Visualization”. With kind regards, João Manuel R. S. Tavares, University of Porto, Portugal, tava...@fe.up.pt (Organizer of the Special Session on “Computational Methods for Bio- Imaging and Visualization”) -- http://mail.python.org/mailman/listinfo/python-list
Re: Python ORMs Supporting POPOs and Substituting Layers in Django
On Nov 8, 12:09 am, Lie Ryan lie.1...@gmail.com wrote: On 11/08/2011 01:21 PM, Travis Parks wrote: On Nov 7, 12:44 pm, John Gordongor...@panix.com wrote: Inj98tnf$qh...@reader1.panix.com John Gordongor...@panix.com writes: In415d875d-bc6d-4e69-bcf8-39754b450...@n18g2000vbv.googlegroups.com Travis Parksjehugalea...@gmail.com writes: Which web frameworks have people here used and which have they found to be: scalable, RAD compatible, performant, stable and/or providing good community support? I am really trying to get as much feedback as I've used Django and it seems to be a very nice framework. However I've only done one project so I haven't delved too deeply. You are probably looking for more detail than It's a nice framework :-) The database model in Django is powerful; it allows you to do queries in native Python code without delving into backend SQL stuff. I don't know how scalable/performant the database model is, as the one project I worked on didn't deal with a ton of data. (But I'd be surprised if it had poor performance.) The URL dispatcher provides a very nice and logical way to associate a given URL with a given method call. Community support is excellent. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, The Gashlycrumb Tinies I started the battle today. The new guy was trying to sell me on CodeIgnitor. I haven't looked at it, but it is PHP, so I really want to avoid it. The good thing is that all of his friends have been telling him to get into Python. I have been trying to convince him that PHP isn't cut out for background services and is mostly a front- end language. Python is much more geared towards hardcore data processing. Why write the system in two languages? I have been spending a lot of time looking at the Pyramid project: the next generation of the Pylons project. It looks powerful, but it seems to be a lot more complex than Django. CodeIgniter is a very fine framework, however it builds on top of a shitty excuse of a language called PHP. I've found that Django has a much better debugging tools; when a Django page produces an exception, it would always produce a useful error page. I haven't been able to do the same in CodeIgniter (nor in any PHP framework I've used, I'm starting to think it's a language limitation); often when you have errors, PHP would just silently return empty or partial pages even with all the debugging flags on. IMO, Python has a much nicer choice of built-in data structure for data processing. Python has a much more mature object-orientation, e.g. I prefer writing l.append(x) rather than array_push(l, x). I think these qualities are what makes you think Python is much, much more suitable for data processing than PHP; and I wholesomely agree. Database abstraction-wise, Django's ORM wins hands down against CodeIgniter's ActiveRecord. CodeIgniter's ActiveRecord is basically just a thin wrapper that abstracts the perks of various database engine. Django's ORM is a full blown ORM, it handles foreign key relationships in OO way. The only disadvantage of Django's ORM is that since it's written in Python, if you need to write a program working on the same database that doesn't use Django nor Python, then you'll have a problem since you'll have to duplicate the foreign key relationships. With all the bashing of PHP, PHP do have a few advantages. PHP and CodeIgniter is much easier to set up and running than Django; and the ability to create a .php file and have it running without having to write the routing file is sometimes a bliss. And PHP are often used as their own templating language; in contrast with Django which uses a separate templating language. Having a full blown language as your templating language can be a double-edged sword, but it is useful nevertheless for experimental work. IMO, while it is easier to get up and running in PHP, in the long run Python is much better in almost any other aspects.- Hide quoted text - - Show quoted text - The good thing is that I got the new guy to convert his thinking towards Python. He did a little research of his own and realized what he was missing. He and I have been writing some tools in Python, accessing social networking sites, and have been pleasantly surprised by Python's rich support for web protocols. Even yesterday, I wrote some code using xmlrpclib and it blew the equivalent C# code out of the water. urllib2 and urlparse make it really easy to work against RESTful services. It seems like most of Google's APIs have a Python variant. We are thinking we will go along with Pyramid, rather than Django. It was a really hard decision to make. Django has a lot of community support and is integrated with PyDev in eclipse. Nonetheless, we are anticipating the
export output from gnuplot to python
Hi all, I'm writing script in python, which fitting exponencial curve to data ( f(x) = a*exp(x*b). To this problem, I use gnuplot in my script. Gnuplot display parameters ( a +/- delta a; b +/- delta b) How Can I use/save this parameters in python variables in next steps of my script, def main(): ... plot = Gnuplot.Gnuplot() plot('f1(x) = a1*exp(b1*x)') plot('a1 = 300; b1 = 0.005;') plot('fit f1(x) data.txt using 1:2 via a1, b1') print first parameter, a1 print second parameter, b1 # is it feasible ? Or there is another way to see the results ( parameter a1 and b1) of gnuplot by python ... #plot('set terminal postscript') #plot('set output output.p http://output.ps/s') regards and please help, Cristopher -- http://mail.python.org/mailman/listinfo/python-list
youtube-dl: way to deal with the size cap issue + new errors + issues ...
~ I did find my way (through a silly hack) to get all files within a size range without waiting for youtube-dl to be enhanced. You could simply run youtube-dl in simulate mode and then parse that data to get the info ~ $ youtube-dl --help | grep simulate -s, --simulate do not download the video and do not write anything to disk -g, --get-urlsimulate, quiet but print URL -e, --get-title simulate, quiet but print title --get-thumbnail simulate, quiet but print thumbnail URL --get-descriptionsimulate, quiet but print video description --get-filename simulate, quiet but print output filename --get-format simulate, quiet but print output format ~ it turns out I needed the data anyway and %(uploader)s %(stitle)s and %(ext)s are helpful as well, for example, in case you decide to skip a certain uploader ~ I have also been getting errors reporting: ~ RTMP download detected but rtmpdump could not be run ~ What does it mean? Is it a youtube thing or a python/youtube-dl one (or both)? Could you fix that with some flag? ~ It would be very helpful if you could redirect youtube-dl errors to a separate file you would indicate via a flag ~ lbrtchx comp.lang.python: youtube-dl: way to deal with the size cap issue + new errors + issues ... ~ // __ ERROR: RTMP download detected but rtmpdump could not be run ~ downloading: http://www.youtube.com/watch?v=TD-66LHJF9E [youtube] Setting language [youtube] TD-66LHJF9E: Downloading video webpage [youtube] TD-66LHJF9E: Downloading video info webpage [youtube] TD-66LHJF9E: Extracting video information [youtube] RTMP download detected [download] Destination: ./LionsgateMovies-TD-66LHJF9E_Trading_Mom.flv ERROR: RTMP download detected but rtmpdump could not be run ~ downloading: http://www.youtube.com/watch?v=Ft5fFOktUno [youtube] Setting language [youtube] Ft5fFOktUno: Downloading video webpage [youtube] Ft5fFOktUno: Downloading video info webpage [youtube] Ft5fFOktUno: Extracting video information [youtube] RTMP download detected [download] Destination: ./LionsgateMovies-Ft5fFOktUno_Speed_Racer_The_Movie.flv ERROR: RTMP download detected but rtmpdump could not be run ~ downloading: http://www.youtube.com/watch?v=wRbAGrIjCr4 [youtube] Setting language [youtube] wRbAGrIjCr4: Downloading video webpage [youtube] wRbAGrIjCr4: Downloading video info webpage [youtube] wRbAGrIjCr4: Extracting video information [youtube] RTMP download detected [download] Destination: ./LionsgateMovies-wRbAGrIjCr4_Jonah_A_VeggieTales_Movie.flv ERROR: RTMP download detected but rtmpdump could not be run ~ downloading: http://www.youtube.com/watch?v=yU0KpRBkeMY [youtube] Setting language [youtube] yU0KpRBkeMY: Downloading video webpage [youtube] yU0KpRBkeMY: Downloading video info webpage [youtube] yU0KpRBkeMY: Extracting video information [youtube] RTMP download detected [download] Destination: ./LionsgateMovies-yU0KpRBkeMY_Hercules_In_New_York.flv ERROR: RTMP download detected but rtmpdump could not be run ~ -- http://mail.python.org/mailman/listinfo/python-list
occupywallst.org is looking for Python programmers
just got this from Richard: Justine just...@occupywallst.org told me they are looking for Python programmers. (It involves Django also.) so, if anyone is interested to help them out, please contact Justine. Best wishes Harald -- Harald Armin Massa no fx, no carrier pigeon - -- http://mail.python.org/mailman/listinfo/python-list
Re: youtube-dl: way to deal with the size cap issue + new errors + issues ...
On Sat, 12 Nov 2011 19:06:32 +, lbrt chx _ gemale wrote: I have also been getting errors reporting: ~ RTMP download detected but rtmpdump could not be run ~ What does it mean? Is it a youtube thing or a python/youtube-dl one (or both)? Could you fix that with some flag? Try installing rtmpdump. BTW, your first call before asking here about random problems should be to use the search engine of your choice to google for more information: https://duckduckgo.com/html/?q=rtmpdump -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: all() is slow?
which implies that getattr(x, 'a!b') should be equivalent to x.a!b No, it does not. The documentation states equivalence for two particular values, and there is no way to deduce truth for all cases from that. In fact, if it _was_ trying to say it was true for any attribute value, then your example would be proof that the documentation is incorrect, since CPython breaks that equivalence. Devin On Fri, Nov 11, 2011 at 8:18 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thu, 10 Nov 2011 23:35:32 -0500, Devin Jeanpierre wrote: That is patently untrue. If you were implementing namedtuple without exec, you would still (or at least you *should*) prevent the user from passing invalid identifiers as attribute names. What's the point of allowing attribute names you can't actually *use* as attribute names? Then why doesn't Python do this anywhere else? e.g. why can I setattr(obj, 'a#b') when obj is any other mutable type? That is implementation-specific behaviour and not documented behaviour for Python. If you try it in (say) IronPython or Jython, you may or may not see the same behaviour. The docs for getattr state: getattr(x, 'foobar') is equivalent to x.foobar which implies that getattr(x, 'a!b') should be equivalent to x.a!b which will give a syntax error. The fact that CPython does less validation is arguably a bug and not something that you should rely on: it is *not* a promise of the language. As Terry Reedy already mentioned, the namespace used in classes and instances are ordinary generic dicts, which don't perform any name validation. That's done for speed. Other implementations may use namespaces that enforce legal names for attributes, and __slots__ already does: class X(object): ... __slots__ = ['a', 'b!'] ... Traceback (most recent call last): File stdin, line 1, in module TypeError: Error when calling the metaclass bases __slots__ must be identifiers [...] To go off on another tangent, though, I don't really understand how you guys can think this is reasonable, though. I don't get this philosophy of restricting inputs that would otherwise be perfectly valid But they aren't perfectly valid. They are invalid inputs. Just because getattr and setattr in CPython allow you to create attributes with invalid names doesn't mean that everything else should be equally as slack. -- Steven -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
[issue13386] Document documentation conventions for optional args
Eric V. Smith e...@trueblade.com added the comment: To your last point, I think it's important to specify the default value placeholder (basically a sentinel) in the documentation. For example, if a function takes -1 to mean all occurrences, then the caller needs to know how what value to pass in in order to let the function compute the value. This is especially true if it's cheaper for the function to compute the value instead of the caller. I've run into this problem before, where I wanted to pass in some sentinel value and I had to read the source to figure out what it was. I think the function was in the standard library, but now I can't recall what it was. -- nosy: +eric.smith ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13386 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13294] http.server - HEAD request when no resource is defined.
Éric Araujo mer...@netwok.org added the comment: Hi Karl, I’m not clear about what problem or need this report describes. Is it a proposition to add a new method for SimpleHTTPRequestHandler to handle HEAD requests? -- nosy: +eric.araujo versions: +Python 3.3 -Python 3.1, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13294 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13297] xmlrpc.client could accept bytes for input and output
Éric Araujo mer...@netwok.org added the comment: I made comments on Rietveld but there was a glitch, I’m not sure the email was sent. -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13297 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13298] Result type depends on order of operands for bytes and bytearray
Changes by Éric Araujo mer...@netwok.org: -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13298 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13299] namedtuple row factory for sqlite3
Éric Araujo mer...@netwok.org added the comment: collections.namedtuple provides a much nicer interface than sqlite3.Row Definitely! -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13299 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13329] Runs normal as console script but falls as CGI
Éric Araujo mer...@netwok.org added the comment: The contents are valid UTF-8; the problem does not seem related to PYTHONIOENCODING (run “python3.2 Test.py | cat” so that stdout is not a tty; this used to be buggy in 2.x, hence PYTHONIOENCODING, but in 3.x the encoding of stdout is UTF-8 even in a pipeline). Nick, we’ll need more info about your setup, as well as the full traceback. Thanks! -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13329 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13336] packaging.command.Command.copy_file doesn't implement preserve_mode and preserve_times
Éric Araujo mer...@netwok.org added the comment: Thanks for the report. Have you found the bug with a real setup.cfg or hook, or were you just reading the code? I’m not sure how hard to fix this will be. The copy_file method delegates to shutil.copyfile, but this does not have the arguments we need, contrary to the former distutils file_util.copy_file function. Currently it’s only build_py that uses this parameter: # if a file is read-only in the working # directory, we want it to be installed read/write so that the next # installation of the same module distribution can overwrite it # without problems. (This might be a Unix-specific issue.) Thus # we turn off 'preserve_mode' when copying to the build directory, # since the build directory is supposed to be exactly what the # installation will look like (ie. we preserve mode when # installing). Depending on whether shutil supports what we need, different patches could be made: - Change code to use the right shutil function - Add code in copy_file to walk and chmod - Remove the preserve_* arguments and add another method for build_py -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13336 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13282] the table of contents in epub file is too long
Éric Araujo mer...@netwok.org added the comment: Thanks for the report. I do not know if this something that we can fix in the CPython repository by editing some template or config file or if it requires a patch to Sphinx first. Georg? -- nosy: +eric.araujo, georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13282 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13281] Make robotparser.RobotFileParser ignore blank lines
Éric Araujo mer...@netwok.org added the comment: First, I’d like to remind that the robots spec is not an official Internet spec backed up by an official body. It’s also not as important as (say) HTTP parsing. For this bug, IMO the guiding principle should be Postel’s Law. What harm is there in being more lenient than the spec? People apparently want to parse the robots.txt with blank lines from last.fm and whitehouse.gov, and I don’t think there are people that depend on the fact that blank lines cause the rest of the file to be ignored. Hence, I think too that we should be pragmatic and allow blank lines, to follow the precedent established by other tools and be pragmatic. If you feel strongly about this, I can contact the robotstxt.org people. -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13281 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13294] http.server - HEAD request when no resource is defined.
karl karl+pythonb...@la-grange.net added the comment: Eric, Two possible solutions to explore: Either the HEAD reports exactly the same thing than a GET without the body, because it is the role of the GET, but that means indeed adding support for the HEAD. or creating a catch-all answer for all unknown or not implemented methods with a 501 Method not implemented response from the server. Right now the HEAD returns something :) I still need to propose a patch. Daily job get into the way :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13294 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13387] add exact_type argument to assertIsInstance
New submission from Florent Xicluna florent.xicl...@gmail.com: Sometimes we want to check the exact type of an object. The method assertIsInstance could be misleading in such case. The current workaround is: assertIs(type(obj), some_class) However we can add an argument to the method to keep the benefit of having a nice failure message. Examples: assertIsInstance(stdobj, dict, exact_type=True) assertIsInstance(myobj, dict, exact_type=MyDict) -- components: Tests messages: 147480 nosy: flox, georg.brandl, michael.foord priority: normal severity: normal status: open title: add exact_type argument to assertIsInstance type: feature request versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13387 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13249] argparse.ArgumentParser() lists arguments in the wrong order
Éric Araujo mer...@netwok.org added the comment: Thanks, I’ve made some comments on Rietveld. Added a recommendation to only use keywords, which seems sane given the number of arguments. I looked for that but couldn’t find it. -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13249 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13387] add exact_type argument to assertIsInstance
Ezio Melotti ezio.melo...@gmail.com added the comment: I'm not sure this is common enough to justify a new arg. The status quo has the advantage that is quite close with what we would use in an 'if' statement (i.e. either if isinstance(obj, some_class): or if type(obj) is some_class:). -- nosy: +ezio.melotti, rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13387 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12103] Document how to use open with os.O_CLOEXEC
Changes by Éric Araujo mer...@netwok.org: -- keywords: +easy nosy: +eric.araujo title: Documentation of open() does not claim 'e' support in mode string - Document how to use open with os.O_CLOEXEC versions: +Python 3.3 -Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12103 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13264] Monkeypatching using metaclass
Éric Araujo mer...@netwok.org added the comment: It seems to me this is not a bug. Closing? -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13264 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13286] PEP 3151 breaks backward compatibility: it should be documented
Changes by Éric Araujo mer...@netwok.org: -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13286 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13386] Document documentation conventions for optional args
Ezio Melotti ezio.melo...@gmail.com added the comment: The problem is when the default placeholder is some unique object() or some _internal value (we had something similar with a socket timeout once). Also for something like str.strip(), would you document chars=None or chars= \n\r\t\v\f? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13386 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13193] test_packaging and test_distutils failures
Nadeem Vawda nadeem.va...@gmail.com added the comment: I'm no longer getting the failures on either Ubuntu or Windows (and the Windows buildbots are now green), so tentatively marking this as fixed. Feel free to reopen if something is still broken. -- resolution: - fixed stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13193 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12344] Add **kwargs to reinitialize_command
Éric Araujo mer...@netwok.org added the comment: I’ve spent some time on this. First, I decided that the former name (reinitialize_command) of the method was better. The get_* name could create the impression that the returned object was independent from the internal caches (command_obj, have_run), but it was not. I changed the name back (not pushed yet; I can’t push today). Second, I wrote tests before adding **kwargs. It turns out I ended up removing two buggy lines in dist.py! Thomas, if you could review that patch to tell me 1) if you can understand what it’s doing 2) if removing the two lines was right (they’ve been here since the first commit; on one hand there were no tests, but on the other there were commands depending on that code that did work well), that would be a great help. You’ve dug into that code, so if you can’t follow my patch it’d be a sign that it needs more comments. Finally, adding **kwargs was a two-line change in dist.py, a cleanup in some commands to use it, and two more tests. BTW, some things I said were stupid: In Distributions.get_reinitialized_command should the reinitialization of the subcommands also get passed the kwargs? Yes, the kwargs need to be passed all the way. That made no sense. Subcommands don’t have the same options as their parent. The kwargs are only for the command given as argument; to edit the options of a subcommand, reinitialize_command needs to be called for that subcommand too. Unfortunately my understanding of the (sub)command flow is not rock solid. My reply to that was off-mark. Documenting how subcommands work is on my todo list, and I’ll be glad to have your feedback on that if you have time. -- stage: - patch review title: Add **kwargs to get_reinitialized_command - Add **kwargs to reinitialize_command versions: +3rd party ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12344 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12344] Add **kwargs to reinitialize_command
Changes by Éric Araujo mer...@netwok.org: Added file: http://bugs.python.org/file23659/fix-reinitialize-command.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12344 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12344] Add **kwargs to reinitialize_command
Éric Araujo mer...@netwok.org added the comment: BTW, here’s the changeset to rename get_reinit_etc. -- Added file: http://bugs.python.org/file23660/rename-grc.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12344 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12119] distutils and python -B
Éric Araujo mer...@netwok.org added the comment: A 1999 comment in build_py from Greg Ward agrees with me: # XXX hey! we can't control whether we optimize or not; that's up # to the invocation of the current Python interpreter (at least # according to the py_compile docs). That sucks. If Tarek doesn’t object, I will make the change I proposed in my earlier message in distutils. -- title: test_distutils failure - distutils and python -B ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12119 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13193] test_packaging and test_distutils failures
Éric Araujo mer...@netwok.org added the comment: This problem was not trivial to find, because it appears that test execution order may not be entirely deterministic: I couldn't see any other reason why the flag would have different values on different machines. On my machine, it looks like unittest runs them in the order they’re found. I have only one core, but maybe tests are run in parallel on your machine, so with the missing call to enable_cache, that would explain the test failures. Antoine, I appreciate that you took time to fix this bug while I was without Internet and without Windows, but unfortunately I will have to backout your commit. Postel’s Law doesn’t win here: It is documented that the MANIFEST template only accepts /-delimited paths, so I have to find a fix for the tests without changing the code to avoid breaking the feature freeze. I’ll get a Windows VM before I do that, to avoid making the bots red again. In the future, please feel free to add unittest.expectedFailure decorators to problematic tests when I’m too long to come up with a fix, so that other people can see when their commits add problems. -- resolution: fixed - stage: committed/rejected - status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13193 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13204] sys.flags.__new__ crashes
Éric Araujo mer...@netwok.org added the comment: You are right. Even if it’s an undocumented internal type, there is no reason not to fix it. There are plenty of similar crash fixes committed in the repo. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13204 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13387] add exact_type argument to assertIsInstance
Changes by Florent Xicluna florent.xicl...@gmail.com: Added file: http://bugs.python.org/file23661/grep_test_is_instance.log ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13387 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13294] http.server: HEAD request should not return a body
Éric Araujo mer...@netwok.org added the comment: Right now the HEAD returns something :) Ah, so this is a bug. I still need to propose a patch. A patch to add a test (for 2.7 or 3.2, see devguide) would be a great first step. -- title: http.server - HEAD request when no resource is defined. - http.server: HEAD request should not return a body type: feature request - behavior versions: +Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13294 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13193] test_packaging and test_distutils failures
Antoine Pitrou pit...@free.fr added the comment: Antoine, I appreciate that you took time to fix this bug while I was without Internet and without Windows, but unfortunately I will have to backout your commit. Postel’s Law doesn’t win here: It is documented that the MANIFEST template only accepts /-delimited paths, “Just like in the setup script, file and directory names in the manifest template should always be slash-separated” That's should, not must. Also, I thought people did undocumented things with distutils, and we had to support these undocumented uses? In the future, please feel free to add unittest.expectedFailure decorators to problematic tests when I’m too long to come up with a fix, so that other people can see when their commits add problems. I don't see how adding expected failures solves anything. It's not clear why this failure should have been expected, rather than a bug. A commit adding problem should be fixed or reverted; marking some failures expected is just dodging the issue. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13193 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13387] add exact_type argument to assertIsInstance
Changes by Florent Xicluna florent.xicl...@gmail.com: Added file: http://bugs.python.org/file23662/grep_test_exact_type.log ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13387 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13180] pysetup silently ignores invalid entries in setup.cfg
Éric Araujo mer...@netwok.org added the comment: I want to explore ideas about a schema/type system, so I’m removing the easy keyword. -- keywords: -easy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13180 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13387] add exact_type argument to assertIsInstance
Florent Xicluna florent.xicl...@gmail.com added the comment: At least in the standard library test suite, it should be useful. When the test is stricter, it catches errors earlier. I remember when assertIsInstance was made available (issue #7031), we started to rewrite some expressions self.assertEqual(type(result), str) with self.assertIsInstance(result, str) Actually, it means we relaxed the test. Today, I don't want to use assertIsInstance anymore because I want to check the exact type() of the result. The attached files list the usage of both in Lib/test/*py: - 325 assertIsInstance - 234 assert. . .type(. . .) IMHO, some assertIsInstance can be stricter. Most of the other type() tests can be replaced with this method. -- keywords: +patch Added file: http://bugs.python.org/file23663/issue13387_exact_type.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13387 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13387] add exact_type argument to assertIsInstance
Éric Araujo mer...@netwok.org added the comment: I find that assertIs(type(x), someclass) is very clear, whereas an assertIsInstance that would not behave like isinstance depending on one argument would be non-obvious to me. -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13387 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1011113] Make “install” find the build_base directory
Éric Araujo mer...@netwok.org added the comment: I’ve found a distutils commit that shows that this option was removed on purpose, because people might except that using “install -b foo” would affect the build command, but it does not. I don’t think it’s a problem. For people who run build and install in separate steps, it should be possible to say “build -b spam” and then “install -b spam”. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue103 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13193] test_packaging and test_distutils failures
Éric Araujo mer...@netwok.org added the comment: That's should, not must. I read that “should” as a polite “must”. Also, I thought people did undocumented things with distutils, and we had to support these undocumented uses? People rely on undocumented features and sometimes on bugs. Thus, we cannot refactor or otherwise clean up internals. Here, you did change internals. I don't see how adding expected failures solves anything. [...]. If a buildbot is red for a week because of me and another developer commits something that creates another test failure, they won’t see that a buildbot has turned red because it already was. It’s just a temporary edition to avoid polluting the buildbots output. A commit adding problem should be fixed or reverted The point is that fixing it may take tome. Reverting is fine by me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13193 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9831] test_distutils should honor PYTHONDONTWRITEBYTECODE
Éric Araujo mer...@netwok.org added the comment: I now think the change I did was wrong. See #12119. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9831 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13193] test_packaging and test_distutils failures
Antoine Pitrou pit...@free.fr added the comment: A commit adding problem should be fixed or reverted The point is that fixing it may take tome. Reverting is fine by me. But we have no way of knowing you will be taking tome to do it. Ideally, you should have reverted it yourself (or applied whatever test-skipping solution you see fit). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13193 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12246] Support installation when running from an uninstalled Python
Éric Araujo mer...@netwok.org added the comment: Paul Moore reported that a Python built in its checkout on Windows has no problem installing, so I’d like to revisit this. The patch was also incomplete: The install module was changed, but people could still call “pysetup run install_dist”, and that command was not touched. To support this on Unix too, we have to either fix sysconfig (#6087) or override some sysconfig paths in packaging. I will shoot an email at python-dev. There is no pattern for Lib/site-packages in .hgignore, which makes me think that this issue just never showed up before; I think I need approval before I go ahead. -- nosy: +pmoore resolution: fixed - stage: committed/rejected - needs patch status: closed - open title: Warn when trying to install third-party module from an uninstalled checkout - Support installation when running from an uninstalled Python ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12246 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13387] add exact_type argument to assertIsInstance
Florent Xicluna florent.xicl...@gmail.com added the comment: I would say that this one is clear too: aelf.assertTrue(isinstance(obj, cls)) except that the failure message is not very friendly: AssertionError: False is not true If we keep assertIsInstance, more people will continue to misuse it just because the method exist, when they really want to check (type(obj) is cls). An option could be to add a snippet to the documentation of `assertIsInstance` stating that the right way to check exact type is `assertIs(type(obj), cls)`. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13387 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13170] distutils2 test failures
Éric Araujo mer...@netwok.org added the comment: All three issues fixed, thanks! I can’t push today but I will as soon as possible, probably Monday. I will open another report for the change I reverted in config; it was done on purpose by another developer to fix a bug with distutils2’s own setup script, so there is a real bug to fix here. -- resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13170 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12659] Add tests for packaging.tests.support
Éric Araujo mer...@netwok.org added the comment: I ported the patch to distutils2, but it fails because of some unittest internal problem. Help welcome. -- Added file: http://bugs.python.org/file23664/test_support.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12659 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13387] add exact_type argument to assertIsInstance
Éric Araujo mer...@netwok.org added the comment: I would say that this one is clear too: aelf.assertTrue(isinstance(obj, cls)) except that the failure message is not very friendly: AssertionError: False is not true Yeah, you have to give something as third argument to ease debugging. If we keep assertIsInstance, more people will continue to misuse it just because the method exist, when they really want to check (type(obj) is cls). If they make that mistake, it is because they don’t understand what isinstance does. An option could be to add a snippet to the documentation of `assertIsInstance` stating that the right way to check exact type is `assertIs(type(obj), cls)`. My point was that maybe they think they really want to check the type, but with Python you don’t have to care that much most of the time. +1 on a doc addition (I can even volunteer a patch) -0.5 on the proposed new argument -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13387 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1677872] Efficient reverse line iterator
Changes by Éric Araujo mer...@netwok.org: -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1677872 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13385] Add an explicit re.NOFLAGS flag value to the re module
Éric Araujo mer...@netwok.org added the comment: I had too the need to find out the value to pass when there are no flags, so a mention of 0 in the doc would have been enough for me. -0 on a new constant. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13385 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13336] packaging.command.Command.copy_file doesn't implement preserve_mode and preserve_times
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: Éric Araujo mer...@netwok.org added the comment: Thanks for the report. Have you found the bug with a real setup.cfg or hook, or were you just reading the code? I found the bug with a real setup.cfg (executable permission not set IIRC) and tracked it to copy_file. The copy_tree function wasn't used, I was just making an observation from scanning the code. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13336 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13297] xmlrpc.client could accept bytes for input and output
Florent Xicluna florent.xicl...@gmail.com added the comment: Thank you for your comments. Uploaded a new version. -- Added file: http://bugs.python.org/file23665/issue13297_xmlrpc_bytes_v4.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13297 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13198] Remove duplicate definition of write_record_file
Éric Araujo mer...@netwok.org added the comment: Here’s the patch produced by Mike and I so far. -- keywords: +patch Added file: http://bugs.python.org/file23666/remove-duplicate-write_record_file.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13198 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13239] Remove operator from Grammar/Grammar
Éric Araujo mer...@netwok.org added the comment: +1 for a comment too. I’d even make it shorter: # don't look at , it's not a real operator (see PEP 401) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13239 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11638] python setup.py sdist --formats tar* crashes if version is unicode
Éric Araujo mer...@netwok.org added the comment: since the issue only applies when sdist --format gztar, I mention that here. bztar will probably have the same issue. Also, issue8396 suggests encoding using sys.getfilesystemencoding(). Good one! -- title: python setup.py sdist crashes if version is unicode - python setup.py sdist --formats tar* crashes if version is unicode ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11638 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13249] argparse.ArgumentParser() lists arguments in the wrong order
Roy Smith r...@panix.com added the comment: New patch uploaded. The added recommendation is around line 161 (look for 'Recommended usage is to only use keyword arguments') -- Added file: http://bugs.python.org/file23667/Issue13249-2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13249 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13387] add exact_type argument to assertIsInstance
Michael Foord mich...@voidspace.org.uk added the comment: I think your proposed workaround is good enough and no extra effort to type than the suggested change to assertIsInstance. -1 on a new method I think the behaviour of isinstance is clear enough that people who misunderstand what assertIsInstance is doing have a problem with basic Python - and will continue to make the mistake whatever we do to assertIsInstance. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13387 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13387] add exact_type argument to assertIsInstance
Antoine Pitrou pit...@free.fr added the comment: I don't think there's a point in adding such an extra argument. Why don't you just write self.assertIs(type(myobj), sometype) ? How is the error message not good enough? -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13387 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13387] add exact_type argument to assertIsInstance
Eric Snow ericsnowcurren...@gmail.com added the comment: @msg147513 Why don't you just write self.assertIs(type(myobj), sometype) +1 -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13387 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13385] Add an explicit re.NOFLAGS flag value to the re module
Eli Bendersky eli...@gmail.com added the comment: I think we have enough 0 to reject the issue. Closing. -- resolution: - rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13385 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13329] Runs normal as console script but falls as CGI
Changes by Petri Lehtinen pe...@digip.org: -- status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13329 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12875] backport re.compile flags default value documentation
Eli Bendersky eli...@gmail.com added the comment: I have converted the Doc/library/re.rst doc of 2.7 to follow the new convention of 3.x, patch attached. -- keywords: +patch Added file: http://bugs.python.org/file23668/issue12875.1.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12875 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12767] document threading.Condition.notify
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 63a24bff6f36 by Eli Bendersky in branch '3.2': Issue #12767: documenting threading.Condition.notify http://hg.python.org/cpython/rev/63a24bff6f36 New changeset ac12dcea69e1 by Eli Bendersky in branch 'default': Issue 12767: document the argument of threading.Condition.notify http://hg.python.org/cpython/rev/ac12dcea69e1 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12767 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12767] document threading.Condition.notify
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 63a00d019bb2 by Eli Bendersky in branch '2.7': Closes issue 12767: document the argument of threading.Condition.notify http://hg.python.org/cpython/rev/63a00d019bb2 -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12767 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13239] Remove operator from Grammar/Grammar
Eli Bendersky eli...@gmail.com added the comment: Éric, do you feel strongly about the wording, or can I just go ahead and commit my version if I like it more :) ? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13239 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13388] document hg commit hooks in the devguide
New submission from Eli Bendersky eli...@gmail.com: Our Hg repo has some useful hooks on commit messages that allow to specify which issue to notify for commits, and which issue to close. AFAIU, it's currently documented only in the code of the hook (http://hg.python.org/hooks/file/tip/hgroundup.py). I think adding a short description into the devguide would be a good idea, probably here: http://docs.python.org/devguide/committing.html#commit-messages-and-news-entries +1d by Brett and Georg on pydev. I'll prepare a patch. -- assignee: eli.bendersky components: Devguide messages: 147520 nosy: brett.cannon, eli.bendersky, ezio.melotti, georg.brandl priority: normal severity: normal status: open title: document hg commit hooks in the devguide ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13388 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13386] Document documentation conventions for optional args
Eli Bendersky eli...@gmail.com added the comment: You should also explicitly specify what happens in several optional but not keyword args are needed. AFAIU the convention is: func(arg1, arg2[, opt1, opt2]) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13386 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13388] document hg commit hooks in the devguide
Eli Bendersky eli...@gmail.com added the comment: Attaching a patch with the suggested change. Based on the doc-string in the implementation of the hook. -- keywords: +patch Added file: http://bugs.python.org/file23669/issue13388.1.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13388 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13387] suggest assertIs(type(obj), cls) for exact type checking
Florent Xicluna florent.xicl...@gmail.com added the comment: +1 on a doc addition (I can even volunteer a patch) I agree we can highlight the difference between assertIs(type(obj), cls) and assertIsInstance(obj, cls) in the documentation. Let's forget this patch and keep it simple. -- assignee: - docs@python components: +Documentation nosy: +docs@python stage: - needs patch title: add exact_type argument to assertIsInstance - suggest assertIs(type(obj), cls) for exact type checking type: feature request - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13387 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13388] document hg commit hooks in the devguide
Petri Lehtinen pe...@digip.org added the comment: I'm not sure if it matters, but Sphinx documentation suggests using ^ as the underlining character for subsubsections. Otherwise, looks good. -- nosy: +petri.lehtinen ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13388 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13388] document hg commit hooks in the devguide
Eli Bendersky eli...@gmail.com added the comment: Petri, I have actually tried to stay consistent within the same document, and it uses ' for this level of heading. Perhaps it's just not following the Sphinx guide? IIRC the restructured text parser will also shout at you if these are inconsistent. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13388 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13388] document hg commit hooks in the devguide
Petri Lehtinen pe...@digip.org added the comment: Ah, sorry. I didn't check other files in the devguide. The ReST parser is OK with any underline character, as long as it's consistent within a single file. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13388 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11999] sporadic failure in test_mailbox
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset d2b0751174f6 by Petri Lehtinen in branch '2.7': Update mailbox.Maildir tests http://hg.python.org/cpython/rev/d2b0751174f6 New changeset b3c5e1c62839 by Petri Lehtinen in branch '3.2': Update mailbox.Maildir tests http://hg.python.org/cpython/rev/b3c5e1c62839 -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11999 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13264] Monkeypatching using metaclass
Daniel Urban urban.dani...@gmail.com added the comment: It seems to me this is not a bug. +1 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13264 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13374] Deprecate usage of the Windows ANSI API in the nt module
sbt shibt...@gmail.com added the comment: I notice that the patch changes rename() and link() to use win32_decode_filename() to coerce the filename to unicode before using the wide win32 api. (Previously, rename() first tried the wide api, falling back to narrow if that failed; link() used wide if the args were both unicode, narrow otherwise. Some other functions like symlink() already only use the wide api.) Is this approach of coercing to unicode and only using the wide api blessed? I certainly think it should be. If so then one can get rid lots windows specific code. And are we able to assume that on Windows we have access to wide libc functions? _wcsicmp(), _snwprintf(), _wputenv() are all used already, so I guess we already make that assumption. It looks like a lot of the windows specific code attempts to reimplement basic libc functions using the win32 api just to support unicode - presumably there was a time when we could not assume that wide libc functions would be available. Other functions like execv() and spawnv() were never given unicode support. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13374 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13389] Clear lists freelist in gc.collect()
New submission from Antoine Pitrou pit...@free.fr: Complete gc collections currently clear all freelists, except for the freelist of list objects. Attached patch fixes the omission. -- components: Interpreter Core files: listfreelist.patch keywords: patch messages: 147530 nosy: pitrou priority: normal severity: normal stage: patch review status: open title: Clear lists freelist in gc.collect() type: resource usage versions: Python 3.3 Added file: http://bugs.python.org/file23670/listfreelist.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13389 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13390] Hunt memory allocations in addition to reference leaks
New submission from Antoine Pitrou pit...@free.fr: This patch adds a counting of the number of allocated memory blocks (through the PyObject_Malloc API). Together with -R, it can help chase those memory leaks which aren't reference leaks (see c6dafa2e2594). The sys.getallocedblocks() function is also available in non-debug mode. This is meant to help 3rd party extension writers, who rarely have access to debug builds. To avoid too many false positives, issue13389 is a prerequisite (at least for the test -R part of the patch). Even after it, there are still a couple test -R failures; we'd have to investigate them. -- components: Interpreter Core, Tests files: debugblocks.patch keywords: patch messages: 147531 nosy: ncoghlan, pitrou, tim_one priority: normal severity: normal stage: patch review status: open title: Hunt memory allocations in addition to reference leaks type: resource usage versions: Python 3.3 Added file: http://bugs.python.org/file23671/debugblocks.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13390 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7732] imp.find_module crashes Python if there exists a directory named __init__.py
Antoine Pitrou pit...@free.fr added the comment: Victor, can you fix the test failures on Windows and 2.7? Otherwise the commit should be reverted. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7732 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13389] Clear lists freelist in gc.collect()
Antoine Pitrou pit...@free.fr added the comment: Dicts also have a freelist which isn't freed either. New patch attached. -- Added file: http://bugs.python.org/file23672/listdictfreelist.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13389 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13390] Hunt memory allocations in addition to reference leaks
Changes by Andreas Stührk andy-pyt...@hammerhartes.de: -- nosy: +Trundle ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13390 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13380] ctypes: add an internal function for reseting the ctypes caches
Antoine Pitrou pit...@free.fr added the comment: Two things: - you duplicated the part with CFUNCTYPE(c_int)(lambda: None) without removing the original chunk of code - some platforms can't compile ctypes, you must handle that case in regrtest Otherwise, good idea. -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13380 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13389] Clear lists freelist in gc.collect()
Antoine Pitrou pit...@free.fr added the comment: Fix the return values and add documentation. -- Added file: http://bugs.python.org/file23673/listdictfreelist.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13389 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13389] Clear lists and dicts freelist in gc.collect()
Changes by Antoine Pitrou pit...@free.fr: -- title: Clear lists freelist in gc.collect() - Clear lists and dicts freelist in gc.collect() ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13389 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13389] Clear lists and dicts freelist in gc.collect()
Changes by Antoine Pitrou pit...@free.fr: Removed file: http://bugs.python.org/file23672/listdictfreelist.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13389 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13385] Add an explicit re.NOFLAGS flag value to the re module
Raymond Hettinger raymond.hettin...@gmail.com added the comment: Thank you for closing this. I think it would only add clutter to a module that is already puts readers into information overload. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13385 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13374] Deprecate usage of the Windows ANSI API in the nt module
Martin v. Löwis mar...@v.loewis.de added the comment: Is this approach of coercing to unicode and only using the wide api blessed? It's not. If people use byte strings, they specifically ask for what they get; Python shouldn't second-guess the data types. I certainly think it should be. If so then one can get rid lots windows specific code. How so? This entire handling of file names is windows specific; dealing with different file name data types doesn't make it more windows specific than it already is. And are we able to assume that on Windows we have access to wide libc functions? Yes, but Python should avoid using them. _wcsicmp(), _snwprintf(), _wputenv() are all used already, so I guess we already make that assumption. It looks like a lot of the windows specific code attempts to reimplement basic libc functions using the win32 api just to support unicode - presumably there was a time when we could not assume that wide libc functions would be available. No: a) we try to get rid of MS libc as much as possible. Ideally, some future version of Python will not rely on libc at all for Windows. If Microsoft had chosen to make the C library a system API, this we would happily use it. Alas, they chose to make it an API of their compiler instead, so we really shouldn't use it. b) the wide libc functions assume a 16-bit wchar_t type. This is not a good match for Python's unicode data type, which readily supports 32-bit characters. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13374 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13391] string.strip Does Not Remove Zero-Width-Space (ZWSP)
New submission from Dave Mankoff man...@gmail.com: Title pretty much says it all. Simple test case: len(u' \t\r\n\u200B'.strip()) 1 Should be zero. Same problem in Python3: len(' \t\r\n\u200B'.strip()) 1 -- components: Unicode messages: 147538 nosy: ezio.melotti, mankyd priority: normal severity: normal status: open title: string.strip Does Not Remove Zero-Width-Space (ZWSP) type: behavior versions: Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13391 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13390] Hunt memory allocations in addition to reference leaks
Nick Coghlan ncogh...@gmail.com added the comment: I added some review comments to the patch, but I'm not sure how usable this is going to be in practice. References generally stay fairly stable while using the interactive interpreter, but the new block accounting jumps around all over the place due to the internal free lists (which *don't* count in for 'gettotalrefcounts', but *do* count in the new block accounting). The following interpreter session has both this patch and the #13389 patch applied: a = sys.getallocedblocks() [76652 refs, 21773 blocks] a 21779 [76652 refs, 21774 blocks] x = [None]*1 [76652 refs, 21776 blocks] del x [66650 refs, 21775 blocks] gc.collect(); gc.collect(); gc.collect() 0 0 0 [66650 refs, 21756 blocks] b = sys.getallocedblocks() [66652 refs, 21772 blocks] b - a -2 [66652 refs, 21772 blocks] So, generally +1 on the idea, but I think we should hide at least the initial implementation behind PY_REF_DEBUG until we're sure we've worked the kinks out of it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13390 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13392] Writing a pyc file is not atomic under Windows
New submission from Antoine Pitrou pit...@free.fr: #13146 solved the issue of writing pyc files under POSIX. Under Windows, the problem still exists, as the following buildbot failure shows: [317/360] test_multiprocessing Traceback (most recent call last): File string, line 1, in module File D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\multiprocessing\forking.py, line 373, in main prepare(preparation_data) File D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\multiprocessing\forking.py, line 499, in prepare '__parents_main__', file, path_name, etc File D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\regrtest.py, line 175, in module import packaging.command File D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\packaging\command\__init__.py, line 4, in module from packaging.util import resolve_name File D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\packaging\util.py, line 5, in module import csv EOFError: EOF read where not expected Traceback (most recent call last): File string, line 1, in module File D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\multiprocessing\forking.py, line 373, in main prepare(preparation_data) File D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\multiprocessing\forking.py, line 499, in prepare '__parents_main__', file, path_name, etc File D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\regrtest.py, line 175, in module import packaging.command File D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\packaging\command\__init__.py, line 4, in module from packaging.util import resolve_name File D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\packaging\util.py, line 5, in module import csv EOFError: EOF read where not expected [etc.] (from http://www.python.org/dev/buildbot/all/builders/x86%20XP-4%203.x/builds/5551/steps/test/logs/stdio) Attached patch uses MoveFileEx to perform a (hopefully atomic) rename from a temporary file when creating the pyc file. The same strategy cannot be created for importlib since MoveFileEx isn't exposed at the Python level (we could delete the tmp file if renaming fails, though; it simply means another process beat us to it, which shouldn't be a problem here). -- components: Interpreter Core files: winimport.patch keywords: patch messages: 147540 nosy: brett.cannon, haypo, ncoghlan, neologix, pitrou, python-dev, r.david.murray priority: normal severity: normal stage: patch review status: open title: Writing a pyc file is not atomic under Windows versions: Python 3.3 Added file: http://bugs.python.org/file23674/winimport.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13391] string.strip Does Not Remove Zero-Width-Space (ZWSP)
Changes by Antoine Pitrou pit...@free.fr: -- versions: +Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13391 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13281] Make robotparser.RobotFileParser ignore blank lines
Terry J. Reedy tjre...@udel.edu added the comment: My suggested doc change is how to change the doc along with the patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13281 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13346] re.split() should behave like string.split() for maxsplit=0 and maxsplit=-1
Terry J. Reedy tjre...@udel.edu added the comment: The two methods are defined differently, and act as defined, so this is a feature request, not a bug report. str.split([sep[, maxsplit]]) ... If maxsplit is given, at most maxsplit splits are done (thus, the list will have at most maxsplit+1 elements). If maxsplit is not specified, then there is no limit on the number of splits (all possible splits are made). re.split(pattern, string, maxsplit=0, flags=0) ...If maxsplit is nonzero, at most maxsplit splits occur, Clearly, if maxsplit for re.split is the default of 0, it must do all splits. There is a difference between being optional with no default (possible with C-coded functions) and with a default. Logically, both should have a default of None, meaning no limit. But I agree with Ezio and do not see that happening for Python 3. As for negative values, I would have maxsplit treated as a count and make negative values a ValueError. -- nosy: +terry.reedy status: open - closed type: behavior - feature request versions: -Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13346 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12875] backport re.compile flags default value documentation
Raymond Hettinger raymond.hettin...@gmail.com added the comment: This patch looks fine. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12875 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12875] backport re.compile flags default value documentation
Ezio Melotti ezio.melo...@gmail.com added the comment: LGTM -- stage: - commit review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12875 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com