Re: [Tutor] Multiprocessing with many input input parameters

2019-07-12 Thread Mats Wichmann
On 7/12/19 5:53 AM, Shall, Sydney via Tutor wrote: > Thanks Mike, > > But I am still not clear. > > do I write: > > def f([x,y,z]) ? > How exactly do one write the function and how does one ensure that each > positional argument is accounted for. The concept of packing will be useful, you

Re: [Tutor] Reading .csv data vs. reading an array

2019-07-12 Thread Oscar Benjamin
On Thu, 11 Jul 2019 at 18:52, Chip Wachob wrote: > > Hello, Hi Chip, ... > So, here's where it gets interesting. And, I'm presuming that someone out > there knows exactly what is going on and can help me get past this hurdle. I don't think anyone knows exactly what's going on... ... > My

Re: [Tutor] Multiprocessing with many input input parameters

2019-07-12 Thread Oscar Benjamin
Hi Sydney, On Wed, 10 Jul 2019 at 16:45, Shall, Sydney via Tutor wrote: > > I am a relative beginner. > > My program models cell reproduction. I have written a program that models > this and it works. > > Now I want to model a tissue with several types of cells. I did this by > simply

Re: [Tutor] Multiprocessing with many input input parameters

2019-07-12 Thread Steven D'Aprano
On Sat, Jul 13, 2019 at 09:59:16AM +1000, Cameron Simpson wrote: > Mike has probably confused this with tuples. Because tuples are > delineated with parentheses, there is ambiguity between a tuple's > parentheses and normal "group these terms together" parentheses. There are no "tuple

Re: [Tutor] Multiprocessing with many input input parameters

2019-07-12 Thread Cameron Simpson
On 11Jul2019 15:40, Mike Barnett wrote: If you're passing parameters as a list, then you need a "," at the end of the items. Otherwise if you have something like a string as the only item, the list will be the string. list_with_one_item = ['item one',] Actually, this isn't true. This is

Re: [Tutor] Output reason

2019-07-12 Thread Mats Wichmann
On 7/12/19 11:39 AM, Alan Gauld via Tutor wrote: > On 12/07/2019 15:24, Gursimran Maken wrote: > >> Can someone please explain me the reason for below output. > > You've been bitten by one of the most common gotchas in Python :-) > >> def fun(n,li = []): >> a = list(range(5)) >>

Re: [Tutor] Output reason

2019-07-12 Thread Richard Damon
If I remember how that works right, there is a single empty list that is created and used for all the calls that use the default argument, and then your function modifies that empty list so it is no longer empty, and that modified list is used on future calls. (Not good to use a mutable as a

Re: [Tutor] Output reason

2019-07-12 Thread Alan Gauld via Tutor
On 12/07/2019 15:24, Gursimran Maken wrote: > Can someone please explain me the reason for below output. You've been bitten by one of the most common gotchas in Python :-) > def fun(n,li = []): > a = list(range(5)) > li.append(a) > print(li) > > fun(4) > fun(5,[7,8,9]) >

[Tutor] Output reason

2019-07-12 Thread Gursimran Maken
Hi, Can someone please explain me the reason for below output. Program: def fun(n,li = []): a = list(range(5)) li.append(a) print(li) fun(4) fun(5,[7,8,9]) fun(4,[7,8,9]) fun(5) # reason for output (why am I getting to values in this output.) Output: [[0, 1, 2, 3, 4]] [7, 8, 9, [0,

Re: [Tutor] Multiprocessing with many input input parameters

2019-07-12 Thread Shall, Sydney via Tutor
Thanks Mike, But I am still not clear. do I write: def f([x,y,z]) ? How exactly do one write the function and how does one ensure that each positional argument is accounted for. Dr. Sydney Shall Department of Haematological Medicine King's College London 123 Coldharbour Lane London SE5 9NU

Re: [Tutor] Multiprocessing with many input input parameters

2019-07-12 Thread Alan Gauld via Tutor
On 12/07/2019 01:51, DL Neil wrote: > older articles! We haven't discussed hardware. Most modern PC CPUs offer > multiple "cores". Assuming (say) four cores, asyncio is capable of > running up to four processes concurrently - realising attendant > acceleration of the entirety. Just to pick up

Re: [Tutor] Make a linked list subscriptable?

2019-07-12 Thread Richard Damon
On 7/11/19 10:55 AM, Mats Wichmann wrote: > On 7/10/19 6:30 PM, Sarah Hembree wrote: >> How might I best make a linked list subscriptable? Below is skeleton code >> for a linked list (my >> actual is much more). I've done __iter__ and __next__ but I would like to >> be able to do start:stop:stride