On Mon, 20 Oct 2014 21:31:05 -0400, Dennis Lee Bieber
wrote:
>On Mon, 20 Oct 2014 17:25:31 -0400, Seymore4Head
> declaimed the following:
>
>
>>
>>The thing is I am not really sure what I want. I do know I need more
>>practice to find out. Since I am taking a course now, I can't really
>>ask a
On Tue, 21 Oct 2014 00:40:06 -0700, Larry Hudson
wrote:
>On 10/20/2014 12:49 PM, Seymore4Head wrote:
>> On Mon, 20 Oct 2014 20:40:18 +0100, MRAB
>> wrote:
>>
>
>
>> Do you have to know the number of items the list will have before
>> making it?
>>
>
>No. Lists are NOT the same as arrays i
On Tue, 21 Oct 2014 00:11:38 -0700, Larry Hudson
wrote:
>On 10/20/2014 12:49 PM, Seymore4Head wrote:
>> On Mon, 20 Oct 2014 20:40:18 +0100, MRAB
>> wrote:
>
>
>
>> Do you have to know the number of items the list will have before
>> making it?
>>
>
>No, it is not necessary, lists are NOT the sam
On 10/20/2014 12:49 PM, Seymore4Head wrote:
On Mon, 20 Oct 2014 20:40:18 +0100, MRAB
wrote:
Do you have to know the number of items the list will have before
making it?
No. Lists are NOT the same as arrays in other languages. But it IS possible to create an
initial list of a spec
On 10/20/2014 12:49 PM, Seymore4Head wrote:
On Mon, 20 Oct 2014 20:40:18 +0100, MRAB
wrote:
Do you have to know the number of items the list will have before
making it?
No, it is not necessary, lists are NOT the same as arrays in other languages. But it IS
possible to create an initial
On Tue, 21 Oct 2014 10:55:08 +1100, Steven D'Aprano
wrote:
>Seymore4Head wrote:
>
>> For starters I would like to know if you can make a single item list
>> and then turn it into a 2 item list. Is there a command for that?
>>
>> Do you have to know the number of items the list will have before
Seymore4Head wrote:
> For starters I would like to know if you can make a single item list
> and then turn it into a 2 item list. Is there a command for that?
>
> Do you have to know the number of items the list will have before
> making it?
Now these are the right sort of questions that you sh
On 2014-10-20 23:30, Denis McMahon wrote:
On Mon, 20 Oct 2014 20:40:18 +0100, MRAB wrote:
There are a number of stores, so that would be a list of stores. For
each store you want the price of each item, so that would be a dict
where the key is the item and the value is the price of that item. T
On Mon, 20 Oct 2014 22:40:50 + (UTC), Denis McMahon
wrote:
>On Mon, 20 Oct 2014 15:49:15 -0400, Seymore4Head wrote:
>
>> For starters I would like to know if you can make a single item list and
>> then turn it into a 2 item list. Is there a command for that?
>
>Yes, it's called assignment. Y
On Mon, 20 Oct 2014 15:49:15 -0400, Seymore4Head wrote:
> For starters I would like to know if you can make a single item list and
> then turn it into a 2 item list. Is there a command for that?
Yes, it's called assignment. You can for example change a member of a
list from an string to a tuple
On Mon, 20 Oct 2014 20:40:18 +0100, MRAB wrote:
> There are a number of stores, so that would be a list of stores. For
> each store you want the price of each item, so that would be a dict
> where the key is the item and the value is the price of that item. That
> means it would be a list of dicts
On Tue, 21 Oct 2014 10:54:55 +1300, Gregory Ewing
wrote:
>Seymore4Head wrote:
>> Say I want a
>> Grocery list and it will have a maximum size of 50 items.
>
>In Python it's actually easier to deal with variable-sized
>lists having no maximum size. Instead of pre-creating a list
>of a given size,
Seymore4Head wrote:
Say I want a
Grocery list and it will have a maximum size of 50 items.
In Python it's actually easier to deal with variable-sized
lists having no maximum size. Instead of pre-creating a list
of a given size, just start with an empty list and append
things to it.
Unless ther
On Mon, Oct 20, 2014 at 3:25 PM, Seymore4Head
wrote:
> I think what I am going to have to have is a master list that keeps
> track of several things and I will need to change some of them so I
> know that rules out tuples.
It sounds to me like what you really want is a list of class
instances. De
On Mon, 20 Oct 2014 20:48:54 + (UTC), John Gordon
wrote:
>In Seymore4Head
> writes:
>
>> Will Python work like this:
>
>Python is a capable general-purpose language, so yes, it can pretty
>much do anything you want. The trick is knowing how to do it.
>
>> Make a list of 0-50.
>> Then can I
On Mon, 20 Oct 2014 14:45:19 -0600, Ian Kelly
wrote:
>On Mon, Oct 20, 2014 at 2:23 PM, Seymore4Head
> wrote:
>> On Mon, 20 Oct 2014 13:58:46 -0600, Ian Kelly
>> wrote:
>>
>>>On Mon, Oct 20, 2014 at 1:49 PM, Seymore4Head
>>> wrote:
For starters I would like to know if you can make a single i
On 20/10/2014 21:23, Seymore4Head wrote:
On Mon, 20 Oct 2014 13:58:46 -0600, Ian Kelly
wrote:
On Mon, Oct 20, 2014 at 1:49 PM, Seymore4Head
wrote:
For starters I would like to know if you can make a single item list
and then turn it into a 2 item list. Is there a command for that?
You mea
In Seymore4Head
writes:
> Will Python work like this:
Python is a capable general-purpose language, so yes, it can pretty
much do anything you want. The trick is knowing how to do it.
> Make a list of 0-50.
> Then can I add to that list so the second item will hold something
> like cheese, e
On Mon, Oct 20, 2014 at 2:23 PM, Seymore4Head
wrote:
> On Mon, 20 Oct 2014 13:58:46 -0600, Ian Kelly
> wrote:
>
>>On Mon, Oct 20, 2014 at 1:49 PM, Seymore4Head
>> wrote:
>>> For starters I would like to know if you can make a single item list
>>> and then turn it into a 2 item list. Is there a c
On Mon, 20 Oct 2014 20:57:52 +0100, Mark Lawrence
wrote:
>On 20/10/2014 20:49, Seymore4Head wrote:
>> On Mon, 20 Oct 2014 20:40:18 +0100, MRAB
>> wrote:
>>
>>> On 2014-10-20 19:10, Seymore4Head wrote:
I haven't had a lot of practice doing this. If anyone knows of a site
I would apprec
On Mon, 20 Oct 2014 13:58:46 -0600, Ian Kelly
wrote:
>On Mon, Oct 20, 2014 at 1:49 PM, Seymore4Head
> wrote:
>> For starters I would like to know if you can make a single item list
>> and then turn it into a 2 item list. Is there a command for that?
>
>You mean like this?
>
the_list = ['fir
On 20/10/2014 20:49, Seymore4Head wrote:
On Mon, 20 Oct 2014 20:40:18 +0100, MRAB
wrote:
On 2014-10-20 19:10, Seymore4Head wrote:
I haven't had a lot of practice doing this. If anyone knows of a site
I would appreciate it.
Will Python work like this:
I am trying to come up with an example a
On Mon, Oct 20, 2014 at 1:49 PM, Seymore4Head
wrote:
> For starters I would like to know if you can make a single item list
> and then turn it into a 2 item list. Is there a command for that?
You mean like this?
>>> the_list = ['first_item']
>>> the_list.append('second_item')
>>> the_list
['fir
On 20/10/2014 19:33, sohcahto...@gmail.com wrote:
Oh shit! It's the magic word! I better get right on it!
While you're at it would you please access this list via
https://mail.python.org/mailman/listinfo/python-list or read and action
this https://wiki.python.org/moin/GoogleGroupsPython t
On Mon, 20 Oct 2014 20:40:18 +0100, MRAB
wrote:
>On 2014-10-20 19:10, Seymore4Head wrote:
>> I haven't had a lot of practice doing this. If anyone knows of a site
>> I would appreciate it.
>>
>> Will Python work like this:
>> I am trying to come up with an example and work to it. Say I want a
>
On 2014-10-20 19:10, Seymore4Head wrote:
I haven't had a lot of practice doing this. If anyone knows of a site
I would appreciate it.
Will Python work like this:
I am trying to come up with an example and work to it. Say I want a
Grocery list and it will have a maximum size of 50 items.
I wan
On Monday, October 20, 2014 11:23:36 AM UTC-7, Seymore4Head wrote:
> On Mon, 20 Oct 2014 11:18:26 -0700 (PDT), sohcahtoa82 wrote:
>
>
>
> >On Monday, October 20, 2014 11:13:17 AM UTC-7, Seymore4Head wrote:
>
> >> I haven't had a lot of practice doing this. If anyone knows of a site
>
> >>
>
On Mon, 20 Oct 2014 11:18:26 -0700 (PDT), sohcahto...@gmail.com wrote:
>On Monday, October 20, 2014 11:13:17 AM UTC-7, Seymore4Head wrote:
>> I haven't had a lot of practice doing this. If anyone knows of a site
>>
>> I would appreciate it.
>>
>>
>>
>> Will Python work like this:
>>
>> I am
On Monday, October 20, 2014 11:13:17 AM UTC-7, Seymore4Head wrote:
> I haven't had a lot of practice doing this. If anyone knows of a site
>
> I would appreciate it.
>
>
>
> Will Python work like this:
>
> I am trying to come up with an example and work to it. Say I want a
>
> Grocery list
I haven't had a lot of practice doing this. If anyone knows of a site
I would appreciate it.
Will Python work like this:
I am trying to come up with an example and work to it. Say I want a
Grocery list and it will have a maximum size of 50 items.
I want to do this with one list.
Make a list of
>>parinfo = [{'value':0., 'fixed':0, 'limited':[0,0],
>>'limits':[0.,0.]}.copy() for i in xrange(0,6)]
>>
>>However, this will still reference internal lists that have
>>been referenced multiple times, such that
>>
>> >>> parinfo[5]['limited']
>>[0, 0]
>> >>> parinfo[4]['limited'][0] = 2
>> >>> par
>>parinfo = [{'value':0., 'fixed':0, 'limited':[0,0],
>>'limits':[0.,0.]}.copy() for i in xrange(0,6)]
>>
>>However, this will still reference internal lists that have
>>been referenced multiple times, such that
>>
>> >>> parinfo[5]['limited']
>>[0, 0]
>> >>> parinfo[4]['limited'][0] = 2
>> >>> par
Tim Chase wrote:
> parinfo = [{'value':0., 'fixed':0, 'limited':[0,0],
> 'limits':[0.,0.]}.copy() for i in xrange(0,6)]
>
> However, this will still reference internal lists that have
> been referenced multiple times, such that
>
> >>> parinfo[5]['limited']
> [0, 0]
> >>> parinfo[4]['limited'][
Jean_Francois Moulin wrote:
> Hi all,
>
> I tried this piece of code (FWIW, it was taken as is from a help section of
> mpfit, a mathematical routine for least square fitting):
>
> parinfo = [{'value':0., 'fixed':0, 'limited':[0,0], 'limits':[0.,0.]}]*6
> The first line builds a list of six dicti
> parinfo = [{'value':0., 'fixed':0, 'limited':[0,0],
'limits':[0.,0.]}]*6
> parinfo[0]['fixed'] = 1
> parinfo[4]['limited'][0] = 1
> parinfo[4]['limits'][0] = 50.
>
> The first line builds a list of six dictionaries with
> initialised keys. I expected that the last three lines
> would o
Jean_Francois Moulin wrote in
news:[EMAIL PROTECTED] in
comp.lang.python:
> Hi all,
>
> I tried this piece of code (FWIW, it was taken as is from a help
> section of mpfit, a mathematical routine for least square fitting):
>
> parinfo = [{'value':0., 'fixed':0, 'limited':[0,0],
> 'limits':[0.,
> parinfo = [{'value':0., 'fixed':0, 'limited':[0,0], 'limits':[0.,0.]}]*6
With this, you are creating a list with 6 references to the same list.
Note that the left operand of '*' is evaluated only once before
"multiplying" it six times.
Regards,
Tito
--
http://mail.python.org/mailman/listinfo
Hi all,
I tried this piece of code (FWIW, it was taken as is from a help section of
mpfit, a mathematical routine for least square fitting):
parinfo = [{'value':0., 'fixed':0, 'limited':[0,0], 'limits':[0.,0.]}]*6
parinfo[0]['fixed'] = 1
parinfo[4]['limited'][0] = 1
parinfo[4]['limits'][0] = 50
38 matches
Mail list logo