[issue42840] `type` takes **kwargs for __init_subclass__

2021-03-31 Thread miss-islington


miss-islington  added the comment:


New changeset b3c1e2c493e67f84b1034ac6c49492a459b0736d by Miss Islington (bot) 
in branch '3.9':
bpo-42840: Document providing kwargs to type. (GH-24173)
https://github.com/python/cpython/commit/b3c1e2c493e67f84b1034ac6c49492a459b0736d


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42840] `type` takes **kwargs for __init_subclass__

2021-02-18 Thread Guido van Rossum


Guido van Rossum  added the comment:

I'll try to review it in the coming weeks.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42840] `type` takes **kwargs for __init_subclass__

2021-02-18 Thread Erik Soma


Erik Soma  added the comment:

The CPython PR has gone stale waiting for core review, pinging this per the dev 
guide.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42840] `type` takes **kwargs for __init_subclass__

2021-01-08 Thread Erik Soma


Erik Soma  added the comment:

Seems I misframed the issue a bit. I didn't realize keyword arguments besides 
'metaclass' were introduced with PEP 3115 with Python 3.0.


In any case I've posted a PR to update the docs and typeshed.
Typeshed PR for reference: https://github.com/python/typeshed/pull/4918

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42840] `type` takes **kwargs for __init_subclass__

2021-01-08 Thread Erik Soma


Change by Erik Soma :


--
keywords: +patch
pull_requests: +23000
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24173

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42840] `type` takes **kwargs for __init_subclass__

2021-01-06 Thread Guido van Rossum


Guido van Rossum  added the comment:

Excellent!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42840] `type` takes **kwargs for __init_subclass__

2021-01-06 Thread Erik Soma


Erik Soma  added the comment:

Can do.

I have found a blurb in the 3.6 What's New that confirms it was purposeful 
(https://docs.python.org/3/whatsnew/3.6.html#index-37).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42840] `type` takes **kwargs for __init_subclass__

2021-01-06 Thread Guido van Rossum


Guido van Rossum  added the comment:

That sounds intentional to me (else the class statement would have a capability 
that cannot be dynamically emulated by calling type()).

We should probably update the docs (if you could submit a small PR that would 
be appreciated) and also typeshed (ditto).

--
nosy: +gvanrossum

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42840] `type` takes **kwargs for __init_subclass__

2021-01-06 Thread Erik Soma


New submission from Erik Soma :

The documentation (https://docs.python.org/3/library/functions.html#type) shows 
type's signature as:

class type(object)
class type(name, bases, dict)


But the "actual" 2nd signature in CPython 3.6+ is:

class type(name, bases, dict, **kwargs)


**kwargs here gets passed to __init_subclass__ in the same way that keywords in 
a class statement do so that:

type("Bar", (Foo,), {}, spam='ham')

is equivalent to

class Bar(Foo, spam='ham'): pass


It's not clear to me whether this is behavior to rely on. I started using this 
intuitively, but found that my type checker reasonably complained.

Looking through the commit that implemented PEP 487 (d78448e9), it seems this 
may have been incidental. Additionally I haven't found mention of this in PEP 
487 or the documentation and I can't seem to find any tests for it.

--
messages: 384506
nosy: esoma
priority: normal
severity: normal
status: open
title: `type` takes **kwargs for __init_subclass__
type: behavior
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com