Wednesday, June 8, 2016

imports of no import

The Python standard library has hundreds of built-in modules (mine has 688 by one count). Some are more useful than others.

The most famous is "import this", which prints out the Zen of Python. The next most popular fun module could well be antigravity. Try importing it on a browser-capable machine, and (spoiler), you'll be taken here.

And Randall is right. As most people know, Python's "Hello world" is just one line: "print 'Hello world'"

But what if there were another, more confusing way to do it? Taking a page out of ow about:

>>> import __hello__
"Hello world..."

And, because it's a one-time module import, this super-useful module only works the one time:

>>> import __hello__

It even breaks that behavior on Python 3:

>>> import __hello__
"Hello world!"

And if that wasn't esoteric enough of an import, how about even more new syntax in Python 3:

>>> from __future__ import barry_as_FLUFL
>>> 'a' <> 'b'
>>> 'a' <> 'a'
This unfortunate syntax is the result of an April Fools PEP from 2009. Before this, previous attempts at introducing new syntax were met with a stiffer upper lip:

>>> from __future__ import braces
  File "<stdin>", line 1
SyntaxError: not a chance

All of which raises the question: how many undocumented jokes have made their way into Python?


Credit to Python core dev Raymond Hettinger and other Twitter friends for details and inspiration.


  1. Excellent post, I agree with you 100%! I’m always scouring the Internet for new information and learning whatever I can, and in doing so I sometimes leave comments on blogs. Website Designing Bangalore | Web Design Companies Bangalore

  2. Cool post, thanks. Speaking about online technologies. I suggest to keep your paperwork stored online. Read about dataroom software and everything will be clear.

  3. This is quite educational arrange. It has famous breeding about what I rarity to vouch. Colossal proverb.
    This trumpet is a famous tone to nab to troths. Congratulations on a career well achieved. This arrange is synchronous s informative impolites festivity to pity. I appreciated what you ok extremely here 

    Selenium training in bangalore
    Selenium training in Chennai
    Selenium training in Bangalore
    Selenium training in Pune
    Selenium Online training

  4. Hey Nice Blog!! Thanks For Sharing!!!Wonderful blog & good post.Its really helpful for me, waiting for a more new post. Keep Blogging!
    SEO company in coimbatore
    Digital Marketing Company in Coimbatore
    SEO Services in coimbatore

  5. Really awesome blog. Thanks for sharing this informative blog.

    Website Designing Company in Delhi

  6. Excellent post, i agree with you. i always searching new things in internet and improve my knowledge.
    website design company in ghansoli | website development company in ghansoli

  7. Thanks for sharing this article. Very inspiring and impactful.
    Best Mobile App Development Company

  8. This comment has been removed by the author.

  9. Sky Potential is a trusted custom software development company that is delivering complex solutions worldwide since 2013. It provides all-around services from artificial intelligence services to software maintenance and enhancement.
    Backend tech stack: PHP, Java, .Net, Python, Node.js;
    Front-end technologies: JavaScript, ReactJS, Angular, Knockout, Bootstrap, Vue, Backbone;
    Mobile stack: iOS Native, Android Native, React Native, Apache Cordova, Ionic, Qt, Xamarin, Flutter, Meteor.

  10. I am providing HQ Backlinks any one need these kinds of backlinks just click here and order me in $5 on Fiverr click here and get my service SEO Service

  11. Independent of the advantages or difficulties it brings, every one of these inquiries can be abridged into one. machine learning certification

  12. awesome blog it's very nice and useful i got many more information it's really nice i like your blog styleweb design company in velachery