Re: Typing Number, PyCharm

2023-02-06 Thread Weatherby,Gerard
l-type And the Decimal definition I’m finding says: class Decimal(object): yet print(issubclass(Decimal,Number)) returns True. From: Paul Bryan Date: Monday, February 6, 2023 at 9:25 AM To: Weatherby,Gerard , dn , 'Python' Subject: Re: Typing Number, PyCharm *** Attention: This is an external emai

Re: Typing Number, PyCharm

2023-02-06 Thread Paul Bryan
On Mon, 2023-02-06 at 12:11 +, Weatherby,Gerard wrote: > On the one hand, it is a well-known type, so it should be > recognizable to users of an API. On the other hand, Number is > entirely abstract, so it doesn’t provide useful type checking for the > implementation; I had to add #

Re: Typing Number, PyCharm

2023-02-06 Thread Weatherby,Gerard
uble(value: Numeric): if isinstance(value, Numeric): return 2 * value raise ValueError(f"{value} of {type(value)} is not Numeric") works (>= 3.10) From: dn Date: Sunday, February 5, 2023 at 2:54 PM To: Weatherby,Gerard , 'Python' Subject: Re: Typing Number

Re: Typing Number, PyCharm

2023-02-05 Thread dn via Python-list
ction(7, 8))) /# print(double("7")) PyCharm properly complains/ *From: *Python-list on behalf of dn via Python-list *Date: *Saturday, February 4, 2023 at 9:32 PM *To: *'Python' *Subject: *Typing Number, PyCharm *** Attention: This is an external email. Use caution responding, opening att

Re: Typing Number, PyCharm

2023-02-05 Thread Weatherby,Gerard
ay, February 4, 2023 at 9:32 PM To: 'Python' Subject: Typing Number, PyCharm *** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. *** Do we have a typing type-hint for numbers yet? Often wanting to combine int and float, discovered that an a

Typing Number, PyCharm

2023-02-04 Thread dn via Python-list
Do we have a typing type-hint for numbers yet? Often wanting to combine int and float, discovered that an application was doing a walk-through with/for uses three numeric types. Was intrigued to note variance, in that the code-set features two different methods for typing, in this situation: