I have this class bgp_route:
class bgp_route:
def _init_(self, path):
self.nextHop = None
self.asPath = ''
self.asPathLength = 0
self.routePrefix = None
However, when I run the following test code;
from bgp_route import bgp_route
testRoute = bgp_route()
testRoute.asPath += 'blah'
print testRoute.asPath
I get the following error:
Traceback (most recent call last):
File "testbgpRoute.py", line 6, in <module>
testRoute.asPath += 'blah'
AttributeError: bgp_route instance has no attribute 'asPath'
What is the cause of this error? Shouldn't the instantiate of bgp_route have initialized the attribute asPath to the empty string?