Search found 1306 matches

by deshipu
Fri Jun 15, 2018 11:24 am
Forum: Development of MicroPython
Topic: Finaliser/__del__
Replies: 8
Views: 124

Re: Finaliser/__del__

What would be situations in which it is not called ? It's implementation-dependent. In CPython 2.x it wouldn't get called if the object is a part of a cycle of references, for example — because it's then impossible to guess the correct order of destroying such objects, as the __del__ methods in the...
by deshipu
Fri Jun 15, 2018 11:01 am
Forum: General Discussion and Questions
Topic: How to free memory after unused imports?
Replies: 8
Views: 177

Re: How to free memory after unused imports?

The more complex it is, the bigger a chance that you will have some reference to one of its variables or classes left somewhere. Especially when the module runs code on import, and not only defines some variables and classes.

Also, strings literals and variable names are interned and never released.
by deshipu
Thu Jun 14, 2018 5:54 pm
Forum: Development of MicroPython
Topic: Finaliser/__del__
Replies: 8
Views: 124

Re: Finaliser/__del__

Note that __del__ is not guaranteed to be called, and when it's being called, it's not guaranteed that all the functions and variables you take for grated will still be available in memory.

If you need to call some code at the end of a scope, it's much better to use a context manager.
by deshipu
Thu Jun 14, 2018 5:36 pm
Forum: General Discussion and Questions
Topic: How to free memory after unused imports?
Replies: 8
Views: 177

Re: How to free memory after unused imports?

It's an object as anything else, and it gets released as soon as there are no more references to it. When you only import a module, and don't do anything else with it, like in this example, there are only two places that have references to it (assuming the module itself doesn't do any monkeypatching...
by deshipu
Thu Jun 14, 2018 11:12 am
Forum: General Discussion and Questions
Topic: How to free memory after unused imports?
Replies: 8
Views: 177

Re: How to free memory after unused imports?

It's still kept in sys.modules, you have to delete it from there.
by deshipu
Tue May 29, 2018 12:01 pm
Forum: General Discussion and Questions
Topic: PyConAu Talk - any suggestions?
Replies: 13
Views: 378

Re: PyConAu Talk - any suggestions?

Great forum post. I was dismayed that PyCon at Portland appeared to have nothing covering Micropython this year... Well, there was a development board running it in the swag bag, a birds-of-feather meeting, and quite some coding done during the sprints. I wouldn't call that "nothing". Oh dear! Apol...
by deshipu
Mon May 28, 2018 3:06 pm
Forum: General Discussion and Questions
Topic: PyConAu Talk - any suggestions?
Replies: 13
Views: 378

Re: PyConAu Talk - any suggestions?

Personally I would love to see a presentation talking about the techniques and best practices that could be used to write library (sensor driver) code that would be compatible with all the released versions and ports of MicroPython out there, without having to add a new library every time someone de...
by deshipu
Mon May 28, 2018 2:57 pm
Forum: General Discussion and Questions
Topic: PyConAu Talk - any suggestions?
Replies: 13
Views: 378

Re: PyConAu Talk - any suggestions?

philwilkinson40 wrote:
Mon May 28, 2018 8:12 am
Great forum post. I was dismayed that PyCon at Portland appeared to have nothing covering Micropython this year...
Well, there was a development board running it in the swag bag, a birds-of-feather meeting, and quite some coding done during the sprints. I wouldn't call that "nothing".
by deshipu
Fri May 18, 2018 6:56 am
Forum: Drivers for External Components
Topic: Drivers for Waveshare 2.13inch E-Ink display
Replies: 50
Views: 9618

Re: Drivers for Waveshare 2.13inch E-Ink display

Is there a solution to this, the screen blinking 5 or 6 times really is not pretty and to do this every 5 seconds would make it un-usable ! Well, if you look at what the book readers do, you will see the solution that they came up with: keep a counter of the partial updates, and once it reaches a c...
by deshipu
Thu May 17, 2018 4:16 pm
Forum: General Discussion and Questions
Topic: converting png file to bytearray
Replies: 23
Views: 453

Re: converting png file to bytearray

stijn wrote:
Thu May 17, 2018 1:28 pm
But you're right, my mistake, it's not a standard in the sense of 'ISO standard xxx'. Let's just call it 'the widely used BMP file format' then as described here for instance: https://en.wikipedia.org/wiki/BMP_file_format
Which of the 4 different formats described there?