[Tutor] Looping over histogram plots
Mark Lawrence
breamoreboy at yahoo.co.uk
Wed Jun 27 10:42:23 CEST 2012
On 27/06/2012 08:47, Alan Gauld wrote:
> On 27/06/12 00:32, Elaina Ann Hyde wrote:
>
>> Thanks for the comment, the set type is no problem for me, this is
>> just a variable that I call set... and it works great for my purposes,
>
> It may work just now but if you ever decide you need to use a Python set
> you will be unable to because you have effectively hidden that data
> type. And it's unlikely to beimmediately obvious why its not working.
> That's why its a bad idea to use the built-in type names as variables.
>
> eg:
>
> myList = [1,2,3,3,4,5,6,3,1,5]
> myUniqueList = list(set(mylist)) # remove duplicates
>
> In your program the second line would fail.
> If you are confident you will never use sets then its not an issue, but
> these decisions have a habit of coming back to bite you in the future!
>
And they always seem to bite the most tender part of the anatomy that
they can find :)
--
Cheers.
Mark Lawrence.
More information about the Tutor
mailing list