In python for linux/windows __del__ happens immediately after exiting from a method scope or application's exit.
You can use it or not in your class definition for own risk as you use __init__ constructor.
So, freedom and flexibility is important
Search found 60 matches
- Thu Mar 12, 2020 10:45 am
- Forum: General Discussion and Questions
- Topic: Class destructor doesnt work in micropython?
- Replies: 11
- Views: 6586
- Thu Mar 12, 2020 8:15 am
- Forum: General Discussion and Questions
- Topic: Class destructor doesnt work in micropython?
- Replies: 11
- Views: 6586
Re: Class destructor doesnt work in micropython?
as i understand you use your own user defined method 'def deinit(self)'.
every developer can use own method to release object when there are a choices.
destructor is most native inmodern languages.
i asked about a 'del' keyword
every developer can use own method to release object when there are a choices.
destructor is most native inmodern languages.
i asked about a 'del' keyword
- Thu Mar 12, 2020 4:19 am
- Forum: General Discussion and Questions
- Topic: Class destructor doesnt work in micropython?
- Replies: 11
- Views: 6586
Class destructor doesnt work in micropython?
How to call class destructor in micropython? original documentation says "Special method __del__ not implemented" https://docs.micropython.org/en/latest/genrst/core_language.html What are you using to enter class destructor? class TFoo1(): def __init__(self): print('init') def __del__(self): print('...
- Tue Mar 03, 2020 6:22 am
- Forum: ESP8266 boards
- Topic: pack.calcsize('1b1I') = 1+4=8 !?
- Replies: 2
- Views: 2053
- Tue Mar 03, 2020 6:09 am
- Forum: ESP8266 boards
- Topic: pack.calcsize('1b1I') = 1+4=8 !?
- Replies: 2
- Views: 2053
pack.calcsize('1b1I') = 1+4=8 !?
Code: Select all
# size of byte is 1
print(struct.calcsize('1b'))
1
# size of integer is 4
print(struct.calcsize('1I'))
4
# size of byte + integer should be 5, but got 8
print(struct.calcsize('1b1I'))
8
- Fri Feb 28, 2020 4:34 pm
- Forum: ESP8266 boards
- Topic: 'goto' in micropython
- Replies: 11
- Views: 15368
Re: 'goto' in micropython
Thanks Peter for your posts here.
Your GitHub is also a good reading book
Your GitHub is also a good reading book
- Fri Feb 28, 2020 6:58 am
- Forum: ESP8266 boards
- Topic: how to WatchDog in ESP8266?
- Replies: 4
- Views: 3412
Re: how to WatchDog in ESP8266?
I installed esp-open-sdk, micropython sources and finanly have my own firmware with all my libraries integrated. (if some one needs a linux batch script to build firmvare write me privat) The free RAM size inceased from 11k to 19k, but application still crashes when i use hardware timer. without a t...
- Fri Feb 28, 2020 6:36 am
- Forum: ESP8266 boards
- Topic: 'goto' in micropython
- Replies: 11
- Views: 15368
Re: 'goto' in micropython
thanks everyone for ideas def LabeledNestedLoop(aMax): print('begin') try: for A in range(aMax): for B in range(aMax): for C in range(aMax): print(A, B, C) if (C > 3): raise StopIteration except StopIteration: #LabelEnd print('end')
- Thu Feb 27, 2020 4:44 pm
- Forum: ESP8266 boards
- Topic: how to WatchDog in ESP8266?
- Replies: 4
- Views: 3412
Re: how to WatchDog in ESP8266?
1) On ESP8266 the machine.WDT constructor takes either no arguments at all, or a single "id" argument, which must be zero. so you should be able to use WD = machine.WDT() What is a default timeout value for no arguments? 2) When i run a hardware timer and asyncroniously call gc.collect() than system...
- Thu Feb 27, 2020 11:15 am
- Forum: ESP8266 boards
- Topic: how to WatchDog in ESP8266?
- Replies: 4
- Views: 3412
how to WatchDog in ESP8266?
esp8266-v1.12 firmware https://docs.micropython.org/en/latest/library/machine.WDT.html import machine WD = machine.WDT(timeout=2000) TypeError: function doesn't take keyword arguments WD = machine.WDT(0, 2000) TypeError: function expected at most 1 arguments, got 2 WD = machine.WDT(2000) ValueError:...