On Fri, Mar 12, 2021, 11:55 PM Eric V. Smith wrote:
> I should mention another idea that showed up on python-ideas, at
>
> https://mail.python.org/archives/list/python-ideas@python.org/message/WBL4X46QG2HY5ZQWYVX4MXG5LK7QXBWB/
> . It would allow you to specify the flag via code like:
>
> @datacla
[I'm sort of loose with the terms field, parameter, and argument here.
Forgive me: I think it's still understandable. Also I'm not specifying
types here, I'm using Any everywhere. Use your imagination and
substitute real types if it helps you.]
There have been many requests to add keyword-only
On Sat, Mar 13, 2021 at 1:46 PM Peter Ludemann wrote:
> It's not clear to me what surprising behaviors there would be. Javascript
> seems to do OK with optional semicolons - presumably its algorithm is similar
> to what BCPL used. (Or perhaps the surprising behaviors are trivial compared
> to t
On Fri, 12 Mar 2021 at 18:27, Guido van Rossum wrote:
> On Fri, Mar 12, 2021 at 6:23 PM Peter Ludemann
> wrote:
>
>> [I wonder why C didn't adopt BCPL's convention for eliding semi-colons?
>> ...]
>>
>
> [Presumably because it caused too many surprising behaviors...]
>
My guess is that it would
On Fri, Mar 12, 2021 at 6:23 PM Peter Ludemann
wrote:
> [I wonder why C didn't adopt BCPL's convention for eliding semi-colons?
> ...]
>
[Presumably because it caused too many surprising behaviors...]
--
--Guido van Rossum (python.org/~guido)
*Pronouns: he/him **(why is my pronoun here?)*
Guido van Rossum wrote:
> Can we skip ahead to considering how to implement this? I can think of two
> approaches: either hack the lexer to special-case a newline followed by a
> period (which currently can never start a line), or redesign the syntax to
> allow NEWLINE INDENT ‘.’ . NEWLINE
Yeah, all the shenanigans with `__all__` make it clear that it's the wrong
solution, and we should do something better.
Fortunately the PEG parser and its "soft keywords" feature (debuting for
match/case in 3.10) makes it much easier to do this.
I had thought about this and came up with similar s
On Fri, Mar 12, 2021 at 1:52 PM Ethan Furman wrote:
> A question that comes up quite a bit on Stackoverflow is how to test to
> see if a value will result in an Enum member, preferably without having to
> go through the whole try/except machinery.
>
> A couple versions ago one could use a contain
Hi,
I was refactoring some code today and ran into an issue that always bugs me with
Python modules. It bugged me enough this time that I spent an hour banging out
this
potential proposal to add a new contextual keyword. Let me know what you think!
Theia
On 3/12/21 2:49 PM, Ricky Teachey wrote:
On Fri, Mar 12, 2021 at 4:52 PM Ethan Furman wrote:
A question that comes up quite a bit on Stackoverflow is how to test
to see if a value will result in an Enum member, preferably without
having to go through the whole try/except machinery.
Could th
On Fri, Mar 12, 2021 at 4:52 PM Ethan Furman wrote:
> A question that comes up quite a bit on Stackoverflow is how to test to
> see if a value will result in an Enum member, preferably without having to
> go through the whole try/except machinery.
>
> A couple versions ago one could use a contain
A question that comes up quite a bit on Stackoverflow is how to test to see if
a value will result in an Enum member, preferably without having to go through
the whole try/except machinery.
A couple versions ago one could use a containment check:
if 1 in Color:
but than was removed as Enums
On 3/12/2021 4:42 PM, Paul Bryan wrote:
Using your example (thanks, seeing a concrete example is helpful) it
appears you can do it the SQL way in Python too:
x = (1
,2
,3
)
Right. It's just that no one would want to!
Eric
On Fri, 2021-03-12 at 16:35 -0500, Eric V. Smith wrote:
On 3/12/2
Using your example (thanks, seeing a concrete example is helpful) it
appears you can do it the SQL way in Python too:
x = (1
,2
,3
)
On Fri, 2021-03-12 at 16:35 -0500, Eric V. Smith wrote:
> On 3/12/2021 3:37 PM, Greg Ewing wrote:
> > On 13/03/21 5:02 am, Ned Batchelder wrote:
> > > I think the
On 3/12/21 9:04 AM, Henk-Jaap Wagenaar wrote:
(
Q(user=user) |
Q(is_deleted=True) |
)
I am happy to flesh this out more, but as this discussion was ongoing, I
thought I would throw it out here and see what people think? Are there
potential problems with this e.g. with parsing it?
On 3/12/2021 3:37 PM, Greg Ewing wrote:
On 13/03/21 5:02 am, Ned Batchelder wrote:
I think the only reason anyone ever used leading commas to begin with
was because of languages that didn't allow a final trailing comma.
In those worlds, to keep the editing smooth, people moved the commas
to t
On 13/03/21 5:02 am, Ned Batchelder wrote:
I think the only reason anyone ever used leading commas to begin with
was because of languages that didn't allow a final trailing comma. In
those worlds, to keep the editing smooth, people moved the commas to the
beginning of the line,
Which doesn't
On 3/12/21 7:50 AM, Paul Bryan wrote:
My inclination would be to cede code formatting to a tool like Black and focus
on function:
https://black.readthedocs.io/en/stable/
We still have to read it after Black munges it.
Like Paul said, add parentheses -- it works for method chaining, string
c
I have written tens of thousands of lines of Pandas code, and I've taught
thousands of people to use Pandas. I've worked with the core developers of
Pandas as well.
This is the first time I've ever seen `\` line continuation used for fluent
programming style rather than just using parentheses as a
Simple solution for trailing | is put False on the next line.
> On Mar 12, 2021, at 12:07 PM, Henk-Jaap Wagenaar
> wrote:
>
>
> This is a definite tangent. Trailing commas are great for reducing git diffs,
> not making errors when moving things around (missing commas, which e.g. in
> string
On Sat, Mar 13, 2021 at 3:28 AM <2qdxy4rzwzuui...@potatochowder.com> wrote:
> For exmaple, if I have a multiline list like this:
>
> x = [
> 1,
> 2
> ]
>
> and add a new element to the end, then I end up with the diff including
> the 2 even though I didn't change the
This argument pretty much kills the proposal.
On Fri, Mar 12, 2021 at 9:01 AM Rob Cliffe via Python-ideas <
python-ideas@python.org> wrote:
> To my mind there are too many differences between running code as a
> script and running it in the REPL. This would, presumably, add another
> one: the in
This is a definite tangent. Trailing commas are great for reducing git
diffs, not making errors when moving things around (missing commas, which
e.g. in strings causes concatenation) but I have often wondered whether the
same could be extended to (some?) logical or arithmetic operators, in
particul
To my mind there are too many differences between running code as a
script and running it in the REPL. This would, presumably, add another
one: the initial line would be executed without waiting to see if there
is a dot continuation line. And it just feels wrong to have a complete
syntactical
currently in a `dataclasses.dataclass` based class, you can either have it
hashable and completely immutable (using frozen=True and eq=True), or you can
have it hashable but completely mutable (by using unsafe_hash=True)
unsafe_hash provides the convenience of being able to mutate some fields, w
On 2021-03-12 at 11:02:50 -0500,
Ned Batchelder wrote:
> I think the only reason anyone ever used leading commas to begin with
> was because of languages that didn't allow a final trailing comma. In
> those worlds, to keep the editing smooth, people moved the commas to
> the beginning of the lin
On Fri, 12 Mar 2021 at 16:06, Ned Batchelder wrote:
>
> I think the only reason anyone ever used leading commas to begin with was
> because of languages that didn't allow a final trailing comma. In those
> worlds, to keep the editing smooth, people moved the commas to the beginning
> of the li
On Fri, Mar 12, 2021 at 10:41 AM Matt Williams wrote:
>
> Hi,
>
> It's becoming more popular in Python to have interfaces which are built
> around method chaining as a way of applying operations to data. For example
> in pandas is moving more towards a default model where methods do not change
On Fri, 12 Mar 2021 at 15:53, Paul Bryan wrote:
>
> My inclination would be to cede code formatting to a tool like Black and
> focus on function:
> https://black.readthedocs.io/en/stable/
... and if you try that out, what you'll find is that black adds parentheses:
y = (
x.rstrip("\n")
I think the only reason anyone ever used leading commas to begin with
was because of languages that didn't allow a final trailing comma. In
those worlds, to keep the editing smooth, people moved the commas to the
beginning of the line, breaking with every comma-tradition.
I don't see a reason
Can we skip ahead to considering how to implement this? I can think of two
approaches: either hack the lexer to special-case a newline followed by a
period (which currently can never start a line), or redesign the syntax to
allow NEWLINE INDENT ‘.’ . NEWLINE ‘.’ DEDENT at the
e
My inclination would be to cede code formatting to a tool like Black
and focus on function:
https://black.readthedocs.io/en/stable/
On Fri, 2021-03-12 at 15:32 +, Matt Williams wrote:
> Hi,
>
> It's becoming more popular in Python to have interfaces which are
> built around method chaining a
Hi,
It's becoming more popular in Python to have interfaces which are built around
method chaining as a way of applying operations to data. For example in pandas
is moving more towards a default model where methods do not change the object
in-place but instead return an altered version (or at l
It seems your proposal is intended to address an aesthetic concern. Is
there a case where using a leading comma would make something
actually easier or more intuitive to express over the use of trailing
comma?
On Fri, 2021-03-12 at 10:34 +, roland.puntaier--- via Python-ideas
wrote:
> I had po
On Fri, 12 Mar 2021 at 13:22, roland.puntaier--- via Python-ideas
wrote:
>
> I had posted this as https://github.com/python/peps/issues/1867
> The discussion so far is below.
>
> Please make some arguments.
>
> The major point to me is, that the symmetry is broken,
> which leads to extra editing a
I had posted this as https://github.com/python/peps/issues/1867
The discussion so far is below.
Please make some arguments.
The major point to me is, that the symmetry is broken,
which leads to extra editing actions, like removing the comma in the first line.
I guess, this was the reason to allow
36 matches
Mail list logo