Mercurial > hg > config
annotate python/example/classes.py @ 694:ebca6d85213a
File "/usr/lib/python3/dist-packages/IPython/config/__init__.py", line 16, in <module>
from .application import *
File "/usr/lib/python3/dist-packages/IPython/config/application.py", line 31, in <module>
from IPython.config.configurable import SingletonConfigurable
File "/usr/lib/python3/dist-packages/IPython/config/configurable.py", line 33, in <module>
from IPython.utils.text import indent, wrap_paragraphs
File "/usr/lib/python3/dist-packages/IPython/utils/text.py", line 28, in <module>
from IPython.external.path import path
File "/usr/lib/python3/dist-packages/IPython/external/path/__init__.py", line 2, in <module>
from path import *
File "/home/jhammel/python/path.py", line 25
print root(path)
^
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Wed, 09 Jul 2014 16:26:49 -0700 |
parents | 870af8d51552 |
children |
rev | line source |
---|---|
626
89a72399286b
adding file demonstrating classes
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
89a72399286b
adding file demonstrating classes
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
2 |
89a72399286b
adding file demonstrating classes
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
3 """ |
89a72399286b
adding file demonstrating classes
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
4 illustrate how classes work |
89a72399286b
adding file demonstrating classes
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
5 """ |
89a72399286b
adding file demonstrating classes
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
6 |
89a72399286b
adding file demonstrating classes
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
7 class A: |
89a72399286b
adding file demonstrating classes
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
8 pass |
89a72399286b
adding file demonstrating classes
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
9 |
627
870af8d51552
STUB: python/example/classes.py
Jeff Hammel <k0scist@gmail.com>
parents:
626
diff
changeset
|
10 tests = ["issubclass(A(), A)", |
870af8d51552
STUB: python/example/classes.py
Jeff Hammel <k0scist@gmail.com>
parents:
626
diff
changeset
|
11 "issubclass(A, A)"] |
626
89a72399286b
adding file demonstrating classes
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
12 |
89a72399286b
adding file demonstrating classes
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
13 if __name__ == '__main__': |
89a72399286b
adding file demonstrating classes
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
14 for test in tests: |
89a72399286b
adding file demonstrating classes
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
15 print ("? {}".format(test)) |
627
870af8d51552
STUB: python/example/classes.py
Jeff Hammel <k0scist@gmail.com>
parents:
626
diff
changeset
|
16 try: |
870af8d51552
STUB: python/example/classes.py
Jeff Hammel <k0scist@gmail.com>
parents:
626
diff
changeset
|
17 print (eval(test)) |
870af8d51552
STUB: python/example/classes.py
Jeff Hammel <k0scist@gmail.com>
parents:
626
diff
changeset
|
18 except Exception as e: |
870af8d51552
STUB: python/example/classes.py
Jeff Hammel <k0scist@gmail.com>
parents:
626
diff
changeset
|
19 print ('{}'.format(repr(e))) |