I ask because it feels like a bug.  Things like ((a . b), (c . d), (e . f))
are definitely not pairs (assuming a pair is 2 elements) and (in my
opinion) should not return true for pmt.is_pair().

On Tue, Nov 22, 2016 at 5:12 PM, Dave NotTelling <dmp250...@gmail.com>
wrote:

> Martin,
>
>      Was that done on purpose?
>
>      Thank you for the link!  I hadn't thought about checking that way.
>
> Thanks!
>
> -Dave
>
> On Tue, Nov 22, 2016 at 5:08 PM, Martin Braun <martin.br...@ettus.com>
> 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
>> > Discuss-gnuradio@gnu.org
>> > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>> >
>>
>>
>> _______________________________________________
>> Discuss-gnuradio mailing list
>> Discuss-gnuradio@gnu.org
>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>
>
>
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to