Skip to content Skip to sidebar Skip to footer
Showing posts with the label Typing

Clean And Type-safe State Machine Implementation In A Statically Typed Language?

I implemented a simple state machine in Python: import time def a(): print 'a()' r… Read more Clean And Type-safe State Machine Implementation In A Statically Typed Language?

How To Reduce Boilerplate When Initializating Classes From Jsons In Python 3.5?

I have a set of python webservices that work with data objects they get via a JSON POSTs. In my old… Read more How To Reduce Boilerplate When Initializating Classes From Jsons In Python 3.5?

How To Define An Alias For A Type In Python For Type Hinting

How to define an alias for a type to use type hint: import typing type Ticker str # How to do this?… Read more How To Define An Alias For A Type In Python For Type Hinting

How Do I Type-hint That A Python Function Returns Instance Of Any Class Derived From A Superclass?

I've got a bunch of Django template inclusion tags, which take as an argument either a specific… Read more How Do I Type-hint That A Python Function Returns Instance Of Any Class Derived From A Superclass?

Correct Type Annotation For __init__

What is the correct type annotation for a __init__ function in python? class MyClass: ... Whic… Read more Correct Type Annotation For __init__