Discussion forum for David Beazley

The Fun of Reinvention - PyCon Israel - June 12, 2017


Invited opening keynote talk for the conference.


Hello, David! Cool topic, Im very interested in such tools like type checking, validation, etc. Do you know libraries which exposing your idea or maybe you are gonna write your own? I would be very happy if you share some additional material about this topic (code, links, etc) =) I saw only this lib - typecheck-decorator, but I think your approach is much cleaner. Thanks!


To be honest, diving deep into the checking/validation stuff is not something I’ve thought deeply about from a practical perspective (i.e., using it in actual project). So, I don’t really have any opinions about this idea with respect to third-party packages. The main point of doing it in the talk was to explore some new Python 3.6 features and to see them used together in the context of something interesting.

If I were to expand the framework written in the talk into something more real, I’d probably spend a lot more time focused on useful exception messages and maybe using something other than simple assert statements (which were mainly used to expedite time in a live-coding situation).

The other somewhat dubious facet of the talk is the use of type-annotations. It’s possible that such a framework would get into some kind of war with mypy or other tools that want to use those as well. So, I just don’t know (although I think they can be used for interesting things outside that context).


Awesome talk!  I’ve been playing around with Python magic over the last few months, posted some similar stuff on Reddit recently (Type Managed Attribute Loader and Auto-Assign Arguments).  Definitely learned a lot from your video & will be [revisiting, cleaning up, expanding] those projects to make use of some of the implementations you went over.

Any chance you could share the code from the video as a Gist?


Check out:


    @ GitHub


Can you tell, what you use for code editing?
It’s Emacs with some addons?


The talk was given using a completely custom-written Python program running in the terminal (iTerm2). No third party extensions–just Python standard library functions (although fairly heavy use of the builtin termios module).


Hello, awesome talk and I’ve learned tons!
There is only on thing I’m struggling to understand from the presentation. In the last metaclass example why do we throw away _contracts part of the chainmap before calling the type.new . It seemed to me that the idea is to capture the contracts in the dictionary that is then used as context to create the class. But we throw away contracts before calling the class constructor. How does the new class that is being created sees contracts? And then why do we create the chainmap in the first place? Thanks!


I agree with all of these points, but just for my own edification and learning, I’ve implemented your code in a fork of validus here (with a pull request that needs work to pass the travis tests – working on it). I am a fan of Validus just for its simplicity and this seemed like a nice place to build off of.

This has some similarity to attrs, but I like the idea of having something that I can copy and customize as my base class (assert this but warn that and ignore the other) so I view it more as a “here is a nice base to customize from” than, here is something that you should use out of the box. The documentation I’ve written reflects this.

I am personally interested in this as I’ve liked the idea of Enthought’s traits, but I’ve never liked the implementation (it clutters up the namespace too much). This is a nice start towards something I might like better with Validus providing the underlying validation, and contract.py providing the tricks to something cleaner.

So thanks for the talk. Fun stuff!


Hello! I enjoy this talk very much, and I’m dying to know how you did the presentation part of it. Are you using some sort of special in-slideshow interpreter? I would love to be able to use this, whatever it is.



The presentation was done in a completely custom written environment for the talk. It’s a mix of iTerm2 (inline image display) and termios (text display/editing features). Unfortunately, it’s not something in any kind of condition to release at the moment.