Search found 3069 matches

by pythoncoder
Sun Nov 18, 2018 9:17 am
Forum: General Discussion and Questions
Topic: Learning uasyncio and futures
Replies: 13
Views: 189

Re: Learning uasyncio and futures

This is because Python copies lists by reference. So your list of lists is actually a list of list, IYSWIM. To reduce your example to its simplest: >>> z = [1,] >>> q=[z]*5 >>> q [[1], [1], [1], [1], [1]] >>> q[0][0]=999 >>> q [[999], [999], [999], [999], [999]] >>> The "pass by reference" method is...
by pythoncoder
Sat Nov 17, 2018 8:41 am
Forum: ESP8266 boards
Topic: OSError 19 (ENODEV)
Replies: 15
Views: 8596

Re: OSError 19 (ENODEV)

...My PyBoard shows up as four different dfu capable devices when I do "dfu-util --list."... It should do: see the docs . If you're having trouble flashing a Pyboard I suggest you create a new topic in the right (Pyboard) subforum giving exact details of how you're doing it and what occurs. Please ...
by pythoncoder
Sat Nov 17, 2018 7:29 am
Forum: Other Boards
Topic: New dual-core RISC-V 64bit board
Replies: 16
Views: 277

Re: New dual-core RISC-V 64bit board

One thing bothers me about all this cheap hardware: support. You pay more for Pyboards and products from Adafruit, but the support is first rate. Alternatively you buy a complex processor board from China for $5. After putting weeks of effort into your project, you find it doesn't work. Your only op...
by pythoncoder
Sat Nov 17, 2018 7:12 am
Forum: Development of MicroPython
Topic: check if object is a generator
Replies: 1
Views: 33

Re: check if object is a generator

type_gen = type((lambda: (yield))()) Test with isinstance(callback, type_gen) It's sometimes also necessary to test for a generator function: type_gen = type((lambda: (yield))()) # Generator type type_genf = type((lambda: (yield))) # Generator function def foo(): for x in range(5): yield x isinstan...
by pythoncoder
Sat Nov 17, 2018 7:03 am
Forum: General Discussion and Questions
Topic: Learning uasyncio and futures
Replies: 13
Views: 189

Re: Learning uasyncio and futures

To avoid the error wrap should read:

Code: Select all

    async def wrap(coro, i):
        nonlocal count
        result = await coro
        results[i] = result
        count = count - 1
Note that

Code: Select all

   results = [None for i in range(count)]
could be written

Code: Select all

   results = [None] * count
by pythoncoder
Fri Nov 16, 2018 1:50 pm
Forum: General Discussion and Questions
Topic: Learning uasyncio and futures
Replies: 13
Views: 189

Re: Learning uasyncio and futures

Well, that's your call ;) I found cancellation and timeouts rather tricky to implement, but then I'm far too old for this kind of thing; a younger mind might polish them off in a day... The following shows gather being used with timeouts and cancellation (tested on Unix and Pyboard): import uasyncio...
by pythoncoder
Fri Nov 16, 2018 11:08 am
Forum: General Discussion and Questions
Topic: New cheap OLED screen
Replies: 9
Views: 176

Re: New cheap OLED screen

Given the above bold text I'd say the probability of it being LCD is 75%. On the basis of cost I'd give it 95%.
by pythoncoder
Fri Nov 16, 2018 11:04 am
Forum: General Discussion and Questions
Topic: Learning uasyncio and futures
Replies: 13
Views: 189

Re: Learning uasyncio and futures

That is quite a neat solution. Is your aim to write a general-purpose Future class and to replicate my asyn library with Future compatible primitives? If so, I'd suggest as a minimum, a mechanism for cancelling Future instances and a means of creating a Future with a timeout. Both of these are requi...
by pythoncoder
Fri Nov 16, 2018 8:07 am
Forum: ESP8266 boards
Topic: PWM to MOSFET as ac230 dimmer
Replies: 5
Views: 86

Re: PWM to MOSFET as ac230 dimmer

If isolation is maintained the most likely cause is high dv/dt on the MOSFET drain generating radiated RF interference. The nature of the circuit makes this hard to check with an oscilloscope unless you can run the whole thing from a 1:1 isolation transformer (where to connect the 'scope ground lead...
by pythoncoder
Thu Nov 15, 2018 9:17 am
Forum: The MicroPython pyboard
Topic: wtf main.py and boot.py empty?!
Replies: 12
Views: 183

Re: wtf main.py and boot.py empty?!

Other examples of inline assembler may be found in these digital filter scripts.