Re: [Python-Dev] Should PEP 498 specify if rf'...' is valid?

2015-10-26 Thread Nick Coghlan
On 22 October 2015 at 19:12, Eric V. Smith  wrote:
> On 10/22/2015 1:09 PM, Ryan Gonzalez wrote:
>> But it'd be weird now if fR worked but fbR didn't.
>
> Or bR (which is currently allowed) but not fbR in the future.

My own objection isn't to allowing "fR" or "fbR", it's to allowing the
uppercase "F".

I also don't understand why we can't say "if 'f' is part of a string
prefix, it must be first".

That would mean we kept the current 14 combinations:

['B', 'BR', 'Br', 'R', 'RB', 'Rb', 'U', 'b', 'bR', 'br', 'r',
'rB', 'rb', 'u']

And added only 13 more possibilities, being a lowercase 'f' prefix on
its own, and as a prefix for the various b/r combinations:

['fB', 'fBR', 'fBr', 'fR', 'fRB', 'fRb', 'fb', 'fbR', 'fbr', 'fr',
'frB', 'frb']

I don't think it would ever be worth the compatibility break to
require lowercase for 'rbu', or to enforce a particular relative order
(although those could be good pylint rules, if they aren't already),
but there's no such restrictions for the new 'f' prefix.

Regards,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Where is defined the grammar of Python?

2015-10-26 Thread Nick Coghlan
On 24 October 2015 at 15:53, Stéphane Wirtel  wrote:
> Hi all,
>
> Just to understand, we have the Parser/Python.asdl and Grammar/Grammar files.
>
> Which one is used for the AST ?
>
> I would like to understand this part of Python, could you help me?

An overview of all the moving parts is at
https://docs.python.org/devguide/grammar.html

A more detailed description of the compiler toolchain in CPython is at
https://docs.python.org/devguide/compiler.html

Cheers,
Nick.

>
> Thank you
>
> Stéphane
>
> --
> Stéphane Wirtel - http://wirtel.be - @matrixise
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com
>



-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Should PEP 498 specify if rf'...' is valid?

2015-10-26 Thread Ethan Furman

On 10/23/2015 08:20 AM, Nick Coghlan wrote:

On 22 October 2015 at 19:12, Eric V. Smith wrote:

On 10/22/2015 1:09 PM, Ryan Gonzalez wrote:



But it'd be weird now if fR worked but fbR didn't.


Or bR (which is currently allowed) but not fbR in the future.



My own objection isn't to allowing "fR" or "fbR", it's to allowing the
uppercase "F".

I also don't understand why we can't say "if 'f' is part of a string
prefix, it must be first".


Sometimes order matters, and sometimes it does not.  If the order does 
not have an impact on the final code, it does not matter, and making us 
have to remember an order that does not matter is a waste.


--
~Ethan~
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Where is defined the grammar of Python?

2015-10-26 Thread Brett Cannon
On Sun, 25 Oct 2015 at 19:51 Stéphane Wirtel  wrote:

> Hi all,
>
> Just to understand, we have the Parser/Python.asdl and Grammar/Grammar
> files.
>
> Which one is used for the AST ?
>
> I would like to understand this part of Python, could you help me?
>
>
See https://docs.python.org/devguide/grammar.html and
https://docs.python.org/devguide/compiler.html
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Should PEP 498 specify if rf'...' is valid?

2015-10-26 Thread Sven R. Kunze

On 26.10.2015 16:22, Ethan Furman wrote:

On 10/23/2015 08:20 AM, Nick Coghlan wrote:

My own objection isn't to allowing "fR" or "fbR", it's to allowing the
uppercase "F".

I also don't understand why we can't say "if 'f' is part of a string
prefix, it must be first".


Sometimes order matters, and sometimes it does not.  If the order does 
not have an impact on the final code, it does not matter, and making 
us have to remember an order that does not matter is a waste.


Order that matters? You must be kidding. That would turn different types 
of string extremely hard to understand because semantics differ.


That is, btw., one reason, why I favor a fixed order (alphabetically or 
something). Easy to remember and no way to misinterpret it.


Best,
Sven
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Should PEP 498 specify if rf'...' is valid?

2015-10-26 Thread Ethan Furman

On 10/26/2015 11:45 AM, Sven R. Kunze wrote:

On 26.10.2015 16:22, Ethan Furman wrote:

On 10/23/2015 08:20 AM, Nick Coghlan wrote:

My own objection isn't to allowing "fR" or "fbR", it's to allowing the
uppercase "F".

I also don't understand why we can't say "if 'f' is part of a string
prefix, it must be first".


Sometimes order matters, and sometimes it does not.  If the order does
not have an impact on the final code, it does not matter, and making
us have to remember an order that does not matter is a waste.


Order that matters? You must be kidding.


You misunderstand -- the order of string prefixes does *not* matter, so 
forcing us to use one is silly.


--
~Ethan~
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Should PEP 498 specify if rf'...' is valid?

2015-10-26 Thread MRAB

On 2015-10-26 18:45, Sven R. Kunze wrote:

On 26.10.2015 16:22, Ethan Furman wrote:

On 10/23/2015 08:20 AM, Nick Coghlan wrote:

My own objection isn't to allowing "fR" or "fbR", it's to
allowing the uppercase "F".

I also don't understand why we can't say "if 'f' is part of a
string prefix, it must be first".


Sometimes order matters, and sometimes it does not.  If the order
does not have an impact on the final code, it does not matter, and
making us have to remember an order that does not matter is a
waste.


Order that matters? You must be kidding. That would turn different
types of string extremely hard to understand because semantics
differ.

That is, btw., one reason, why I favor a fixed order (alphabetically
or something). Easy to remember and no way to misinterpret it.


In Python 2, how often have you seen prefix "ur" rather than "ru"?

I always used "ur".

How often is alphabetical order used in the prefixes?

If the order isn't alphabetical, then it's going to be some order
that's harder to remember, so I agree with Ethan here.
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] (no subject)

2015-10-26 Thread Maciej Szulik
Thanks to Nick Coghlan and Barry Warsaw we've setup a new SIG dedicated
to discussing python features from different distributions point of view.

Here is Nick's reasoning:
> With the Python 3 migration, and the growth in interest in user level
> package management for development purposes, what do you think of the idea
> of setting up a new Linux SIG to have those discussions? I know it's a
case
> of "yet another mailing list", but I think it will be worthwhile to have a
> clear point of collaboration within the Python ecosystem, rather than
> expecting Pythonistas to know how to reach out to (other) distros
directly.

The list is available @ https://mail.python.org/mailman/listinfo/linux-sig


Maciej
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Generated Bytecode ...

2015-10-26 Thread Victor Stinner
2015-10-24 4:34 GMT+09:00 Terry Reedy :
> How about -x nopeep to specifically skip the peephole optimizer?

Raymond wrote "IIRC, the code was never generated in the first place
(before the peephole pass)."

So "nopeep" would have a different purpose.

Victor
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Generated Bytecode ...

2015-10-26 Thread Terry Reedy

On 10/26/2015 10:36 PM, Victor Stinner wrote:

2015-10-24 4:34 GMT+09:00 Terry Reedy :

How about -x nopeep to specifically skip the peephole optimizer?


Raymond wrote "IIRC, the code was never generated in the first place
(before the peephole pass)."


I based that suggestion on what others said about why code was not 
generated.  I think the actual situation supports my point that turning 
off 'all optimizations' means reviewing the entire process of generating 
code, from start to finish, to find anything that might be called an 
'optimization' and that could be disabled or given a 'un-optimized' 
alternative.


--
Terry Jan Reedy

___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Should PEP 498 specify if rf'...' is valid?

2015-10-26 Thread francismb

>> Sometimes order matters, and sometimes it does not.  If the order does
>> not have an impact on the final code, it does not matter, and making
>> us have to remember an order that does not matter is a waste.
> 
> Order that matters? You must be kidding. That would turn different types
> of string extremely hard to understand because semantics differ.
> 
> That is, btw., one reason, why I favor a fixed order (alphabetically or
> something). Easy to remember and no way to misinterpret it.
> 
Well if the order is not important and all permutations are allowed
then, at least those permutations can be used as an alphabet to build a
hidden channel over it :-)

Regards,
francis


___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Should PEP 498 specify if rf'...' is valid?

2015-10-26 Thread Martin Panter
On 26 October 2015 at 19:43, MRAB  wrote:
> On 2015-10-26 18:45, Sven R. Kunze wrote:
>>
>> On 26.10.2015 16:22, Ethan Furman wrote:
>>>
>>> On 10/23/2015 08:20 AM, Nick Coghlan wrote:

 My own objection isn't to allowing "fR" or "fbR", it's to
 allowing the uppercase "F".

 I also don't understand why we can't say "if 'f' is part of a
 string prefix, it must be first".
>>>
>>>
>>> Sometimes order matters, and sometimes it does not.  If the order
>>> does not have an impact on the final code, it does not matter, and
>>> making us have to remember an order that does not matter is a
>>> waste.
>>
>>
>> Order that matters? You must be kidding. That would turn different
>> types of string extremely hard to understand because semantics
>> differ.
>>
>> That is, btw., one reason, why I favor a fixed order (alphabetically
>> or something). Easy to remember and no way to misinterpret it.
>>
> In Python 2, how often have you seen prefix "ur" rather than "ru"?
>
> I always used "ur".
>
> How often is alphabetical order used in the prefixes?
>
> If the order isn't alphabetical, then it's going to be some order
> that's harder to remember, so I agree with Ethan here.

In Python 2, ru". . ." is a SyntaxError, despite R coming before U in
the alphabet. And rb". . ." is also a SyntaxError, but in Python 3 it
was made legal.

I don’t see much point restricting the order of rf". . ." versus fr".
. .". Neither flag is particularly more important than the other, and
even if one were, should that one be at the front, or at the end
closer to the string?
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com