On Wed, 27 Apr 2022 at 16:04, Greg Ewing wrote:
>
> On 27/04/22 1:26 pm, Chris Angelico wrote:
> > On Wed, 27 Apr 2022 at 11:18, Greg Ewing
> > wrote:
> >>
> >> The proposed feature is analogous to forward declaring a
> >> struct in C. Would you call what C does monkeypatching?
> >>
> > No, beca
On 27/04/22 1:26 pm, Chris Angelico wrote:
On Wed, 27 Apr 2022 at 11:18, Greg Ewing wrote:
The proposed feature is analogous to forward declaring a
struct in C. Would you call what C does monkeypatching?
No, because C doesn't have first-class types, much less mutable ones.
The purpose of a
On 27/04/22 11:07 am, Chris Angelico wrote:
You're saying that it's somehow different when the original dev
intends for it, and that that makes it "not monkeypatching". I dispute
that, and I consider that the feature would be helpful whether the
original dev meant for it or not.
The forward dec
On 26/04/2022 20:48, Carl Meyer via Python-Dev wrote:
On Tue, Apr 26, 2022 at 1:25 PM Guido van Rossum wrote:
I also would like to hear more about the problem this is trying to solve, when
th real-world examples. (E.g. from pydantic?)
Yes please. I think these threads have jumped far too q
On Tue, Apr 26, 2022 at 7:24 PM Greg Ewing
wrote:
> On 27/04/22 2:01 am, Chris Angelico wrote:
> > That would be the case if monkeypatching were illegal. Since it's not,
> > wherein lies the difference?
>
> The proposed feature is analogous to forward declaring a
> struct in C. Would you call wha
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/python-dev@python.or
On Mon, Apr 25, 2022 at 10:32:15PM -0700, Larry Hastings wrote:
[...]
> Whichever spelling we use here, the key idea is that C is bound to a
> "ForwardClass" object. A "ForwardClass" object is /not/ a class, it's a
> forward declaration of a class. (I suspect ForwardClass is similar to a
> ty
On Wed, 27 Apr 2022 at 11:18, Greg Ewing wrote:
>
> On 27/04/22 2:01 am, Chris Angelico wrote:
> > That would be the case if monkeypatching were illegal. Since it's not,
> > wherein lies the difference?
>
> The proposed feature is analogous to forward declaring a
> struct in C. Would you call what
On 27/04/22 2:01 am, Chris Angelico wrote:
That would be the case if monkeypatching were illegal. Since it's not,
wherein lies the difference?
The proposed feature is analogous to forward declaring a
struct in C. Would you call what C does monkeypatching?
--
Greg
__
On Wed, 27 Apr 2022 at 08:06, Greg Ewing wrote:
>
> On 27/04/22 1:04 am, Joao S. O. Bueno wrote:
> > MonkeyPatching in Python is not illegal in this sense.
>
> I'm not suggesting it is. You're seizing on the wrong part
> of the analogy. The point is that what you call something
> doesn't change it
On 27/04/22 1:04 am, Joao S. O. Bueno wrote:
MonkeyPatching in Python is not illegal in this sense.
I'm not suggesting it is. You're seizing on the wrong part
of the analogy. The point is that what you call something
doesn't change its nature.
--
Greg
__
The only purpose of proposed -P option is to "not add sys.path[0]".
There are use cases which only need that.
Victor
On Tue, Apr 26, 2022 at 8:37 PM Steve Dower wrote:
>
> On 4/26/2022 10:46 AM, Victor Stinner wrote:
> > I propose adding a -P option to Python command line interface to "not
> > a
On Tue, Apr 26, 2022 at 1:25 PM Guido van Rossum wrote:
> I also would like to hear more about the problem this is trying to solve,
> when th real-world examples. (E.g. from pydantic?)
Yes please. I think these threads have jumped far too quickly into
esoteric details of implementation and synta
Apr 26, 2022 20:32:55 Eric V. Smith :
How would runtime consumers of annotations use this?
--
Eric
On Apr 26, 2022, at 12:05 PM, Thomas Kehrenberg
wrote:
If the problem is mostly type annotations, then another potential
solution would be to make use of .pyi files, which are not hamstrung
> On Apr 26, 2022, at 3:05 PM, Thomas Kehrenberg wrote:
>
>
> Apr 26, 2022 20:32:55 Eric V. Smith :
>
>> How would runtime consumers of annotations use this?
>>
>> --
>> Eric
>>
On Apr 26, 2022, at 12:05 PM, Thomas Kehrenberg wrote:
>>>
>>> If the problem is mostly type annotations
On Wed, 27 Apr 2022 at 05:05, Larry Hastings wrote:
>
>
> On 4/26/22 09:31, MRAB wrote:
>> Perhaps:
>>
>>class C: ...
>
> Also, your suggestion is already legal Python syntax; it creates a class with
> no attributes. So changing this existing statement to mean something else
> would potenti
I am traveling and have no keyboard right now, but it looks like this
thread is confusing the slots that a type gives to its *instances* and
extra slots in the type object itself. Only the latter are a problem.
I also would like to hear more about the problem this is trying to solve,
when th real-
> On 26 Apr 2022, at 20:52, Larry Hastings wrote:
>
>
>
> On 4/25/22 23:56, Ronald Oussoren wrote:
>> A problem with this trick is that you don’t know how large a class object
>> can get because a subclass of type might add new slots. This is currently
>> not possible to do in Python code (
On 4/26/22 09:31, MRAB wrote:
On 2022-04-26 06:32, Larry Hastings wrote:
Note that this spelling is also viable:
class C
I don't like that because it looks like you've just forgotten the colon.
Perhaps:
class C: ...
That's not a good idea. Every other place in Python where the
On 4/25/22 23:56, Ronald Oussoren wrote:
A problem with this trick is that you don’t know how large a class
object can get because a subclass of type might add new slots. This is
currently not possible to do in Python code (non-empty ``__slots__``
in a type subclass is rejected at runtime), bu
On 4/26/2022 10:46 AM, Victor Stinner wrote:
I propose adding a -P option to Python command line interface to "not
add sys.path[0]":
https://github.com/python/cpython/pull/31542
See the documentation in the PR for the exact behavior of this option.
I prefer to add an environment variable, only p
How would runtime consumers of annotations use this?
--
Eric
> On Apr 26, 2022, at 12:05 PM, Thomas Kehrenberg wrote:
>
> If the problem is mostly type annotations, then another potential
> solution would be to make use of .pyi files, which are not hamstrung by
> circular definitions. The ide
On Apr 25, 2022, at 22:32, Larry Hastings wrote:
> The general shape of it is the same. First, we have some sort of forward
> declaration of the class. I'm going to spell it like this:
>
> forward class C
>
> just for clarity in the discussion. Note that this spelling is also viable:
>
> cl
On Tue, Apr 26, 2022 at 2:50 AM Victor Stinner wrote:
> Hi,
>
> There are 4 main ways to run Python:
>
> (1) python -m module [...]
> (2) python script.py [...]
> (3) python -c code [...]
> (4) python [...]
>
> (1) and (2) insert the directory of the module/script at sys.path[0].
> (3) and (4) in
I often want a side_effect of "if called with foo, return bar" functionality.
This is really useful when the order of calls to your mock is indeterminate, so
you can't just use an iterable. What I end up doing is writing a little
function:
def f(x):
data = {
'foo': 'ba
On 2022-04-26 06:32, Larry Hastings wrote:
Sorry, folks, but I've been busy the last few days--the Language Summit
is Wednesday, and I had to pack and get myself to SLC for PyCon, &c.
I'll circle back and read the messages on the existing threads
tomorrow. But for now I wanted to post "the
On 4/26/22, Victor Stinner wrote:
>
> There are 4 main ways to run Python:
>
> (1) python -m module [...]
> (2) python script.py [...]
> (3) python -c code [...]
> (4) python [...]
>
> (1) and (2) insert the directory of the module/script at sys.path[0].
Running a module with -m inserts the curre
If the problem is mostly type annotations, then another potential
solution would be to make use of .pyi files, which are not hamstrung by
circular definitions. The idea would be that type checkers would merge
the annotations from .pyi files into the annotations in the
corresponding .py file.
So:
> On 26 Apr 2022, at 07:32, Larry Hastings wrote:
>
>
[…]
> What could go wrong? My biggest question so far: is there such a thing as a
> metaclass written in C, besides type itself? Are there metaclasses with a
> __new__ that doesn't call super().__new__ or three-argument type? If there
On Tue, 26 Apr 2022 at 22:56, Greg Ewing wrote:
>
> On 26/04/22 12:33 pm, Chris Angelico wrote:
> > That's exactly what I mean though: if the only difference between
> > "monkeypatching" and "not monkeypatching" is whether it was intended,
> > then the only difference is what you call it.
>
> No,
On Tue, Apr 26, 2022 at 4:04 AM wrote:
> Larry Hastings wrote:
> > [...]
> >
> > Now comes the one thing that we might call a "trick". The trick: when
> > we allocate the ForwardClass instance C, we make it as big as a class
> > object can ever get. (Mark Shannon assures me this is simply "heap
On Tue, Apr 26, 2022 at 9:55 AM Greg Ewing
wrote:
> On 26/04/22 12:33 pm, Chris Angelico wrote:
> > That's exactly what I mean though: if the only difference between
> > "monkeypatching" and "not monkeypatching" is whether it was intended,
> > then the only difference is what you call it.
>
> No,
On 26/04/22 12:33 pm, Chris Angelico wrote:
That's exactly what I mean though: if the only difference between
"monkeypatching" and "not monkeypatching" is whether it was intended,
then the only difference is what you call it.
No, it's not just a matter of what you call it.
If I lose my keys an
I didn't spot anyone else report this to mitmproxy so I raised an issue to
make them aware: https://github.com/mitmproxy/mitmproxy/issues/5297
On Tue, Apr 26, 2022 at 3:30 AM Victor Stinner wrote:
> On Tue, Apr 26, 2022 at 5:47 AM Brett Cannon wrote:
> > After talking about this in the SC today
Hi,
There are 4 main ways to run Python:
(1) python -m module [...]
(2) python script.py [...]
(3) python -c code [...]
(4) python [...]
(1) and (2) insert the directory of the module/script at sys.path[0].
(3) and (4) insert an empty string at sys.path[0].
This behavior is convenient and is ma
On Tue, Apr 26, 2022 at 5:47 AM Brett Cannon wrote:
> After talking about this in the SC today, we agreed to deprecate mailcap
> under the auspices of PEP 594:
> https://github.com/python/peps/commit/701999a91dc5f976c00d5bde1510226ebd9c7822
> .
Good. I proposed https://github.com/python/cpytho
> On 26 Apr 2022, at 07:32, Larry Hastings wrote:
>
>
[… snip …]
> Next we have the "continue" class statement. I'm going to spell it like this:
>
> continue class C(BaseClass, ..., metaclass=MyMetaclass):
> # class body goes here
> ...
>
> I'll mention other possible spellings lat
Larry Hastings wrote:
> [...]
>
> Now comes the one thing that we might call a "trick". The trick: when
> we allocate the ForwardClass instance C, we make it as big as a class
> object can ever get. (Mark Shannon assures me this is simply "heap
> type", and he knows far more about CPython inte
38 matches
Mail list logo