"Miki" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hello,
> I want to compare two dicts that should have identical info just in a
> different data structure. The first dict's contents look like this. It
> is authoritative... I know for sure it has the correct key value pairs:
>
>
Hello,
> I want to compare two dicts that should have identical info just in a
> different data structure. The first dict's contents look like this. It
> is authoritative... I know for sure it has the correct key value pairs:
>
> {'001' : '01'}
>
> The second dict's contents are like this with a t
brad <[EMAIL PROTECTED]> writes:
> I want to compare two dicts that should have identical info just in a
> different data structure. The first dict's contents look like this. It
> is authoritative... I know for sure it has the correct key value
> pairs:
>
> {'001' : '01'}
-> refdict
>
> The seco
brad wrote:
I want to compare two dicts that should have identical info just in a
different data structure. The first dict's contents look like this. It
is authoritative... I know for sure it has the correct key value pairs:
{'001' : '01'}
The second dict's contents are like this with a tuple
On May 7, 4:08 pm, brad <[EMAIL PROTECTED]> wrote:
> I want to compare two dicts that should have identical info just in a
> different data structure. The first dict's contents look like this. It
> is authoritative... I know for sure it has the correct key value pairs:
>
> {'001' : '01'}
>
> The se
Beema shafreen wrote:
> hi everybody ,
> i need to compare two dictionary's key. I have written a script
Use sets. Sets are easier to use and much faster:
>>> d1 = {'a': 1, 'b': 2, 'c': 3}
>>> d2 = {'b': 2, 'c': 3, 'd': 4}
>>> d1.keys()
['a', 'c', 'b']
>>> d2.keys()
['c', 'b', 'd']
>>> s1 = set(
Hi
On Dec 28, 2007 4:55 PM, Beema shafreen <[EMAIL PROTECTED]> wrote:
> hi everybody ,
> i need to compare two dictionary's key. I have written a script
> gene_symbol = {}
> probe_id = {}
> result = {}
> def getGene(fname):
> fh = open(fname , 'r')
> for line in fh:
>
Kenneth Love <[EMAIL PROTECTED]> wrote:
...
> Python in a Nutshell (2nd ed.)
...
> I am a slow reader. So, if Doctests are mentioned in any of the above,
> I haven't encountered it yet.
Yep, I cover doctest in the chapter on testing, debugging, profiling and
optimizing.
Alex
--
http://ma
On Mon, 30 Jul 2007 14:06:29 -0500, Kenneth Love wrote:
>
>>From: "Steven D'Aprano" <[EMAIL PROTECTED]>
>>Newsgroups: comp.lang.python
>>Subject: Re: Comparing Dictionaries
>>Date: Sat, 28 Jul 2007 10:21:14 +1000
>>To: python-list@python.org
Kenneth Love <[EMAIL PROTECTED]> writes:
> I will search on Google for more info on Doctest.
Doctest is recent. Try:
http://python.org/doc/lib/module-doctest.html
Diveintopython should probably be updated to use doctest instead
of unittest. unittest is Java-descended and doesn't fit into Pytho
On Jul 30, 8:30 pm, Kenneth Love <[EMAIL PROTECTED]> wrote:
> At 03:23 AM 7/28/2007, you wrote:
>
> >Hi Kenneth, being new to Python i wondered if you at least considered
> >Doctests as part of your testing solution.
> >Other languages don't have Doctest.
>
> >- Paddy.
>
> Until I read your post,
At 03:23 AM 7/28/2007, you wrote:
>Hi Kenneth, being new to Python i wondered if you at least considered
>Doctests as part of your testing solution.
>Other languages don't have Doctest.
>
>- Paddy.
Until I read your post, I had never even heard of Doctest. I will look
into it.
Here is the list
>From: "Steven D'Aprano" <[EMAIL PROTECTED]>
>Newsgroups: comp.lang.python
>Subject: Re: Comparing Dictionaries
>Date: Sat, 28 Jul 2007 10:21:14 +1000
>To: python-list@python.org
>
>On Fri, 27 Jul 2007 14:11:02 -0500, Kenneth Love wrote:
>
> > T
Kenneth Love wrote:
> That should teach me not to change working code at the same time I am
> writing unit tests. Even so, I realize it won't be the last time I
> do something so silly. Yes, I know about TDD's "write the test first",
> but I'm not comfortable with the philosophy of these new fan
Hi Kenneth, being new to Python i wondered if you at least considered
Doctests as part of your testing solution.
Other languages don't have Doctest.
- Paddy.
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 27 Jul 2007 14:11:02 -0500, Kenneth Love wrote:
> The published recipe (based on ConfigParser) did not handle my INI
> files. I have periods in both the section names and the key names.
> The INI files contents were developed according to an internally
> defined process that other non-Pyt
At 09:55 PM 7/26/2007, Ben Finney wrote:
>Kenneth Love <[EMAIL PROTECTED]> writes:
>
> > In other words, I consider these two dictionaries to be equivalent:
> >
> > { 'dog' : 'bone', 'cat' : 'fever', 'mouse' : 'mickey' }
> > { 'mouse' : 'mickey', 'dog' : 'bone', 'cat' : 'fever' }
> >
> > wh
At 04:42 AM 7/27/2007, Ali wrote:
>On Jul 26, 10:18 pm, Kenneth Love <[EMAIL PROTECTED]> wrote:
> > Hello,
> >
> > I am new to Python, but not programming. I would like to start my
> > Python career by developing programs according to the "best practices"
> > of the industry. Right now, that appe
On Jul 26, 10:18 pm, Kenneth Love <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I am new to Python, but not programming. I would like to start my
> Python career by developing programs according to the "best practices"
> of the industry. Right now, that appears to be unit tests, patterns,
> and source
Kenneth Love <[EMAIL PROTECTED]> writes:
> In other words, I consider these two dictionaries to be equivalent:
>
> { 'dog' : 'bone', 'cat' : 'fever', 'mouse' : 'mickey' }
> { 'mouse' : 'mickey', 'dog' : 'bone', 'cat' : 'fever' }
>
> while these two are not:
>
> { 'dog' : 'bone', 'ca
François Pinard <[EMAIL PROTECTED]> writes:
> Would someone know where I could find a confirmation that comparing
> dictionaries with `==' has the meaning one would expect (even this is
> debatable!), that is, same set of keys, and for each key, same values?
It may not exist, so you'll have to go
[Peter Hansen]
>> it only says "Comparison operations are supported by all objects"
>> [...]
>I'm not checking the 2.3.5 version, but that latest one is fairly clear
>on what comparisons on mappings do:
>http://docs.python.org/ref/comparisons.html
Yes, indeed. Thanks a lot!
--
François Pin
François Pinard wrote:
> As for:
>
>http://www.python.org/doc/2.3.5/lib/comparisons.html
>
> it only says "Comparison operations are supported by all objects", which
> is a little vague, and no promise that comparisons are meaningful (for
> example, one might wonder what would exactly mean
[François Pinard]
...
> Would someone know where I could find a confirmation that comparing
> dictionaries with `==' has the meaning one would expect (even this is
> debatable!), that is, same set of keys, and for each key, same values?
Yes, look here : it has the meaning you expect, provided tha
24 matches
Mail list logo