mardi 28 mars 2017

Pushing Python introspection to limits

Simple question – can I print the source code of this if?

if args and args[0][0] == '-':
  if args[0] in ('--help','-h','-?'):
    print_source_of_block(level=2)
  icase = 'i' in args[0]
  desc = 'd' in args[0]
  args = args[1:]

Please don't ask me why I need it, nor give me advice on how to write user help. I want to know it because I'm curious.





Aucun commentaire:

Enregistrer un commentaire