I don’t write much Python these days, but as a Schemer interested in macros, I used to try out all sorts of stuff. There was one really good attempt: MetaPython which hasn’t had a release since 2009. I think that was the one I felt worked best, so if you’re still interested, you might play with it.
Also, this is awesome! And, I don’t know much rust, but I did not realize that what I would call “pragmas” are powered by macros (in hindsight this makes total sense!), making them accessible for all sorts of hackery and wizardry. Thanks for sharing!
I do! A long time ago I had a similar project called Ruse, which aimed to be a compliant Scheme on top of Python 2, which fizzled before I prepped it for release. I’m happy that someone else, independently, thought the idea of a Lisp targetting Python was good. :)
I think you might enjoy the complete works of Oleg Kiselyov, full of mind-bending trickery in Scheme, ML and others. I sometimes wish I could just set aside a year and thoroughly study and understand what Oleg is publishing.
Maybe not the most useful but fun read never the less and clever (ab)use of abstract base classes.
On a side note: Your site is a bit buggy on iOS (13), lots of unreachable links etc.
And must say that I’m fan of your stuff, I’m a strong believer in property based testing. After having Mr QuickCheck himself, John Hughes as a university professor I was bitten for life, and much enjoyed your talk at PyCon last year.
I think this is a great example of what types can be: the explicit (what it is) or implicit (what it isn’t) definition of a set of possible values within the superset of all possible values. This set-like perspective on types opens the door to thinking of types as constraints within an infinite space – maybe it’s what type theorists already do, but as someone who comes more from soft.eng than comp.sci the moment I realized that was definitely an “aha” moment.
It’s nice to see someone else abusing Python for the sake of fun. I’ve blogged in the past about many hacks, including: let, attempting to make call/cc, worlds, pattern matching with with, and dispatching with with. Basically, yes, yes, yes, more of this kind of stuff! It makes languages really fun.
I’ll join this party :) I figured out how to make Rust-like macros in Python by stuffing things in type-annotations, which you can read here.
I don’t write much Python these days, but as a Schemer interested in macros, I used to try out all sorts of stuff. There was one really good attempt: MetaPython which hasn’t had a release since 2009. I think that was the one I felt worked best, so if you’re still interested, you might play with it.
Also, this is awesome! And, I don’t know much rust, but I did not realize that what I would call “pragmas” are powered by macros (in hindsight this makes total sense!), making them accessible for all sorts of hackery and wizardry. Thanks for sharing!
Do you know about Hy?
I do! A long time ago I had a similar project called Ruse, which aimed to be a compliant Scheme on top of Python 2, which fizzled before I prepped it for release. I’m happy that someone else, independently, thought the idea of a Lisp targetting Python was good. :)
It sounds like you’d enjoy my (now quite old) blog post about abusing encodings in Python: http://benjiyork.com/blog/2008/02/programmable-python-syntax-via-source.html
Thanks, that is amazing.
Very relatedly, I blogged about sourefiles using built in rot13 with a starting comment
#encoding: rot13
that then have all Sourcecode encoded: https://frederik-braun.com/rot13-encoding-in-python.htmlI think you might enjoy the complete works of Oleg Kiselyov, full of mind-bending trickery in Scheme, ML and others. I sometimes wish I could just set aside a year and thoroughly study and understand what Oleg is publishing.
I sometimes ask the question, legitimately, “What would Oleg do?” – Yes, aware. But similar to you, completely understudied due to time.
Maybe not the most useful but fun read never the less and clever (ab)use of abstract base classes.
On a side note: Your site is a bit buggy on iOS (13), lots of unreachable links etc. And must say that I’m fan of your stuff, I’m a strong believer in property based testing. After having Mr QuickCheck himself, John Hughes as a university professor I was bitten for life, and much enjoyed your talk at PyCon last year.
Keep it up!
Aw cripes. Could you message me some of the broken links? I don’t have access to any apple hardware and AWS device farm only goes up to iOS 12.
I couldn’t find anything broken on 13.1 just a moment ago. This article and a few others I checked on your blog certainly work fine.
I think this is a great example of what types can be: the explicit (what it is) or implicit (what it isn’t) definition of a set of possible values within the superset of all possible values. This set-like perspective on types opens the door to thinking of types as constraints within an infinite space – maybe it’s what type theorists already do, but as someone who comes more from soft.eng than comp.sci the moment I realized that was definitely an “aha” moment.
completely useless and fun to read :)
Oh my god, the bane of my existence.