[Tutor] Why is it invalid syntax to have a particular dictionary value as an argument?
boB Stepp
robertvstepp at gmail.com
Wed Apr 8 03:42:48 CEST 2015
On Mon, Apr 6, 2015 at 12:54 PM, Dave Angel <davea at davea.name> wrote:
> On 04/06/2015 12:43 PM, boB Stepp wrote:
>
>>
>> I was breaking down longer functions into smaller ones. Along the way
>> I noticed I was passing an entire dictionary from one function to
>> another. I only needed to pass one particular value, not the whole
>> dictionary, so that is how I got into the issue I asked about.
>
>
> Just to reinforce something you probably know well, passing a dictionary
> takes no more memory or time than passing an item from that dictionary...
One thing about Python that I must keep reminding myself is that its
identifiers store references to objects, not the actual objects
themselves.
> ... The
> real choice is whether the called function should dealing with a single item
> or with a dictionary. It would have a different name in each case, and a
> different set of reuse possibilities.
In my actual code, I am trying to take advantage of these ideas.
boB
More information about the Tutor
mailing list