Re: Need tests of turtledemo.colordemo on Windows installations

2020-09-16 Thread Terry Reedy

On 9/14/2020 10:30 AM, Dennis Lee Bieber wrote:

On Sun, 13 Sep 2020 21:18:10 -0400, Terry Reedy 
declaimed the following:


User Tushar Sadhwani and I both have Win 10 with 3.8.5 installed.  When
he runs


64-bit or 32-bit (or a mix of W10 64 and Python 32)?


He has run both in separate directories.  But when he ran the test 
suite, 4 tests failed with a numpy import error that Jeremy Kloth says 
is due to a mix.



--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


dictionaries an matrices

2020-09-16 Thread Ing Diegohl
Good morning everyone
I would like to know if i can to create a dictionary with two matrices, where 
every element of the first matrix corresponds to dictionary's keys and the 
elements of the second matrix will be the values every key.
thanks
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: dictionaries an matrices

2020-09-16 Thread joseph pareti
you can use the following: (change the matrices as it suits your app):

import numpy as np
def set_params(w, b):

params = {"w0": w[0], "w1": w[1] , "w2": w[2], "w3": w[3], "w4":
w[4], "b": b}

return params

w = np.random.randn((5))
b = 1
params = set_params(w, b)
for i in range(5):
W = params.get("w"+str(i))
print(W)
B = params.get('b')
print(B)

Am Mi., 16. Sept. 2020 um 13:14 Uhr schrieb Ing Diegohl <
[email protected]>:

> Good morning everyone
> I would like to know if i can to create a dictionary with two matrices,
> where every element of the first matrix corresponds to dictionary's keys
> and the elements of the second matrix will be the values every key.
> thanks
> --
> https://mail.python.org/mailman/listinfo/python-list
>


-- 
Regards,
Joseph Pareti - Artificial Intelligence consultant
Joseph Pareti's AI Consulting Services
https://www.joepareti54-ai.com/
cell +49 1520 1600 209
cell +39 339 797 0644
-- 
https://mail.python.org/mailman/listinfo/python-list


Artie 3000 the coding robot

2020-09-16 Thread Skip Montanaro
I'm looking for feedback on Artie 3000 the Coding Robot. It's recommended
by wirecutter.com for introductory programming for ages seven and up
(though stemfinity.com
 says 7-12). I was
thinking about getting it for my grandson who's turning 12 next month. I
worry the introductory lessons might be kind of boring for him (though he's
very into Minecraft, so who knows), and I've seen nothing online about
transitioning to programming Artie using Python. His dad's a techie, so I'm
not worried if he gets stuck. Here's the manufacturer's page
 for
the tool/toy.

Any feedback appreciated...

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: musings on static variables

2020-09-16 Thread Ben Bacarisse
[email protected] (Stefan Ram) writes:

>   This C program use a local /static/ variable.
>
>   main.c
>
> #include 
>
> int f( void )
> { static int i = 0;
>   return i++; }
>
> int main( void )
> { printf( "%d\n", f() );
>   printf( "%d\n", f() );
>   printf( "%d\n", f() ); }
>
>   transcript
>
> 0
> 1
> 2
>
>   When asked how to do this in Python, sometimes people
>   suggest to use a module variable for this, or to add "i"
>   to "f" as an attribute, or maybe even to use some kind of
>   closure. Another (more pythonic?) way to do this, would be:
>
>   main.py
>
> def f_():
> i = 0
> while True:
> yield i
> i += 1
>
> f = f_()
> print( next( f ))
> print( next( f ))
> print( next( f ))
>
>   transcript
>
> 0
> 1
> 2

  def f(i = [0]):
  i[0] += 1
  return i[0]
   
  print(f())
  print(f())
  print(f())

maybe?  More than a bit yucky, though.

-- 
Ben.
-- 
https://mail.python.org/mailman/listinfo/python-list


Asyncio Queue implementation suggestion

2020-09-16 Thread Alberto Sentieri
I have a suggestion about the implementation of asyncio queues that 
could improve performance. I might be missing something, however. I am 
sort of new to Python. Below a short description of the problem I am facing.


I wrote a daemon in Python 3 (running in Linux) which test many devices 
at the same time, to be used in a factory environment. This daemon 
include multiple communication events to a back-end running in another 
country. I am using a class for each device I test, and embedded into 
the class I use asyncio. Due to the application itself and the number of 
devices tested simultaneously, I soon run out of file descriptor. Well, 
I increased the number of file descriptor in the application and then I 
started running into problems like “ValueError: filedescriptor out of 
range in select()”. I guess this problem is related to a package called 
serial_asyncio, and of course, that could be corrected. However I became 
curious about the number of open file descriptors opened: why so many?


Apparently asyncio Queues use a Linux pipe and each queue require 2 file 
descriptors. Am I correct? So I asked my self: if a asyncio queue is 
just a mechanism of piping information between two asyncio tasks, which 
should never run at the same time, why do I need the operating system in 
the middle of that? Isn’t the whole idea about asyncio that the 
operating system would be avoided whenever possible? No one will put 
anything into a queue if asyncio called epoll, because some Python code 
should be running to push things into the queue. If there is nothing in 
a particular queue, nothing will show up while asyncio is waiting for a 
file descriptor event. So, if I am correct, it would be more efficient 
to put the queue in a ready-queue list whenever something is pushed into 
it. Then, just before asyncio calls epoll (or select), it would check 
that ready queue, and it would process it before the epoll call. I mean 
that epoll would not be called unless all the queues have been properly 
processed. Queues would be implemented in a much simpler way, using 
local memory: a simple array may be enough to do the job. With that the 
OS would be avoided, and a much lower number of file descriptors would 
be necessary.


--
https://mail.python.org/mailman/listinfo/python-list