Re: [Tutor] Q about .join() Thanks!

2017-02-14 Thread Joaquin Alzola
>I find out that the outcome for using .join() on a dictionary is totally >different than it using on list or string. for example, > >>> seq4 = {'hello':1,'good':2,'boy':3,'doiido':4} > >>> > boy:good:doiido:hello >So my question is why the outco

Re: [Tutor] Q about .join() Thanks!

2017-02-14 Thread Peter Otten
Danny Yoo wrote: > Moreover, most implementations *deliberately* randomize their iteration > order to avoid a particular kind of hash collision attack out there in > the wild. See: In CPython the hash() of a string may change between different runs to fend off hash collision attacks, but that

Re: [Tutor] Q about .join() Thanks!

2017-02-13 Thread Danny Yoo
> That's because dictionaries are not stored sequentially and the > order of retrieval is not guaranteed - it can even change > during the execution of a program so you should never > depend on it. That's because dictionaries are optimised > for random access via the keys not to be iterated over.

Re: [Tutor] Q about .join() Thanks!

2017-02-13 Thread Alan Gauld via Tutor
On 13/02/17 18:34, SIJIA CHEN wrote: > I find out that the outcome for using .join() on a dictionary is > totally different than it using on list or string. Not really, it just looks like that :-) > > >>> seq4 = {'hello':1,'good':2,'boy':3,'doiido':4} > >>> p

Re: [Tutor] Q about .join() Thanks!

2017-02-13 Thread David Rock
> On Feb 13, 2017, at 12:34, SIJIA CHEN wrote: > > I find out that the outcome for using .join() on a dictionary is totally > different than it using on list or string. for example, > seq4 = {'hello':1,'good':2,'boy':3,'doiido':4} print ':'.join(seq4) > boy:good:doii

[Tutor] Q about .join() Thanks!

2017-02-13 Thread SIJIA CHEN
Dear, all, I am a python novice and I am wondering if someone in the group could help me with a easy question about .join() method! I find out that the outcome for using .join() on a dictionary is totally different than it using on list or string. for example, >>> seq4 = {'he