Dreaming of new generation IDE
Terry Reedy
tjreedy at udel.edu
Wed Feb 3 17:24:50 EST 2010
On 2/3/2010 8:18 AM, Adam Tauno Williams wrote:
> class.method(sting name, int count)
>
> - is *obviously* more expressive than -
>
> class.method(name, count)
So write
class.method(name:str, count:int)->return_type # 3.x
if you really prefer.
In spite of you disparagement of 'pythonistas', it seems that the head
pythonista *did* admit that some people, at least, would prefer such
annotations.
3.0 also added abstract base classes so one can better specify object
classes without losing duck-typing.
import numbers
class.method(name:str, count:numbers.Integral)->return_type
Now one is documenting that count should be an integral value that acts
like an integer even if it is not an int per se. Of course, this is too
broad as it allows (presumably invalid) negative values.
Terry Jan Reedy
More information about the Python-list
mailing list