Re: PEP suggestion: Uniform way to indicate Python language version

2016-09-09 Thread Steve D'Aprano
On Tue, 23 Aug 2016 12:29 am, Random832 wrote: > Receiving a SyntaxError or whatever other exception, which provides no > suggestion about how to actually fix the issue (install a later version > of python / run with "python3" instead of "python"), is a bad user > experience. Er wot? If I run th

Re: PEP suggestion: Uniform way to indicate Python language version

2016-09-09 Thread Lawrence D’Oliveiro
On Tuesday, August 23, 2016 at 2:30:10 AM UTC+12, Random832 wrote: > Receiving a SyntaxError or whatever other exception, which provides no > suggestion about how to actually fix the issue (install a later version > of python / run with "python3" instead of "python"), is a bad user > experience. W

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-22 Thread Chris Angelico
On Tue, Aug 23, 2016 at 12:29 AM, Random832 wrote: > On Mon, Aug 22, 2016, at 09:21, Steve D'Aprano wrote: >> Rather, you just use the features you rely on, document the minimum >> supported version, and if somebody is silly enough to try running your >> code >> under Python 1.4, they'll get a Syn

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-22 Thread Random832
On Mon, Aug 22, 2016, at 09:21, Steve D'Aprano wrote: > Rather, you just use the features you rely on, document the minimum > supported version, and if somebody is silly enough to try running your > code > under Python 1.4, they'll get a SyntaxError or an exception when you try > to > do something

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-22 Thread Steve D'Aprano
On Mon, 22 Aug 2016 10:52 pm, Random832 wrote: > On Mon, Aug 22, 2016, at 08:44, Chris Angelico wrote: >> However, I don't think it's particularly necessary. Explicit version >> number checks should be very rare, and shouldn't be encouraged. >> Instead, encourage feature checks, as Steve gave some

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-22 Thread Rustom Mody
On Monday, August 22, 2016 at 7:00:36 PM UTC+5:30, Steve D'Aprano wrote: > Realistically, by the time you convince people this is a useful feature, > write a patch and have the patch reviewed, you'll be looking at Python 3.7. > So 3.7 will have this new syntax "use version", and *no other version*.

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-22 Thread Steve D'Aprano
On Mon, 22 Aug 2016 08:32 pm, rocky wrote: > On Monday, August 22, 2016 at 1:36:07 AM UTC-4, Steven D'Aprano wrote: [...] >> But... I don't understand what this proposal actually is. We already have >> a uniform way to indicate the Python language version: check sys.version, >> or sys.version_info

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-22 Thread Marko Rauhamaa
Random832 : > The problem is when you want to write a large body of code that just > *uses* lots of features (including syntactic features), *without* > checking for them. Ordinarily, that's the job of package management. The installer will perform the necessary checks for you. Marko -- https:/

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-22 Thread rocky
On Monday, August 22, 2016 at 8:45:05 AM UTC-4, Chris Angelico wrote: > On Mon, Aug 22, 2016 at 10:05 PM, Marko Rauhamaa wrote: > > rocky : > > > >> A slightly different but related problem is noting the Python dialect > >> at the package-level. > > > > I don't know what if anything is needed supp

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-22 Thread Random832
On Mon, Aug 22, 2016, at 08:44, Chris Angelico wrote: > However, I don't think it's particularly necessary. Explicit version > number checks should be very rare, and shouldn't be encouraged. > Instead, encourage feature checks, as Steve gave some examples of. The problem is when you want to write

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-22 Thread rocky
On Monday, August 22, 2016 at 8:05:15 AM UTC-4, Marko Rauhamaa wrote: > rocky : > > > A slightly different but related problem is noting the Python dialect > > at the package-level. > > I don't know what if anything is needed support this idea, but one > option would be to just use "import": > >

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-22 Thread Chris Angelico
On Mon, Aug 22, 2016 at 10:05 PM, Marko Rauhamaa wrote: > rocky : > >> A slightly different but related problem is noting the Python dialect >> at the package-level. > > I don't know what if anything is needed support this idea, but one > option would be to just use "import": > > import python

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-22 Thread Marko Rauhamaa
rocky : > A slightly different but related problem is noting the Python dialect > at the package-level. I don't know what if anything is needed support this idea, but one option would be to just use "import": import python3_5_17 That would require Python and modules to install such empty mo

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-22 Thread rocky
On Monday, August 22, 2016 at 12:33:53 AM UTC-4, Chris Angelico wrote: > On Mon, Aug 22, 2016 at 1:37 PM, rocky wrote: > > Sorry should have been: > > > > assert sys.version_info >= (3,0) > > The next question is: How common is code like this? I don't put > version checks in any of my modules. A

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-22 Thread rocky
On Monday, August 22, 2016 at 6:44:43 AM UTC-4, Rustom Mody wrote: > On Monday, August 22, 2016 at 3:53:27 PM UTC+5:30, rocky wrote: > > On Monday, August 22, 2016 at 2:04:39 AM UTC-4, Random832 wrote: > > > On Mon, Aug 22, 2016, at 01:35, Steven D'Aprano wrote: > > > > Could somebody (the OP?) ple

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-22 Thread Rustom Mody
On Monday, August 22, 2016 at 3:53:27 PM UTC+5:30, rocky wrote: > On Monday, August 22, 2016 at 2:04:39 AM UTC-4, Random832 wrote: > > On Mon, Aug 22, 2016, at 01:35, Steven D'Aprano wrote: > > > Could somebody (the OP?) please explain what is the purpose of this > > > proposal, what it does, how i

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-22 Thread rocky
On Monday, August 22, 2016 at 1:36:07 AM UTC-4, Steven D'Aprano wrote: > On Monday 22 August 2016 14:33, Chris Angelico wrote: > > > On Mon, Aug 22, 2016 at 1:37 PM, rocky wrote: > >> Sorry should have been: > >> > >> assert sys.version_info >= (3,0) > > > > The next question is: How common is

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-22 Thread rocky
On Monday, August 22, 2016 at 2:04:39 AM UTC-4, Random832 wrote: > On Mon, Aug 22, 2016, at 01:35, Steven D'Aprano wrote: > > Could somebody (the OP?) please explain what is the purpose of this > > proposal, what it does, how it works, and when would people use it? > > I think what he wants is a w

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-21 Thread Steven D'Aprano
On Monday 22 August 2016 16:03, Stefan Behnel wrote: > Steven D'Aprano schrieb am 22.08.2016 um 07:35: >> if sys.version < '3': >> import mymodule2 as mymodule >> else: >> import mymodule3 as mymodule > > This condition is going to fail when Python 30.0 comes out. That will be sometime

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-21 Thread Chris Angelico
On Mon, Aug 22, 2016 at 3:35 PM, Steven D'Aprano wrote: > Could somebody (the OP?) please explain what is the purpose of this proposal, > what it does, how it works, and when would people use it? My theory: A directive is actually parsed by the compiler, not executed at run-time. So you could hav

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-21 Thread Stefan Behnel
Stefan Behnel schrieb am 22.08.2016 um 08:03: > Steven D'Aprano schrieb am 22.08.2016 um 07:35: >> if sys.version < '3': >> import mymodule2 as mymodule >> else: >> import mymodule3 as mymodule > > This condition is going to fail when Python 30.0 comes out. Oh, sorry - make that Python 10

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-21 Thread Random832
On Mon, Aug 22, 2016, at 02:03, Stefan Behnel wrote: > Steven D'Aprano schrieb am 22.08.2016 um 07:35: > > if sys.version < '3': > > import mymodule2 as mymodule > > else: > > import mymodule3 as mymodule > > This condition is going to fail when Python 30.0 comes out. Er, won't it rather

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-21 Thread Random832
On Mon, Aug 22, 2016, at 01:35, Steven D'Aprano wrote: > Could somebody (the OP?) please explain what is the purpose of this > proposal, what it does, how it works, and when would people use it? I think what he wants is a way for a module which uses features (syntactic or otherwise, but I suppose

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-21 Thread Stefan Behnel
Steven D'Aprano schrieb am 22.08.2016 um 07:35: > if sys.version < '3': > import mymodule2 as mymodule > else: > import mymodule3 as mymodule This condition is going to fail when Python 30.0 comes out. Stefan -- https://mail.python.org/mailman/listinfo/python-list

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-21 Thread Steven D'Aprano
On Monday 22 August 2016 14:33, Chris Angelico wrote: > On Mon, Aug 22, 2016 at 1:37 PM, rocky wrote: >> Sorry should have been: >> >> assert sys.version_info >= (3,0) > > The next question is: How common is code like this? I don't put > version checks in any of my modules. Adding magic comment

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-21 Thread Chris Angelico
On Mon, Aug 22, 2016 at 1:37 PM, rocky wrote: > Sorry should have been: > > assert sys.version_info >= (3,0) The next question is: How common is code like this? I don't put version checks in any of my modules. Adding magic comments would be of value only if this sort of thing is common enough to

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-21 Thread rocky
Sorry should have been: assert sys.version_info >= (3,0) On Sunday, August 21, 2016 at 11:30:11 PM UTC-4, Ben Finney wrote: > rocky writes: > > > The assertion should have been > > > > assert sys.version >= (3, 0) > > Perhaps you haven't tried any of these examples before presenting th

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-21 Thread Ben Finney
rocky writes: > The assertion should have been > > assert sys.version >= (3, 0) Perhaps you haven't tried any of these examples before presenting them? >>> import sys >>> assert sys.version >= (3, 0) Traceback (most recent call last): File "", line 1, in TypeError: uno

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-21 Thread rocky
The assertion should have been assert sys.version >= (3, 0) If we want to indicate the Python program supports language versions 3.0 and greater. On Sunday, August 21, 2016 at 3:59:48 PM UTC-4, Vincent Vande Vyvre wrote: > Le 21/08/2016 à 20:28, rocky a écrit : > > The problem: > > > > 1. th

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-21 Thread Vincent Vande Vyvre
Le 21/08/2016 à 20:28, rocky a écrit : The problem: 1. there are various code inspection tools that parse Python programs looking for style issues or whatnot. The deeper ones have to do a full parse of the python program. It would be helpful if there were a uniform way to indicate the Python

PEP suggestion: Uniform way to indicate Python language version

2016-08-21 Thread rocky
The problem: 1. there are various code inspection tools that parse Python programs looking for style issues or whatnot. The deeper ones have to do a full parse of the python program. It would be helpful if there were a uniform way to indicate the Python language level used in Python source code