why sqrt is not a built-in function?

Chris Angelico rosuav at gmail.com
Fri Jan 15 17:28:20 EST 2021


On Sat, Jan 16, 2021 at 9:25 AM Eli the Bearded <*@eli.users.panix.com> wrote:
>
> In comp.lang.python, Chris Angelico  <rosuav at gmail.com> wrote:
> > Michael F. Stemper <mstemper at 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


More information about the Python-list mailing list