Hacker News new | past | comments | ask | show | jobs | submit login

While the semicolon is only a convenience it has some common use cases. For example shoot-and-forget invokations of third party modules:

  import sys; sys.exit()
  import pdb; pdb.set_trace()
  import cgitb; cgitb.enable()
  import psyco; psyco.full()
  import pygtk; pygtk.require('2.0')
And of course it's pretty useful in environments where one-liner are easier to handle:

  $ python -c "import mymod; mymod.test()"



Now that I look in my code I actually have:

    import matplotlib; matplotlib.use('Agg'); from matplotlib import pyplot




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: