|
From: | Dave NotTelling |
Subject: | Re: [Discuss-gnuradio] PMT Oddities |
Date: | Tue, 22 Nov 2016 17:18:45 -0500 |
Martin,Was that done on purpose?Thank you for the link! I hadn't thought about checking that way.Thanks!-DaveOn Tue, Nov 22, 2016 at 5:08 PM, Martin Braun <address@hidden> wrote:Dave,
pairs pass is_dict(), which is possibly the root cause here. See also:
https://github.com/gnuradio/gnuradio/blob/31b28f0cf4694378b2 6617616d08b4082668962f/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
>
_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
[Prev in Thread] | Current Thread | [Next in Thread] |