the same thing.)
I was thinking "TypeVarList" originally, but I also like "TypeListVar".
--
David Foster | Seattle, WA, USA
Contributor to TypedDict support for mypy
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscr
`AsyncType`, the __new__ and __init__
methods must be async methods (returning coroutines).
I like the idea in principle but I don't currently use any async
libraries so my opinion may not count much here. ;)
--
David Foster | Seattle, WA, USA
___
P
20 10:02 AM, Abdulla Al Kathiri wrote:
> Regardless of how itβs done, the less we depend on the typing module for
> annotations, the better I think because it encourages python users to
> annotate their functions.
Indeed. (+1)
--
David Foster | Seattle, WA, USA
__
a `type`, otherwise
None."""
raise NotImplementedError()
Now, I'm not sure if mypy can handle that kind of recursive TypedDict
definition :), but it *will* work at runtime.
I'll see about implementing a function like try_cast() as a separate
package.
This should be f
work if isinstance() was defined for:
* Union[T1, T2], Optional[T]
* T extends TypedDict
* Literal['foo']
For arbitrary JSON beyond the example, we'd also want to support
isinstance() for:
* List[T]
We already support isinstance() for the other JSON primitive types:
On 11/19/20 10:08 PM, David Foster wrote:
I've completed my survey of how other languages use pattern matching to
match Mapping-like and dict-like types, especially focusing on whether
they ignore (πΈ) or disallow (πΉ) extra keys by default. [...]
To close the loop on this thread:
* Bas
t)
πΈβ
* PHP
βοΈ
* Lua
βοΈ
* Python (current draft of PEP 634-636)
πΈβ
Statically-typed languages:
* OCaml
π€·ββοΈ
* Scala
π€·ββοΈ
* Swift
π€·ββοΈ
* Rust
π€·ββοΈ
* Haskell
π€·ββοΈ
* C++
π€·ββοΈ
hoice?
- which languages ignore extra keys? do users of those languages
consider this feature a bug, a wart, or a feature?
If useful I can volunteer to conduct such a survey. I expect to have
some cycles this coming weekend.
--
David Foster | Seattle, WA, USA
Contributor to TypedDict support for
ing tends to default to stricter matching. :)
--
David Foster | Seattle, WA, USA
Contributor to TypedDict support for mypy
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.
#x27;TodoItem_ReadWrite', {'title': str,
'completed': bool, 'extra': Dict[str, Any]})
def parse_todo_item(todo_item_json: Dict) -> TodoItem_ReadWrite:
match todo_item_json:
case {'title
proposed to accept such a broader
second argument.)
David Foster | Seattle, WA, USA
On 3/1/19 8:26 AM, Steven D'Aprano wrote:
Attached is a draft PEP on adding + and - operators to dict for
discussion.
This should probably go here:
https://github.com/python/peps
but due to technical difficu
t from "or". Reads
the same out loud despite being a different operator.
* -1 for "||" with none-aware semantics. This differs from the semantics
in every C-derived language I can think of, which will be confusing to
several other developers.
David Foster | Seattle, WA, USA
st is:
https://mail.python.org/pipermail/python-ideas/2015-September/035725.html
David Foster | Seattle, WA, USA
On 7/9/18 9:17 AM, Trent Nelson wrote:
On Sun, Jul 08, 2018 at 11:27:08AM -0700, David Foster wrote:
I'd like to solicit some feedback on what might be the most
efficient way to
I could do this by using an existing
library like Pykka or Thespian and extending it where necessary.
Thoughts?
[PEP 554]: https://www.python.org/dev/peps/pep-0554/
--
David Foster | Seattle, WA, USA
___
Python-ideas mailing list
Python-ideas@python.org
the expression_list is a slice expression, which
would be even more bizarre code. Best to make bizarre cases into errors.
Cheers,
--
David Foster | Seattle, WA, USA
On Sat, Mar 17, 2018 at 12:13 AM, Chris Angelico wrote:
> On Sat, Mar 17, 2018 at 5:49 PM, David Foster wrote:
> > (3a)
eliminate unintentional errors.
(3b) With a local scope (in proposal #2 above), a named expression simply
replaces any preexisting local with the same name. (Or it would replace the
global/nonlocal if a global/nonlocal statement was in use.) There is no
shadowing per-se.
Cheers,
--
David Foster | Sea
r than (?it=) since I find it reads nicer. Also is
consistent with existing syntax (with expr as var).
Cheers,
David
--
David Foster | Seattle, WA, USA
On 2/15/18 6:06 PM, Nick Coghlan wrote:
The recent thread on variable assignment in comprehensions has
prompted me to finally sha
17 matches
Mail list logo