[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] PMT Oddities
From: |
Martin Braun |
Subject: |
Re: [Discuss-gnuradio] PMT Oddities |
Date: |
Tue, 22 Nov 2016 14:08:15 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
Dave,
pairs pass is_dict(), which is possibly the root cause here. See also:
https://github.com/gnuradio/gnuradio/blob/31b28f0cf4694378b26617616d08b4082668962f/gr-uhd/lib/usrp_block_impl.cc#L487-L494
Cheers,
M
On 11/22/2016 01:47 PM, Dave NotTelling wrote:
> I noticed today that the is_dict and is_pair checks are not appearing to
> work properly. Here is an example that shows the issue:
>
> [code]
>
> #!/usr/bin/python
>
> import pmt
>
> def print_pmt(dictVar):
> print 'isPair:%05s, isDict:%05s, isTuple:%05s => %s' %
> (pmt.is_pair(dictVar), pmt.is_dict(dictVar), pmt.is_tuple(dictVar), dictVar)
>
> print 'DICT'
>
> d = pmt.make_dict()
> print_pmt(d)
>
> d = pmt.dict_add(d, pmt.intern('a'), pmt.intern('b'))
> print_pmt(d)
>
> d = pmt.dict_add(d, pmt.intern('c'), pmt.intern('d'))
> print_pmt(d)
>
> d = pmt.dict_add(d, pmt.intern('e'), pmt.intern('f'))
> print_pmt(d)
>
> print '\nCONS'
>
> p = pmt.cons(pmt.make_dict(), pmt.make_u8vector(0,0))
> print_pmt(p)
>
> [/code]
>
> Run that and you'll see what I consider strange behavior. The values of
> is_pair and is_dict to not match what is expected. Is that by design?
> If so, why?
>
> ((a . b)) is not a pair... It's a single element dictionary
> ((c . d) (a . b)) i can sorta see this being a pair, but it wasn't
> created that way
> ((e . f) (c . d) (a . b)) definitely not a pair as it's 3 elements
>
> (() . #[]) don't dictionaries have to be nested?
>
>
> Thanks!
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>