Search found 958 matches

by kevinkk525
Tue Jul 20, 2021 5:00 am
Forum: Programs, Libraries and Tools
Topic: uasyncio - determining if a function is a coroutine
Replies: 12
Views: 313

Re: uasyncio - determining if a function is a coroutine

ok thanks for the info. The current uasyncio implementation is CPython compatible almost everywhere because this time it was a basic requirement to be CPython compatible. But it does not distinguish between a coroutine and a generator. But from the top of my head I can't think of how someone would a...
by kevinkk525
Mon Jul 19, 2021 7:30 am
Forum: Programs, Libraries and Tools
Topic: uasyncio - determining if a function is a coroutine
Replies: 12
Views: 313

Re: uasyncio - determining if a function is a coroutine

lol ok.. interesting. Why didn't they just use the "official" uasyncio module? .. (sorry I know you're not the right person for this question)
by kevinkk525
Mon Jul 19, 2021 4:45 am
Forum: Programs, Libraries and Tools
Topic: uasyncio - determining if a function is a coroutine
Replies: 12
Views: 313

Re: uasyncio - determining if a function is a coroutine

CircuitPython has no asyncio support afaik, why would they need a distinction between coroutines and generators?
by kevinkk525
Sun Jul 18, 2021 8:08 am
Forum: Programs, Libraries and Tools
Topic: uasyncio - determining if a function is a coroutine
Replies: 12
Views: 313

Re: uasyncio - determining if a function is a coroutine

I don't know a better way either. It's probably not easy because of the changes to keep everything "micro".
by kevinkk525
Sat Jul 17, 2021 3:39 pm
Forum: Programs, Libraries and Tools
Topic: uasyncio - determining if a function is a coroutine
Replies: 12
Views: 313

Re: uasyncio - determining if a function is a coroutine

The difference is that Christian's approach doesn't execute the function and purely inspects it "untouched", while pythoncoder's approach executes the function and then checks if the returned type is an active generator function which can be passed to uasyncio.create_task(). Pythoncoder's approach i...
by kevinkk525
Sat Jul 17, 2021 4:56 am
Forum: Programs, Libraries and Tools
Topic: Porting a library from Circuitpython
Replies: 7
Views: 230

Re: Porting a library from Circuitpython

You are missing an __init__.py in both the root and the ht16k33 directory. Then it should work.
(btw, if it works in CPython, it'll work in micropython)
by kevinkk525
Thu Jul 15, 2021 5:09 am
Forum: General Discussion and Questions
Topic: Is it good practice to keep calling `del` on objects that I don't need anymore?
Replies: 8
Views: 273

Re: Is it good practice to keep calling `del` on objects that I don't need anymore?

In my project I import multiple modules. After each import statement I call gc.collect() to free all the RAM that only was only temporarily used during import. Then I call gc.collect() after creating bigger objects. This ensures that the RAM is as continuously used as possible and the fragmentation ...
by kevinkk525
Wed Jul 14, 2021 9:16 pm
Forum: General Discussion and Questions
Topic: Is it good practice to keep calling `del` on objects that I don't need anymore?
Replies: 8
Views: 273

Re: Is it good practice to keep calling `del` on objects that I don't need anymore?

I only use "del" in long running loops which occasionally create large temporary data structures. (Afterwards I call gc.collect() to free that RAM). That way those variables don't take up unneccessary RAM. Simple, yet weird example: while True: a={} a.update(await get_results()) await asyncio.sleep(...
by kevinkk525
Sat Jul 03, 2021 12:12 pm
Forum: General Discussion and Questions
Topic: WebREPL freezes when pasting large code block
Replies: 6
Views: 263

Re: WebREPL freezes when pasting large code block

Might also be due to socket operations in webrepl making it slower, more complex and more resource hungry?
by kevinkk525
Sat Jul 03, 2021 5:10 am
Forum: General Discussion and Questions
Topic: WebREPL freezes when pasting large code block
Replies: 6
Views: 263

Re: WebREPL freezes when pasting large code block

I wouldn't worry about flash cycles on an esp8266 (and not just because they are dirt cheap). During my development I often end up uploading the whole firmware 20 times a day. For every change I make, I compile and flash a new firmware (which is ~700kB). And none of my devices have had any problems ...