[melbourne-pug] Data type assumptions in Python

William ML Leslie william.leslie.ttg at gmail.com
Thu Sep 5 10:37:58 CEST 2013


On 4 September 2013 19:09, Clare Sloggett <claresloggett at gmail.com> wrote:
> Lack of types are the cause of most of my python issues too. Maybe we need
> types that you don't HAVE to declare if you don't want :)

I've had a few people say something like this to me over the years.
Do many of you find this to be the case?  I could probably count the
number of times I've had a type-related error in python code on one
hand, of those, I only know of one that would have been caught by a
traditional simple static type system a-la Java (specifically,
iterating over dicts yields keys, which is the correct behaviour, but
after working in other languages, I often write "for key, value in
the_dict:" as if it were in muscle memory).

I've spent the last few months of afternoons using mostly statically
typed languages (working on some projects in Haskell, experimenting
with Idris and Agda for some future research).  Having dependant types
is very useful, but because of the mental energy required in getting
the types right, I certainly feel I write a lower quality of code in
those languages.  The "type system" of my python code, on the other
hand, is always pretty straightforward, because it describes precisely
what I need it to.  Hopefully, the module documentation describes all
you need to know to pass me the right data.

The cause of most of MY issues are the fact that Haskell somehow
thinks that open imports are a reasonable default.  You want to search
for the definition of this data type?  Good luck with that, even etags
gets it wrong.  You want to find usages of this constructor?  You'll
need to grep for it.  You only want to know about its appearance in
patterns, or only in applications?  You wish.  A fantastic static type
system that is of no assistance to you at all.  Wheras in python,
people who write large projects assume you're going to want greppable
method names and decent import statements.

-- 
William Leslie

Notice:
Likely much of this email is, by the nature of copyright, covered
under copyright law.  You absolutely may reproduce any part of it in
accordance with the copyright law of the nation you are reading this
in.  Any attempt to deny you those rights would be illegal without
prior contractual agreement.


More information about the melbourne-pug mailing list