[Python-Dev] Making "Provisional" an explicit PEP state

2018-02-20 Thread Nick Coghlan
Hi folks, In the current PEP workflow, provisionally accepted PEPs are marked as "Accepted", and remain in that state until they're declared stable and moved to Final. This makes it hard to identify which APIs and file formats have been approved to have their reference implementations released

Re: [Python-Dev] pycapsule:PyObject * is NULL pointer

2018-02-20 Thread 赵亚
hi @MRAB i try again,it not ok. test files: 1.cpython.cpp ---c call python maintenance.py 2.maintenance.py python maintenance.py call pycapsule.cpp(dll) the code file,see attachment. At 2018-02-21 11:18:18, "MRAB" wrote: >On 2018-02-21 02:28, 赵亚 wrote: >

[Python-Dev] void* from c to python and to c?

2018-02-20 Thread 赵亚
I have a demand: c call python ,have a void* pointer pass to python and python call c,the void* pointer need pass to c. i don't know how to do,have any good idea ? thanks!___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] pycapsule:PyObject * is NULL pointer

2018-02-20 Thread MRAB
On 2018-02-21 02:28, 赵亚 wrote: This "python-dev" list is for development of the Python language itself. I think that this message should instead have been sent to "python-list". i have question:call,c-->python-->c. 1.the c pointer void* abc="123" by pycapsule in the c code. .. void*

Re: [Python-Dev] Dataclasses, frozen and __post_init__

2018-02-20 Thread Greg Ewing
Chris Barker - NOAA Federal wrote: If I have this right, on the discussion about frozen and hash, a use case was brought up for taking a few steps to create an instance (and thus wanting it not frozen) and then wanting it hashable. Which pointed to the idea of a “ freeze this from now on”

[Python-Dev] How is the GitHub workflow working for people?

2018-02-20 Thread Brett Cannon
It's been a year and 10 days since we moved to GitHub, so I figured now is as good a time as any to ask people if they are generally happy with the workflow and if there is a particular sticking point to please bring it up on the core-workflow mailing list so we can potentially address it.

[Python-Dev] pycapsule:PyObject * is NULL pointer

2018-02-20 Thread 赵亚
i have question:call,c-->python-->c. 1.the c pointer void* abc="123" by pycapsule in the c code. .. void* lpContext = "abc"; PyObject * lpPyContext = PyCapsule_New(lpContext, "Context",NULL); .. PyTuple_SetItem(pArgs, 1, lpPyContext); PyObject* pyResult = PyObject_CallObject(pFunc,

Re: [Python-Dev] Dataclasses, frozen and __post_init__

2018-02-20 Thread Greg Ewing
Steven D'Aprano wrote: So in principle, we could have a mutable class, and a immutable one, and when you flick the switch, the instance.__class__ changes from mutable to frozen. That seems unfriendly to subclasses as well. To extend a class you now need to subclass both the mutable and

Re: [Python-Dev] Dataclasses, frozen and __post_init__

2018-02-20 Thread Raymond Hettinger
> On Feb 20, 2018, at 2:38 PM, Guido van Rossum wrote: > > But then the class would also inherit a bunch of misfeatures from tuple (like > being indexable and having a length). It would be nicer if it used __slots__ > instead. FWIW, George Sakkis made a tool like this

Re: [Python-Dev] Dataclasses, frozen and __post_init__

2018-02-20 Thread Eric V. Smith
> On Feb 20, 2018, at 5:38 PM, Guido van Rossum wrote: > >> On Tue, Feb 20, 2018 at 1:37 PM, Eric V. Smith wrote: >>> On 2/17/2018 2:35 PM, Guido van Rossum wrote: >>> PS. I have to ponder why frozen dataclasses don't use `__new__`. >> >> As I'm sure

Re: [Python-Dev] Dataclasses, frozen and __post_init__

2018-02-20 Thread Guido van Rossum
On Tue, Feb 20, 2018 at 1:37 PM, Eric V. Smith wrote: > On 2/17/2018 2:35 PM, Guido van Rossum wrote: > >> PS. I have to ponder why frozen dataclasses don't use `__new__`. >> > > As I'm sure everyone is now aware after the rest of this discussion: it's > because the returned

Re: [Python-Dev] Dataclasses, frozen and __post_init__

2018-02-20 Thread Guido van Rossum
On Tue, Feb 20, 2018 at 12:50 PM, Chris Barker wrote: > Is that one attribute that big a deal? I suppose that simple dataclasses > with only two or so attributes would see a significant change, but if > you're really worried about space, wouldn't you use a namedtuple or

Re: [Python-Dev] Dataclasses, frozen and __post_init__

2018-02-20 Thread Eric V. Smith
On 2/17/2018 2:35 PM, Guido van Rossum wrote: PS. I have to ponder why frozen dataclasses don't use `__new__`. As I'm sure everyone is now aware after the rest of this discussion: it's because the returned object isn't really immutable. That said, I have threatened to create a decorator

Re: [Python-Dev] Dataclasses, frozen and __post_init__

2018-02-20 Thread Chris Barker
On Tue, Feb 20, 2018 at 8:45 AM, Guido van Rossum wrote: > TBH, I don't hate Nick's solution that assigns to __class__ in > __post_init__. You can probably come up with a class decorator that hides > construction of the frozen subclass. I do think that it should be used very >

Re: [Python-Dev] Dataclasses, frozen and __post_init__

2018-02-20 Thread Guido van Rossum
On Mon, Feb 19, 2018 at 8:16 PM, Glenn Linderman wrote: > On 2/19/2018 7:02 PM, Guido van Rossum wrote: > > But how? > > On Mon, Feb 19, 2018 at 5:06 PM, Chris Barker - NOAA Federal < > chris.bar...@noaa.gov> wrote: > >> ... maybe it would be helpful to be able to >>

Re: [Python-Dev] Dataclasses, frozen and __post_init__

2018-02-20 Thread Nick Coghlan
On 20 February 2018 at 15:11, Steven D'Aprano wrote: > So in principle, we could have a mutable class, and a immutable one, and > when you flick the switch, the instance.__class__ changes from mutable > to frozen. > > If you don't hate this, we can think about the details