Re: [Python-Dev] Emit SyntaxWarning on unrecognized backslash escapes?

2015-02-24 Thread Chris Angelico
On Wed, Feb 25, 2015 at 5:00 PM, Ben Finney wrote: > There is a wider context here, too: semantics of the backslash escape > https://en.wikipedia.org/wiki/Backslash#Usage> commonly include > “backslash followed by a character not otherwise mentioned will produce > that character, verbatim”. > > Pr

Re: [Python-Dev] Emit SyntaxWarning on unrecognized backslash escapes?

2015-02-24 Thread Stephen J. Turnbull
Nick Coghlan writes: > The linter developers don't have a decision making process that lets them > pursue things like this on their own. I'm not suggesting that the linter developers do any such thing. I'm suggesting that users (specifically Chris) customize their preferred linters (most permi

Re: [Python-Dev] how to inspect if something includes a bound first param

2015-02-24 Thread Terry Reedy
On 2/24/2015 9:02 PM, Eric V. Smith wrote: I'm not sure if it's correct, but deep in a library of mine I have: elif type(fn) == types.MethodType: # bound method? if fn.im_self is None: # no 'self' nskip = 0 else: # need to supply 'self' nskip = 1

Re: [Python-Dev] how to inspect if something includes a bound first param

2015-02-24 Thread Terry Reedy
On 2/24/2015 8:56 PM, Gregory P. Smith wrote: inspect.getargspec(method) and inspect.signature(method) both include the 'self' parameter but how are we to figure out from method itself that it is actually bound and that its first parameter is expected to be a bound instance? This seems like a p

Re: [Python-Dev] how to inspect if something includes a bound first param

2015-02-24 Thread Eric V. Smith
On 2/24/2015 8:56 PM, Gregory P. Smith wrote: > inspect.getargspec(method) and inspect.signature(method) both include > the 'self' parameter but how are we to figure out from method itself > that it is actually bound and that its first parameter is expected to be > a bound instance? > > So far I'v

[Python-Dev] how to inspect if something includes a bound first param

2015-02-24 Thread Gregory P. Smith
inspect.getargspec(method) and inspect.signature(method) both include the 'self' parameter but how are we to figure out from method itself that it is actually bound and that its first parameter is expected to be a bound instance? So far I've come up with: *inspect.ismethod(method) or inspect.isme

Re: [Python-Dev] ?s re documentation of Python features

2015-02-24 Thread Ryan Gonzalez
Ask on python-list . Also check out the FAQ and the Help page . Not sure what your problem is; Python is EXTREMELY well documented. On Tue, Feb 24, 2015 at 7:15 PM,

[Python-Dev] ?s re documentation of Python features

2015-02-24 Thread GARRY M CRANE
I am trying to learn Python for use in computational biology. I am using the interesting book: "Computing for Biologists; Python Programming and Principles" (by Ran Libeskind-Hadas and Eliot Bush). It has an interesting and useful set of programming exercises at www.cs.hmc.edu/CFB. I am actua

Re: [Python-Dev] easy_install ?

2015-02-24 Thread Daniel Holth
The other option might be to use http://bitbucket.org/dholth/setup-requires It uses pip to install requirements into an isolated directory before setup.py runs, with pip, doing exactly what you requested. On Feb 24, 2015 5:44 PM, "Nick Coghlan" wrote: > > On 25 Feb 2015 07:23, "Alexander Belopol

Re: [Python-Dev] getstatusoutput()'s behavior changed in 3.3.4 and 3.4

2015-02-24 Thread Victor Stinner
Hi, It looks like new tests are required to check that the behaviour will not change again. Victor Le mardi 24 février 2015, Gregory P. Smith a écrit : > While porting some code from 2.7 to 3.4 I discovered that > command.getstatusoutput() (renamed to subprocess.getstatusoutput() in 3.x) > had

Re: [Python-Dev] Request for Pronouncement: PEP 441 - Improving Python ZIP Application Support

2015-02-24 Thread Guido van Rossum
Maybe just fail if the target name already exists? On Tue, Feb 24, 2015 at 12:51 PM, Paul Moore wrote: > On 24 February 2015 at 20:32, Barry Warsaw wrote: > >>To modify an archive could be done using > >> > >>python -m zipapp old.pyz new.pyz [-p interpreter] > >> > >>Default is to strip the

Re: [Python-Dev] Request for Pronouncement: PEP 441 - Improving Python ZIP Application Support

2015-02-24 Thread Nick Coghlan
On 25 Feb 2015 06:52, "Paul Moore" wrote: > > On 24 February 2015 at 20:32, Barry Warsaw wrote: > >>To modify an archive could be done using > >> > >>python -m zipapp old.pyz new.pyz [-p interpreter] > >> > >>Default is to strip the shebang (no -p option). There's no option to > >>omit the ta

Re: [Python-Dev] Emit SyntaxWarning on unrecognized backslash escapes?

2015-02-24 Thread Chris Angelico
On Wed, Feb 25, 2015 at 6:54 AM, Greg Ewing wrote: > Chris Angelico wrote: >> >> Then he changed the code over to use his >> own file instead of the provided sample, and at the same time, >> switched from using open() to using csv.reader(open()), and moved all >> the code into a function, and fixe

Re: [Python-Dev] easy_install ?

2015-02-24 Thread Nick Coghlan
On 25 Feb 2015 07:23, "Alexander Belopolsky" wrote: > > > On Tue, Feb 24, 2015 at 2:03 PM, Daniel Holth wrote: > > > > > Is there a recommended way to invoke pip from setup.py? When I specify > > > "tests_require=" and run "python setup.py test", the requirements get > > > installed using setupt

Re: [Python-Dev] getstatusoutput()'s behavior changed in 3.3.4 and 3.4

2015-02-24 Thread Nick Coghlan
Documentation (and adding the missing test) sounds right to me. We'd at least want a "versionchanged" note on the function itself, and an entry in the porting section of the (3.3? 3.4?) what's new guide. Is there anywhere else we might want to mention it? Regards, Nick. _

Re: [Python-Dev] Emit SyntaxWarning on unrecognized backslash escapes?

2015-02-24 Thread Ethan Furman
On 02/24/2015 01:35 PM, Guido van Rossum wrote: > Actually, I wasn't proposing to change repr() -- my sentiments are similar > to Isaac Morland's. Only the error message for the most basic file open() > call should be tweaked. As are mine -- I just like to be thorough when discussing possibilitie

Re: [Python-Dev] Request for Pronouncement: PEP 441 - Improving Python ZIP Application Support

2015-02-24 Thread Paul Moore
On 24 February 2015 at 21:09, Ethan Furman wrote: > Another way to support this is with subcommands. Have the default [implicit] > command be to create the zip app, and then > add any subcommands we need: > > python -m zipapp [create] foo #creates a foo.pyz from the foo directory > > pytho

Re: [Python-Dev] Emit SyntaxWarning on unrecognized backslash escapes?

2015-02-24 Thread Guido van Rossum
[Adding back python-dev] Actually, I wasn't proposing to change repr() -- my sentiments are similar to Isaac Morland's. Only the error message for the most basic file open() call should be tweaked. No solution is perfect -- but it's probably common enough for someone to create a file or folder na

Re: [Python-Dev] easy_install ?

2015-02-24 Thread Alexander Belopolsky
On Tue, Feb 24, 2015 at 4:24 PM, Daniel Holth wrote: > > That might mostly do what you want, since tox could install any > additional test requirements based on its configuration. Does "that" refer to using tests_require=['tox'] as I described below? This means using easy_install implicitly and

Re: [Python-Dev] easy_install ?

2015-02-24 Thread Daniel Holth
That might mostly do what you want, since tox could install any additional test requirements based on its configuration. On Tue, Feb 24, 2015 at 4:21 PM, Alexander Belopolsky wrote: > > On Tue, Feb 24, 2015 at 2:03 PM, Daniel Holth wrote: >> >> > Is there a recommended way to invoke pip from set

Re: [Python-Dev] Emit SyntaxWarning on unrecognized backslash escapes?

2015-02-24 Thread Isaac Morland
On Tue, 24 Feb 2015, Ethan Furman wrote: On 02/24/2015 10:49 AM, Guido van Rossum wrote: On Tue, Feb 24, 2015 at 10:47 AM, Ethan Furman wrote: I can attest from my impoverished Windows programming days that looking at --> os.listdir('c:\temp') SomeErrorMessage about syntax 'c:\temp' is

Re: [Python-Dev] Request for Pronouncement: PEP 441 - Improving Python ZIP Application Support

2015-02-24 Thread Ethan Furman
On 02/24/2015 01:00 PM, Ethan Furman wrote: > On 02/24/2015 12:51 PM, Paul Moore wrote: >> $ python -m zipapp foo.pyz --info >> Interpreter: /usr/bin/python >> $ python -m zipapp bar.pyz --info >> Interpreter: Another way to support this is with subcommands. Have the default [implicit] command

Re: [Python-Dev] Request for Pronouncement: PEP 441 - Improving Python ZIP Application Support

2015-02-24 Thread Brett Cannon
On Tue Feb 24 2015 at 3:21:30 PM Paul Moore wrote: > On 24 February 2015 at 18:58, Guido van Rossum wrote: > > Why no command-line equivalent for the other two methods? I propose the > > following interface: if there's only one positional argument, we're > asking > > to print its shebang line;

Re: [Python-Dev] Request for Pronouncement: PEP 441 - Improving Python ZIP Application Support

2015-02-24 Thread Barry Warsaw
On Feb 24, 2015, at 08:20 PM, Paul Moore wrote: >(side note: --python/-p or --interpreter/-i?) and set the entry point, Both virtualenv and (I think) pex use --python/-p so that seems to be the overwhelming trend . >To modify an archive could be done using > >python -m zipapp old.pyz new.pyz

Re: [Python-Dev] Emit SyntaxWarning on unrecognized backslash escapes?

2015-02-24 Thread Terry Reedy
On 2/24/2015 1:14 PM, Guido van Rossum wrote: And I'd weigh the needs of users who know what they are doing somewhat higher than educating newbies through error messages. While newbies are most likely to try out open() with a string literal, in "real" programs that is rare, and filenames are typ

Re: [Python-Dev] Emit SyntaxWarning on unrecognized backslash escapes?

2015-02-24 Thread Greg Ewing
Thomas Wouters wrote: Trying to make the error messages more similar, or more identifying, may be a good idea (as long as they aren't misleading when people *meant* to use escape sequences in a string) It seems that Windows won't let you use control characters in filenames, so there is room f

Re: [Python-Dev] Emit SyntaxWarning on unrecognized backslash escapes?

2015-02-24 Thread Greg Ewing
Chris Angelico wrote: Then he changed the code over to use his own file instead of the provided sample, and at the same time, switched from using open() to using csv.reader(open()), and moved all the code into a function, and fixed three other bugs, and now it isn't working. And he can't figure o

[Python-Dev] getstatusoutput()'s behavior changed in 3.3.4 and 3.4

2015-02-24 Thread Gregory P. Smith
While porting some code from 2.7 to 3.4 I discovered that command.getstatusoutput() (renamed to subprocess.getstatusoutput() in 3.x) had changed. Surprise! The code was working under an earlier version of 3.3 but broke when I ran it on 3.4. Nowhere was this documented that I could find. Tracking

Re: [Python-Dev] str(IntEnum)

2015-02-24 Thread Demian Brecht
> On Feb 24, 2015, at 10:56 AM, Guido van Rossum wrote: > It sure seems that way. Thanks for the additional feedback Guido. I’d spent some further time thinking about what it was that I was looking for and determined it was bollocks. The proposal was a poor solution to a specific immediate pro

[Python-Dev] Fwd: Request for Pronouncement: PEP 441 - Improving Python ZIP Application Support

2015-02-24 Thread Guido van Rossum
[Sorry, accidentally dropped the list from this message.] Here's my review. I really like where this is going but I have a few questions and suggestions (I can't help myself :-). [I sneaked a peek at the update you sent to p...@python.org.] "Currently, pyyzer [5] and pex [6] are two tools known

Re: [Python-Dev] easy_install ?

2015-02-24 Thread Daniel Holth
On Tue, Feb 24, 2015 at 1:31 PM, Alexander Belopolsky wrote: > > On Tue, Feb 24, 2015 at 11:44 AM, Paul Moore wrote: >> >> And if pip won't work, it would be good to >> know why. > > > Is there a recommended way to invoke pip from setup.py? When I specify > "tests_require=" and run "python setup

Re: [Python-Dev] Request for Pronouncement: PEP 441 - Improving Python ZIP Application Support

2015-02-24 Thread Guido van Rossum
On Tue, Feb 24, 2015 at 10:50 AM, Paul Moore wrote: > On 24 February 2015 at 18:24, Guido van Rossum wrote: > > Here's my review. I really like where this is going but I have a few > > questions and suggestions (I can't help myself :-). > > Thanks. > > > [I sneaked a peek at the update you sent

Re: [Python-Dev] str(IntEnum)

2015-02-24 Thread Guido van Rossum
On Sat, Feb 21, 2015 at 8:39 AM, Demian Brecht wrote: > > > > On Feb 20, 2015, at 7:03 PM, Ian Cordasco > wrote: > > I hope this helps. > > It does, as do the other replies, thanks all. To be clear, my first gripe > has stemmed into two related (but very minor) problems: > > 1. IntEnum.__str__.

Re: [Python-Dev] Emit SyntaxWarning on unrecognized backslash escapes?

2015-02-24 Thread Ethan Furman
On 02/24/2015 10:14 AM, Guido van Rossum wrote: > This is about messages from failing file-open operations if the filename > contains an escaped character? I'd go slow > there too: here are a lot of places where files are opened and messages are > printed, both in the C code and in the > stdlib.

Re: [Python-Dev] Emit SyntaxWarning on unrecognized backslash escapes?

2015-02-24 Thread Guido van Rossum
I like the \x07 solution. On Tue, Feb 24, 2015 at 10:47 AM, Ethan Furman wrote: > On 02/24/2015 10:14 AM, Guido van Rossum wrote: > > > This is about messages from failing file-open operations if the filename > contains an escaped character? I'd go slow > > there too: here are a lot of places wh

Re: [Python-Dev] Emit SyntaxWarning on unrecognized backslash escapes?

2015-02-24 Thread Guido van Rossum
On Tue, Feb 24, 2015 at 10:00 AM, Ethan Furman wrote: > On 02/24/2015 09:44 AM, Guido van Rossum wrote: > > > > TBH I think this will be a tough sell. I worry that an meme will emerge > to make all > > string literals use raw mode, or worse, to deprecate non-raw string > literals. I'm > > not sur

Re: [Python-Dev] Emit SyntaxWarning on unrecognized backslash escapes?

2015-02-24 Thread Ethan Furman
On 02/24/2015 09:44 AM, Guido van Rossum wrote: > > TBH I think this will be a tough sell. I worry that an meme will emerge to > make all > string literals use raw mode, or worse, to deprecate non-raw string literals. > I'm > not sure how we'll get out of the whole conundrum, and I'm not in a hur

Re: [Python-Dev] Request for Pronouncement: PEP 441 - Improving Python ZIP Application Support

2015-02-24 Thread Paul Moore
On 24 February 2015 at 17:46, Guido van Rossum wrote: > I can do it but I don't want to be reviewing and accepting a PEP that's > still under discussion, and I don't have the bandwidth to follow the > discussion here -- I can only read the PEP. I will start that now. I'm just about to push an upd

Re: [Python-Dev] Emit SyntaxWarning on unrecognized backslash escapes?

2015-02-24 Thread Ethan Furman
On 02/24/2015 09:18 AM, Thomas Wouters wrote: > On Tue, Feb 24, 2015 at 5:37 PM, Ethan Furman wrote: >> >> - M.A.Lemburg's idea of changing the exception message in key places to >> make a successful >>backslash replace obvious >>(FileNotFoundError: [Errno 2] No such file or directory: 'c

Re: [Python-Dev] Emit SyntaxWarning on unrecognized backslash escapes?

2015-02-24 Thread Guido van Rossum
TBH I think this will be a tough sell. I worry that an meme will emerge to make all string literals use raw mode, or worse, to deprecate non-raw string literals. I'm not sure how we'll get out of the whole conundrum, and I'm not in a hurry to see this in 3.5. -- --Guido van Rossum (python.org/~gu

Re: [Python-Dev] easy_install ?

2015-02-24 Thread Laura Creighton
In a message of Tue, 24 Feb 2015 16:44:20 +, Paul Moore writes: >On 24 February 2015 at 16:30, Brett Cannon wrote: >> Tell people to use pip. Having ensurepip in Python 2.7 and 3.4 makes it as >> official as anything will be as the recommended tool to install projects. >> Otherwise easy_instal

Re: [Python-Dev] easy_install ?

2015-02-24 Thread Ethan Furman
On 02/24/2015 08:44 AM, Paul Moore wrote: > On 24 February 2015 at 16:30, Brett Cannon wrote: >> >> Tell people to use pip. Having ensurepip in Python 2.7 and 3.4 makes it as >> official as anything will be as the recommended tool to install projects. >> Otherwise easy_install has nothing to do dir

Re: [Python-Dev] easy_install ?

2015-02-24 Thread Paul Moore
On 24 February 2015 at 16:30, Brett Cannon wrote: > Tell people to use pip. Having ensurepip in Python 2.7 and 3.4 makes it as > official as anything will be as the recommended tool to install projects. > Otherwise easy_install has nothing to do directly with python-dev so I don't > think we can c

Re: [Python-Dev] easy_install ?

2015-02-24 Thread Brett Cannon
On Tue Feb 24 2015 at 10:54:14 AM Laura Creighton wrote: > Hello all, > I wonder what the status of easy_install is. I keep finding people > who needed to install something 'path.py' is the latest, who needed to > use pip, and couldn't get easy_install to work. Should we tell people > that easy

[Python-Dev] easy_install ?

2015-02-24 Thread Laura Creighton
Hello all, I wonder what the status of easy_install is. I keep finding people who needed to install something 'path.py' is the latest, who needed to use pip, and couldn't get easy_install to work. Should we tell people that easy_install is deprecated, or ask them to file bugs when they could not

Re: [Python-Dev] Emit SyntaxWarning on unrecognized backslash escapes?

2015-02-24 Thread Stephen J. Turnbull
Chris Angelico writes: > I don't mind how long the deprecation period is, as long as there can > be an option to Python that makes a noisy warning. If that's OK with you and for the use case you explicitly described, though, a .bat file that runs a linter first might be the better option since

Re: [Python-Dev] Emit SyntaxWarning on unrecognized backslash escapes?

2015-02-24 Thread Joao S. O. Bueno
On 23 February 2015 at 18:39, Greg Ewing wrote: > Serhiy Storchaka wrote: >> >> The problem is that the user don't know that he should read the >> documentation. It just find that his script works with "C:\sample.txt", but >> doesn't work with "D:\test.txt". He has no ideas what happen. > > > Even

Re: [Python-Dev] Emit SyntaxWarning on unrecognized backslash escapes?

2015-02-24 Thread Chris Angelico
On Tue, Feb 24, 2015 at 7:40 PM, M.-A. Lemburg wrote: > I think the easiest way would be to tweak the error message > output to indicate the real problem. > > At the moment, you get: > open('c:\test.txt') > Traceback (most recent call last): > File "", line 1, in > FileNotFoundError: [Errn

Re: [Python-Dev] Request for Pronouncement: PEP 441 - Improving Python ZIP Application Support

2015-02-24 Thread Nick Coghlan
On 24 February 2015 at 06:32, Paul Moore wrote: > On 23 February 2015 at 19:47, Guido van Rossum wrote: >> So is the PEP ready for pronouncement or should there be more discussion? > > I think Brett's idea is worth incorporating, so let's thrash that out first. > >> Also, do you have a BDFL-deleg