El jue, 22 jun 2023 a las 8:22, Randolf Scholz ()
escribió:
> Dataclasses should provide a way to ignore a type hinted attributes, and
> not consider them as fields.
>
> For example, some attributes might be derived during `__post_init__` from
> the values of the fields or other variables.
>
> If
I would support allowing the globals and locals arguments to exec() to be
passed as keyword arguments. Open an issue on
https://github.com/python/cpython and if no other core devs object, we can
fix this in 3.13.
The actual code change would be very small thanks to Argument Clinic.
El mié, 7 jun
The formal term for that is intersection types. There is a long-standing
thread about that at https://github.com/python/typing/issues/213; there are
some uses but the feature would greatly complicate the type system, so it's
not clear that it's worth adding.
At this point, what Intersection needs
At the Language Summit a few days ago we discussed this problem. I wasn't
involved in this discussion, but it's a hard one to solve.
You may be interested in HPy (https://hpyproject.org/), which aims to
provide what you are looking for.
El dom, 23 abr 2023 a las 6:18, Evan Greenup via
El jue, 30 jun 2022 a las 22:19, Stephen J. Turnbull (<
stephenjturnb...@gmail.com>) escribió:
> nveric...@gmail.com writes:
>
> > I accidentally created another thread in python-dev as I mentioned
> > above, but ideally Optional and Union should both be deprecated and
> > phased out for the
El jue, 30 jun 2022 a las 10:46, escribió:
> (I apologize in advance if I've posted anything incorrectly before, I
> believe I might have sent this in python-dev instead but not sure as it's
> not appearing in the posts for my account).
>
> I am aware this is clarified in the Python
El sáb, 25 jun 2022 a las 13:44, Chris Angelico ()
escribió:
> On Sun, 26 Jun 2022 at 04:41, Brendan Barnwell
> wrote:
> > In contrast, what I would want out of deferred evaluation is
> precisely
> > the ability to evaluate the deferred expression in the *evaluating*
> > scope (not the
El mié, 16 mar 2022 a las 3:58, Jared Crawford ()
escribió:
> Hi all,
>
> I recently noticed that stdlib functions often don't have type hints. Is
> there a technical reason why typing isn't more widespread in the cpython
> implementation?
Mostly there hasn't been agreement to add them. See
El lun, 7 mar 2022 a las 19:57, Christopher Barker ()
escribió:
> On Mon, Mar 7, 2022 at 3:43 PM Chris Angelico wrote:
>
>> On Tue, 8 Mar 2022 at 10:39, Jelle Zijlstra
>> wrote:
>> >
>> >
>> >
>> > El lun, 7 mar 2022 a las 15:35, Chri
El lun, 7 mar 2022 a las 15:35, Chris Angelico ()
escribió:
> On Tue, 8 Mar 2022 at 10:20, Brendan Barnwell
> wrote:
> >
> > On 2022-03-06 14:43, Chris Angelico wrote:
> > > This keeps happening. All the successful ideas seem to happen
> > > elsewhere, notably on typing-sig.
> >
> > You
Are you aware of https://docs.python.org/3.10/library/dataclasses.html?
That essentially provides a way to generate the boilerplate without having
to put it all in your code.
El mié, 16 feb 2022 a las 5:20, Avanish Gupta ()
escribió:
> Thanks for the previous mail.
> I would like to highlight
Perhaps there should be a guess_all_types() function in addition to
guess_type() that returns all possible types, so that the user can select
the type they want using any criterion. This would be nicely symmetrical
with the existing guess_extension and guess_all_extensions functions.
El lun, 17 ene 2022 a las 7:11, Steven D'Aprano ()
escribió:
> On Mon, Jan 17, 2022 at 11:18:13PM +0900, Inada Naoki wrote:
> > On Mon, Jan 17, 2022 at 8:49 PM Steven D'Aprano
> wrote:
> > >
> > > On Mon, Jan 17, 2022 at 08:04:50PM +0900, Inada Naoki wrote:
> > >
> > > > Name lookup is faster
On Thu, Jan 6, 2022 at 10:44 PM Tushar Sadhwani <
tushar.sadhwani...@gmail.com> wrote:
> With the recent submission of [PEP 677][1], I was reminded of an idea I
> had with function annotation syntax since the very beginning:
>
> why not let me write:
>
> ```python
> def f() -> tuple[int, str]:
>
El dom, 21 nov 2021 a las 14:35, Peter Ludemann ()
escribió:
> Neil Girdhar wrote:
> > I wish this had gotten more attention! :)
>
> I wonder what the various projects are doing to handle the latest version
> of Python, if they need a parse tree with whitespace information. (The
> projects I know
El jue, 11 nov 2021 a las 5:41, Matt del Valle ()
escribió:
> So I was reading the docs for the `threading` module and I stumbled upon
> this little note:
>
> Note:
>
> In the Python 2.x series, this module contained camelCase names for some
> methods and functions. These are deprecated as of
El sáb, 23 oct 2021 a las 12:57, Guido van Rossum ()
escribió:
> I like that you're trying to fix this wart! I think that using a different
> syntax may be the only way out. My own bikeshed color to try would be `=>`,
> assuming we'll introduce `(x) => x+1` as the new lambda syntax, but I can
>
El vie, 15 oct 2021 a las 14:42, Abdulla Al Kathiri (<
alkathiri.abdu...@gmail.com>) escribió:
> I don’t understand why tuple structure is not supported already. It makes
> reading the function signature a breeze and very natural. You can also do
> it without parentheses which mimics the return
El mar, 12 oct 2021 a las 16:51, Jeremiah Vivian (<
nohackingofkrow...@gmail.com>) escribió:
> I posted a previous thread about overloading the unary `+` operator in
> strings with `ord`, and that expanded to more than just the unary `+`
> operator. So I'm saying now, there should be these
I suggested this before in some typing meetup, but there are a few problems
with it. One is that annotating arguments as "list" or "dict" is often the
wrong thing to do: instead, people should use broader, immutable types like
Iterable, Sequence, or Mapping, to avoid variance problems (
El jue, 17 jun 2021 a las 15:26, Steven D'Aprano ()
escribió:
> On Thu, Jun 17, 2021 at 02:51:44PM -0700, Jelle Zijlstra wrote:
> > El jue, 17 jun 2021 a las 14:45, David Mertz ()
> escribió:
> >
> > > On Thu, Jun 17, 2021, 5:24 PM Ben Rudiak-Gould
> > >
>
El jue, 17 jun 2021 a las 14:45, David Mertz () escribió:
> On Thu, Jun 17, 2021, 5:24 PM Ben Rudiak-Gould
>
>> Okay, slightly off-topic, but can we *please* allow
>>
>> [*chunk for chunk in list_of_lists]
>>
>
> It is completely non-obvious to me what that would even MEAN. I cannot
> derive
El jue, 10 jun 2021 a las 19:30, Cameron Simpson () escribió:
> On 11Jun2021 10:01, Cameron Simpson wrote:
> >So your idea does not suck. But it may not motivate anyone to implement
> >it, or even to agreed that it should be implemented.
>
> It also struck me: functions with _no_ parameters are
El mié, 2 jun 2021 a las 8:34, Alexis Masson ()
escribió:
> Yeah, that's it exactly.
>
> I see these two features - `_` as a joker in `match` statements and `_`as
> the last value produced by a shell - as incompatible, because you have to
> account for interferences between them, or face
El lun, 31 may 2021 a las 12:40, David Mertz () escribió:
> I think making 'Ellipsis' a reserved word is too much. The analogy with
> non-reserved words like `int`, `str`, `map`, `print`, and so on, illustrate
> this, I think. I.e. redefining those is likely to cause bad things to
> happen, but
Another option is something like this (building on Ricky Teachey's
suggestion):
from dataclasses import ArgumentMarker, dataclass
@dataclass
class C:
a: Any # positional-only
__pos__: ArgumentMarker
b: Any # normal
__kw_only__: ArgumentMarker
c: Any # keyword-only
The
El mar., 21 jul. 2020 a las 17:27, Guido van Rossum ()
escribió:
> A philosophical problem with this is proposal is that it takes a notation
> that is processed by the bytecode compiler and makes it dependent on user
> code to be imported from the stdlib. We only do that in rare cases — IIRC
>
El lun., 1 abr. 2019 a las 7:28, Antoine Pietri ()
escribió:
> While the switch to Python 3 did an excellent job in removing some of
> the old inconsistencies we had in the language, pretty much everyone
> agrees that some other backwards-incompatible changes could be made to
> remove some old
Your proposed syntax is hard to implement, because it would require
invasive syntax changes to the language itself. That's probably not worth
it.
However, there are other ways to achieve what you're looking for that don't
require changing the language itself. This issue has some proposals:
2018-07-11 16:25 GMT-07:00 Gregory P. Smith :
> Completely obvious what it does, but it irritates my aesthetic
> sensibilities every time I see:
> frozenset({spam, eggs})
>
> Why? Because I assume under the hood that creates a set of spam and eggs
> before calling frozenset to copy it into a
2018-06-24 12:30 GMT-07:00 :
> On Jun 23, 2018, at 21:11, Nathaniel Smith wrote:
>
>> He's asking for an async version of the 'iter' builtin, presumably
>> something like:
>> async def aiter(async_callable, sentinel):
>>while True:
>>value = await async_callable()
>>if value
2018-06-17 13:09 GMT-07:00 Chris Angelico :
>
> kwargs.pop("some_key") could plausibly be spelled del
> kwargs["some_key"] if del were (like yield) upgraded to expression.
> Whether that is an improvement or not, I don't know, but at least it's
> logical.
>
That already works. It calls the
2018-06-08 20:27 GMT-07:00 Alex Walters :
> Why not...
>
> cool_namespace = SomeNamespaceContextManager()
>
> with cool_namespace:
> def foo():
> pass
>
> advantage being it introduces no new keyword. The 'disadvantage' is it
> would change semantics of the with statement (as would
2018-05-11 22:01 GMT-04:00 Robert Roskam :
> Hey Steven,
>
> I'm also at PyCon. Shall we take this off list and attempt to meet up and
> discuss?
>
> I'm also at PyCon and interested in meeting about this. I just wrote up a
basic and incomplete implementation for
2018-03-02 7:03 GMT-08:00 Robert Vanden Eynde :
> +1 on extracting the big win for "if" and "while" (the regex case is
> wonderul). It would be see as an "extended if/while" rather than a general
> statement assignation.
>
>
I wonder if we could have a more limited change to
[x if x & 1 else 'even' for x in a]
An `if` at the end of the comprehension means a condition on whether to
include the value.
Also, this question would have been better asked on python-list.
2017-10-05 8:40 GMT-07:00 Jason H :
> >>> a = [1,2,3]
> >>> [ x for x in a if x & 1]
>
2017-09-13 13:01 GMT-07:00 Jim J. Jewett :
> On Wed, Sep 13, 2017 at 3:12 PM, Lukasz Langa wrote:
> > On Sep 13, 2017, at 2:56 PM, Jim J. Jewett wrote:
>
> >> I am generally supportive of leaving the type annotations
> >> unprocessed
2017-09-10 18:10 GMT-07:00 Ethan Smith <et...@ethanhs.me>:
>
>
> On Sun, Sep 10, 2017 at 5:39 PM, Jelle Zijlstra <jelle.zijls...@gmail.com>
> wrote:
>
>> Congratulations on your first PEP! This is solving an important problem
>> for typing in Python, so I'
Congratulations on your first PEP! This is solving an important problem for
typing in Python, so I'm glad we're tackling it.
2017-09-10 16:05 GMT-07:00 Ethan Smith :
> Hello,
>
> I have just published my first PEP, on packaging type information. I would
> appreciate comments
2017-08-16 10:37 GMT+02:00 Nathaniel Smith <n...@pobox.com>:
> On Tue, Aug 15, 2017 at 11:53 PM, Jelle Zijlstra
> <jelle.zijls...@gmail.com> wrote:
> > Minor suggestion: Could we allow something like
> > `sys.set_new_context_item(description='mylib.context',
> >
2017-08-16 1:55 GMT+02:00 Yury Selivanov :
> Hi,
>
> Here's the PEP 550 version 2. Thanks to a very active and insightful
> discussion here on Python-ideas, we've discovered a number of
> problems with the first version of the PEP. This version is a complete
> rewrite
This is exciting and I'm happy that you're addressing this problem.
We've solved a similar problem in our asynchronous programming framework,
asynq. Our solution (implemented at
https://github.com/quora/asynq/blob/master/asynq/contexts.py) is similar to
that in PEP 521: we enhance the context
2017-07-21 10:07 GMT-07:00 Jason H :
> I experimented with Python in college and I've been for close to 20 years
> now. (Coming and going as needed) I love the language. But there is one
> annoyance that I continually run into.
>
> There are basically two assignment operators,
2017-03-05 22:08 GMT-08:00 Elliot Gorokhovsky :
> Another solution: check if there is more than one thread; if there is, then
> disable optimization. Is sorting in multithreaded programs common enough to
> warrant adding the complexity to deal with it?
>
I think
2017-02-28 15:12 GMT-08:00 Steven D'Aprano :
> On Wed, Mar 01, 2017 at 07:02:23AM +0800, 语言破碎处 wrote:
>>
>> where we use types?
>> almost:
>> isinstance(obj, T);
>> # issubclass(S, T);
>>
>> Note that TYPE is SET;
>
> What does that mean? I don't
2017-01-14 21:24 GMT-08:00 Mathieu TORTUYAUX :
> Hello everyone,
>
> I'm used to work with python and contribute to open-source projects. And
> now, many projects need to run with dependancies. So I wondering, if it
> could be a good idea to integrate a sniffer into
2017-01-10 8:57 GMT-08:00 Ethan Furman :
> On 01/10/2017 08:36 AM, Thane Brimhall wrote:
>
> Does anyone have thoughts on this topic? I assume the silence is because
>> this suggestion is too trivial to matter.
>>
>
> Sometimes it's just a matter of timing. :)
>
> I use
2016-11-30 8:11 GMT-08:00 Guido van Rossum :
> On Wed, Nov 30, 2016 at 7:09 AM, Ethan Furman wrote:
>
>> On 11/30/2016 02:32 AM, Jelte Fennema wrote:
>>
>> It would be nice to have a supported way to add defaults to namedtuple,
>>> so the slightly hacky
48 matches
Mail list logo