On Sat, Jan 16, 2021 at 9:25 AM Eli the Bearded <*@eli.users.panix.com> wrote: > > In comp.lang.python, Chris Angelico <ros...@gmail.com> wrote: > > Michael F. Stemper <mstem...@gmail.com> wrote: > >> On 15/01/2021 14.01, Stefan Ram wrote: > >>> __import__( "math" ).sqrt( 4 ) > >> I had no idea that syntax existed, and find it completely at odds > >> with The Zen of Python. I'm torn between forgetting that I ever saw > >> it and using it for some evilly-obfuscated code. > > I recommend option #2. It is incredibly good fun. For added bonus > > obscurity, don't import a module directly; import it from some > > unrelated module, such as "from ast import sys" or "from base64 import > > re". > > Is there an Obfuscated Python contest, like there is with C? I know the > C ones are often quite interesting, like the 2020 entry that implements > tic-tac-toe in "Turing complete" sub-language of printf() format strings. > (Carlini, http://www.ioccc.org/years.html#2020 ) >
No there isn't, but similar abominations have showed up in security testing. Attempts to (a) create a sandboxed Python, and then (b) break out of said sandbox, have produced some fairly terrifying (and quite awesome) demonstrations. ChrisA -- https://mail.python.org/mailman/listinfo/python-list