-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parent classes cannot be reloaded #9
Comments
Hi Alex, This behaviour is currently not supported: When you use This works fine when reloadr is used on a child class, but does not support inheritance. I renamed this issue as this is a behaviour I would like reloadr to support. |
Here is a complete example that fails to work: from time import sleep
from reloadr import reloadr
@reloadr
class Vehicle:
x = 0
y = 0
def __init__(self, x=0, y=0):
self.x = x
self.y = y
def move(self, dx=0, dy=0):
self.x += dx
self.y += dy
class Car(Vehicle):
def position(self):
return 'Car on {} {}'.format(self.x, self.y)
car = Car(1000, 3000)
while True:
car.move(1, 1)
print(car.position())
sleep(0.5)
Car._reload() |
Hi Hoh, |
Hi @zhangyq73 , can you please create a separate issue for this ? |
Hello, I encounter the following error "TypeError: init() takes 2 positional arguments but 4 were given" whenever I import the classes in a package I'm coding.
I get the previous error whenever I define a Child class, which inherits form a decorated Parent Class using autoreload, regardless if the Child class is decorated or not.
In reality I would like to decorate both classes since in my project I'd be heavily adjusting both.
I was wondering if this is simply not possible, if it is a mistake on my part, or if its a fixable error?
I'm currently using reloadr-0.4.1 and python 3.8.2
Here is a simple example that reproduces the behavior.
The text was updated successfully, but these errors were encountered: