Skip to content
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

Update the QRcode? #63

Open
lewisxy opened this issue Mar 25, 2018 · 1 comment
Open

Update the QRcode? #63

lewisxy opened this issue Mar 25, 2018 · 1 comment

Comments

@lewisxy
Copy link

lewisxy commented Mar 25, 2018

This is by far the best QRcode tool in python I can find, except this minor problem...
After I create the object using code = pyqrcode.create("somedata"), I find no way to change the data once the object is created. In other words, there is no function like update(self, data), which allows the data to be updated.

PS. I have tried to change the content through code.content = "something different", but it doesn't change anything. After I read the code I know this is not possible because there is no function in the class QRcode that could update the backend builder class.

I know I can simply create a new object with different content, but isn't it better to reuse the object?

@heuer
Copy link
Contributor

heuer commented Mar 25, 2018

Having an immutable QR Code is a design decision.

An update(self, data) method would require an additional method, like "make(self)" to know when the QR Code should be updated or each invocation of "update(self, data)" would require a new calculation of the internals of QR code (checking the input, calculating the data and error code words, finding a mask, etc.).

Do you think that the object creation is too expensive or why do want an update method?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants