object_name = ClassName()
# Main program
|
|
# agentframework.py
|
import agentframework
agent_1 = agentframework.Agent()
from agentframework import Agent
agent_1 = Agent()
This just imports this one class.
print(type(agent_1)) #
print(isinstance(agent_1, agentframework.Agent)) # True
class Agent():
def __init__ (self):
pass
agent_1 = agentframework.Agent()
class Agent() :
def hi(self):
print("hello world")
--------------------------------
agent_1 = agentframework.Agent()
agent_1.hi()
agent_1 = agentframework.Agent()
def __init__ (self):
a = "hello world"
a.upper()
str.upper(a)
# Main program
|
|
# agentframework.py
|
# Main program
|
|
# agentframework.py
|
class Agent():
def __init__ (self, y, x):
self.y = y
self.x = x
pt1 = agentframework.Agent(100,50)
agent_1 = agentframework.Agent()
agent_2 = agentframework.Agent()
agent_1.y = 48
agent_2.y = 44
print(agent_1.y) # 48
a = A()
b = A() # Same content as 'a' but different object.
c = a # Same object, two labels.
a is c # True - same object.
a is b # False
a == b # True - same content, different objects.
# But only true where supported, e.g. numbers and strings.
# Main program
|
|
# agentframework.py
|
object_name.variable_name
# module start
|
# module start
|
agent_1 = agentframework.Agent()
print(agent_1.variable)
print(agentframework.Agent.variable)