Skip to content

Instantly share code, notes, and snippets.

@prologic

prologic/test.py Secret

Created June 12, 2015 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prologic/66cf53e922f4412431ef to your computer and use it in GitHub Desktop.
Save prologic/66cf53e922f4412431ef to your computer and use it in GitHub Desktop.
(circuits)
prologic@daisy
Fri Jun 12 12:22:27
~/circuits
$ python
Python 2.7.9 (default, Mar 19 2015, 22:32:11)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from circuits import BaseComponent
>>> class A(BaseComponent):
... pass
...
>>> class B(BaseComponent):
... pass
...
>>> root = A("root")
>>> a = A("a")
>>> b = B("b")
>>> root + a
<A/* 27487:MainThread (queued=1) [S]>
>>> a + b
<A/* 27487:MainThread (queued=0) [S]>
>>> a - b
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "circuits/core/manager.py", line 274, in __sub__
if y.manager is not y:
AttributeError: 'B' object has no attribute 'manager'
>>> a -= b
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "circuits/core/manager.py", line 288, in __isub__
if y.manager is not y:
AttributeError: 'B' object has no attribute 'manager'
>>> b
<B/* 27487:MainThread (queued=0) [S]>
>>> b.manager
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'B' object has no attribute 'manager'
>>> a.manager
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'A' object has no attribute 'manager'
>>> root.manager
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'A' object has no attribute 'manager'
>>> root
<A/* 27487:MainThread (queued=2) [S]>
>>> root.components
set([<A/* 27487:MainThread (queued=0) [S]>])
>>> a.components
set([<B/* 27487:MainThread (queued=0) [S]>])
>>> b.components
set([])
>>> b.root
<A/* 27487:MainThread (queued=2) [S]>
>>> a.root
<A/* 27487:MainThread (queued=2) [S]>
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment