News for hackers. Stuff that matters.
Re:Stop passing naked dictionaries around: Introducing DStru... by marshallp on Thursday November 24, 2011 @10:08AM (#3274497)
Why not move on to using ocaml (or shudder haskell) if you need types, adding types python seems like a pretty big undertaking
Re:Stop passing naked dictionaries around: Introducing DStru... by andrewcooke on Thursday November 24, 2011 @01:54PM (#3275104)
it's difficult to explain everything in a short post, but the type checking part is really a "free extra" that comes from adding type-related metadata that can be used for many other purposes. for example, pytyp can convert between nested json dictionaries and python objects simply by introspecting type annotations. so the motivation was not so much to change the language, but more to explore how type-related annotations could be used in a language like python, in a useful way, without making it something other than python.

in other words, the library is the end result of a process of exploration of some ideas that interested me related to metadata and types in a dynamic language. it's not an attempt to make python like another language, although (of course) it borrows ideas from those languages (because people have already spent a lot of time thinking about how to make a type system orthogonal and elegant).

and because it's dynamic, metadata-based, uses reflection, and works with duck typing, pytyp's type checking is inefficient for global use. it makes more sense as a check when debugging than a global language feature.

Re:Stop passing naked dictionaries around: Introducing DStru... by dorkitude on Thursday November 24, 2011 @01:20PM (#3275018)
Explicit types are neither pythonic nor unpythonic: always using explicit types is unpythonic, but explicit is better than implicit is an important piece of 'import this'.

I released DStruct because it has been insanely useful in my work. Take it or leave it, but do so pragmatically: dogma is a terrible way to make decisions.

Re:Stop passing naked dictionaries around: Introducing DStru... by marshallp on Thursday November 24, 2011 @01:59PM (#3275120)
I'm not being dogmatic. I'm a proponent of dynamic/typing and oo, they all fit perfectly in their use cases. I'm just not fan of mixing things up, the right tool for the right job. If you need types in python, you're writing a significant program in which case it's better to switch to java or better yet ocaml/haskell.
Re:Stop passing naked dictionaries around: Introducing DStru... by dorkitude on Thursday November 24, 2011 @03:33PM (#3275347)
So you're saying one shouldn't write significant programs in Python?

With that I must disagree :)

Re:Stop passing naked dictionaries around: Introducing DStru... by marshallp on Thursday November 24, 2011 @03:52PM (#3275386)
Well, either programming language researchers such as simon peyton jones are wrong, or developers such as google employee working on appengine, guido van rossum is wrong.
Re:Stop passing naked dictionaries around: Introducing DStru... by dorkitude on Sunday November 27, 2011 @06:22PM (#3283708)
This is a subject near and dear to my heart, and I'm sure we could have a lovely chat about this -- got Skype?
Re:Stop passing naked dictionaries around: Introducing DStru... by marshallp on Monday November 28, 2011 @08:13AM (#3285691)
i've added my email to my profile. however, i'm an antisocial recluse and never skype/im. there's lambda-the-ultimate if you're into programming languages, far more knowledgeable people than me hang out there.