On Thu, Apr 12, 2018 at 11:59 AM, Steven D'Aprano wrote:
> On Thu, Apr 12, 2018 at 12:09:38AM +1000, Chris Angelico wrote:
>
> [...]
>> >> Consider a very common use-case: an OS-provided
>> >> Python interpreter whose files are all owned by 'root'. Those will be
>> >>
On Thu, Apr 12, 2018 at 12:09:38AM +1000, Chris Angelico wrote:
[...]
> >> Consider a very common use-case: an OS-provided
> >> Python interpreter whose files are all owned by 'root'. Those will be
> >> distributed with .pyc files for performance, but you don't want to
> >> deprive the users of
On Thu, Apr 12, 2018 at 10:44 AM, Ethan Furman wrote:
> On 04/11/2018 04:46 PM, Chris Angelico wrote:
>
>> For myself, I've been back and forth a bit about whether "as" or ":="
>> is the better option. Both of them have problems. Both of them create
>> edge cases that could
On Wed, Apr 11, 2018 at 1:49 PM, Brendan Barnwell
wrote:
> On 2018-04-11 05:23, Clint Hepner wrote:
>
>> I find the assignments make it difficult to pick out what the final
>> expression looks like.
>>
>
> I strongly agree with this, and for me I think this is
On Thu, Apr 12, 2018 at 3:49 AM, Brendan Barnwell wrote:
> On 2018-04-11 05:23, Clint Hepner wrote:
>>
>> I find the assignments make it difficult to pick out what the final
>> expression looks like.
>
>
> I strongly agree with this, and for me I think this is
On Thu, Apr 12, 2018 at 1:22 AM, Nick Coghlan wrote:
>> # Similar to the boolean 'or' but checking for None specifically
>> x = "default" if (eggs := spam().ham) is None else eggs
>>
>> # Even complex expressions can be built up piece by piece
>> y = ((eggs :=
On 2018-04-11 11:05, David Mertz wrote:
How about this, Brendan?
_, x1, x2 = (D := b**2 - 4*a*c), (-b + sqrt(D))/2, (-b - sqrt(D))/2
I'm not sure I love this, but I don't hate it.
That's clever, but why bother? I can already do this with existing
Python:
D = b**2 - 4*a*c
x1, x2 =
On 11 April 2018 at 19:05, David Mertz wrote:
> How about this, Brendan?
>
> _, x1, x2 = (D := b**2 - 4*a*c), (-b + sqrt(D))/2, (-b - sqrt(D))/2
>
> I'm not sure I love this, but I don't hate it.
Seriously, how is this in any way better than
D = b**2 - 4*a*c
x1, x2 = (-b +
2018-04-11 18:01 GMT+03:00 Kirill Balunov :
>
>
> 2018-04-11 16:50 GMT+03:00 Chris Angelico :
>
>>
>> Can you give an example of how your syntax is superior to the more
>> general option of simply allowing "as" bindings in any location?
>>
>>
> This is
On 04/10/2018 10:32 PM, Chris Angelico wrote:
Title: Assignment Expressions
Thank you, Chris, for doing all this!
---
Personally, I'm likely to only use this feature in `if` and `while` statements; if the syntax was easier to read inside
longer expressions then I might use this elsewhere
On 2018-04-11 05:23, Clint Hepner wrote:
I find the assignments make it difficult to pick out what the final expression
looks like.
I strongly agree with this, and for me I think this is enough to push
me to -1 on the whole proposal. For me the classic example case is
still the quadratic
On 4/11/2018 4:26 AM, Petr Viktorin wrote:
Currently in Fedora, we ship *both* optimized and non-optimized pycs to
make sure both -O and non--O will work nicely without root privilieges.
So splitting the docstrings into a separate file would be, for us, a
benefit in terms of file size.
On 2018-04-11 04:15, Mike Miller wrote:
If anyone is interested I came across this same subject on a blog post and
discussion on HN today:
- https://www.hillelwayne.com/post/equals-as-assignment/
It says "BCPL also introduced braces as a means of defining blocks.".
That bit is wrong, unless
On 11 April 2018 at 16:22, Nick Coghlan wrote:
> Similar to my suggestion above, you may also want to consider making
> this example a filtered comprehension in order to show the proposal in
> its best light:
>
> results = [(x, y, x/y) for x in input_data if (y := f(x) )]
On 11 April 2018 at 15:32, Chris Angelico wrote:
> Wholesale changes since the previous version. Statement-local name
> bindings have been dropped (I'm still keeping the idea in the back of
> my head; this PEP wasn't the first time I'd raised the concept), and
> we're now
2018-04-11 16:50 GMT+03:00 Chris Angelico :
>
> Can you give an example of how your syntax is superior to the more
> general option of simply allowing "as" bindings in any location?
>
>
This is not my syntax :) And not even my idea. I just do not understand,
and even a little
>
> It's worth adding a reminder here that "having more options on the
> market" is pretty directly in contradiction to the Zen of Python -
> "There should be one-- and preferably only one --obvious way to do
> it".
I've got to start minding my words more. By "options on the market" I more
On Thu, Apr 12, 2018 at 12:11 AM, Paul Moore wrote:
> On 11 April 2018 at 14:54, Chris Angelico wrote:
>> Sure, if you're just assigning zero to everything. But you could do
>> that with a statement. What about this:
>>
>> q = {
>> lambda: x := lambda
On 11 April 2018 at 02:54, Antoine Pitrou wrote:
> On Tue, 10 Apr 2018 19:29:18 +0300
> Serhiy Storchaka
> wrote:
>>
>> A bugfix release can fix bugs in bytecode generation. See for example
>> issue27286. [1] The part of issue33041 backported to 3.7 and
On 11 April 2018 at 14:54, Chris Angelico wrote:
> Sure, if you're just assigning zero to everything. But you could do
> that with a statement. What about this:
>
> q = {
> lambda: x := lambda y: z := a := 0,
> }
>
> Yes, it's an extreme example, but look at all those colons
On Wed, Apr 11, 2018 at 4:06 PM, Steven D'Aprano wrote:
> On Wed, Apr 11, 2018 at 02:21:17PM +1000, Chris Angelico wrote:
>
> [...]
>> > Yes, it will double the number of files. Actually quadruple it, if the
>> > annotations and line numbers are in separate files too. But if
On Wed, Apr 11, 2018 at 11:37 PM, Paul Moore wrote:
> On 11 April 2018 at 14:25, Chris Angelico wrote:
>> On Wed, Apr 11, 2018 at 10:23 PM, Clint Hepner
>> wrote:
Differences from regular assignment statements
On Wed, Apr 11, 2018 at 11:03 PM, Kirill Balunov
wrote:
> Great work Chris! Thank you!
>
> I do not know whether this is good or bad, but this PEP considers so many
> different topics, although closely interrelated with each other.
>
> 2018-04-11 8:32 GMT+03:00 Chris
On Tue, Apr 10, 2018 at 9:50 PM, Eric V. Smith wrote:
>
>>> 3. Annotations. They are used mainly by third party tools that
>>> statically analyze sources. They are rarely used at runtime.
>>
>> Even less used than docstrings probably.
>
> typing.NamedTuple and dataclasses use
On 11 April 2018 at 14:25, Chris Angelico wrote:
> On Wed, Apr 11, 2018 at 10:23 PM, Clint Hepner wrote:
>>> Differences from regular assignment statements
>>> --
>>>
>>> An assignment statement can assign to
On Wed, Apr 11, 2018 at 10:23 PM, Clint Hepner wrote:
>> On 2018 Apr 11 , at 1:32 a, Chris Angelico wrote:
>># Similar to the boolean 'or' but checking for None specifically
>>x = "default" if (eggs := spam().ham) is None else eggs
>
>>
>>#
On 11 April 2018 at 13:23, Clint Hepner wrote:
>># Even complex expressions can be built up piece by piece
>>y = ((eggs := spam()), (cheese := eggs.method()), cheese[eggs])
> I find the assignments make it difficult to pick out what the final
> expression looks
Great work Chris! Thank you!
I do not know whether this is good or bad, but this PEP considers so many
different topics, although closely interrelated with each other.
2018-04-11 8:32 GMT+03:00 Chris Angelico :
>
> Alterations to comprehensions
> -
> On 2018 Apr 11 , at 1:32 a, Chris Angelico wrote:
>
> Wholesale changes since the previous version. Statement-local name
> bindings have been dropped (I'm still keeping the idea in the back of
> my head; this PEP wasn't the first time I'd raised the concept), and
> we're now
On 11 April 2018 at 10:30, Chris Angelico wrote:
> The PEP has kinda pivoted a bit since its inception, so I'm honestly
> not sure what "original motivating use case" matters. :D I'm just
> lumping all the use-cases together at the same priority now.
Fair point, and reading
On Wed, Apr 11, 2018 at 6:55 PM, Paul Moore wrote:
> On 11 April 2018 at 06:32, Chris Angelico wrote:
>> The name ``prefix`` is thus searched for at global scope, ignoring the class
>> name. Under the proposed semantics, this name will be eagerly bound,
On 04/11/18 08:06, Steven D'Aprano wrote:
On Wed, Apr 11, 2018 at 02:21:17PM +1000, Chris Angelico wrote:
[...]
Yes, it will double the number of files. Actually quadruple it, if the
annotations and line numbers are in separate files too. But if most of
those extra files never need to be
On 04/11/18 06:21, Chris Angelico wrote:
On Wed, Apr 11, 2018 at 1:02 PM, Steven D'Aprano wrote:
On Wed, Apr 11, 2018 at 10:08:58AM +1000, Chris Angelico wrote:
File system limits aren't usually an issue; as you say, even FAT32 can
store a metric ton of files in a single
On 11 April 2018 at 04:41, Steven D'Aprano wrote:
>> > But in a way that more intuitively expresses the intent of the code, it
>> > would be great to have more options on the market.
>>
>> It's worth adding a reminder here that "having more options on the
>> market" is pretty
Ok, we can haggle the finer details and I admit once you learn the syntax it
isn't substantially harder. Simply, I've found the dict() a bit easier to
mentally parse at a glance. Also, to add I've always expected multiple args to
work with it, and am always surprised when it doesn't.
Would
On 10/04/2018 18:54, Zachary Ware wrote:
> On Tue, Apr 10, 2018 at 12:38 PM, Chris Angelico wrote:
>> A deployed Python distribution generally has .pyc files for all of the
>> standard library. I don't think people want to lose the ability to
>> call help(), and unless I'm
On Wed, Apr 11, 2018 at 3:54 PM, Ethan Furman wrote:
> On 04/10/2018 10:32 PM, Chris Angelico wrote:
>
>> Migration path
>> ==
>>
>> The semantic changes to list/set/dict comprehensions, and more so to
>> generator
>> expressions, may potentially require migration
I think Guido has given a direct answer why dict unpacking is not supported
in syntax level,
I can take it and I think it's better to implement a function for dict
unpacking in standard library, just like
from dict_unpack import dict_unpack, pattern as pat
some_dict = {'a': {'b': {'c':
On Wed, Apr 11, 2018 at 02:21:17PM +1000, Chris Angelico wrote:
[...]
> > Yes, it will double the number of files. Actually quadruple it, if the
> > annotations and line numbers are in separate files too. But if most of
> > those extra files never need to be opened, then there's no cost to them.
39 matches
Mail list logo