cbook.is_scalar('foo') is False

Hello,

It seems to me there is a bug in matplotlib 0.98.3 (or at least a change from previous version).

>>> matplotlib.cbook.is_scalar('foo')
False

I would expect this to be True (otherwise, matplotlib.cbook.flatten(['foo']) enters an infinite recursive loop).

It used to be (0.98.0):
    return is_string_like(obj) or not iterable(obj)
and now (0.98.3):
    return not is_string_like(obj) and not iterable(obj)

If it is by purpose, could someone explain it to me ? I'll then have to change my code accordingly.

Thanks a lot in advance,
Cyrille Rosset.

Cyrille Rosset wrote:

Hello,

It seems to me there is a bug in matplotlib 0.98.3 (or at least a change from previous version).

>>> matplotlib.cbook.is_scalar('foo')
False

I would expect this to be True (otherwise, matplotlib.cbook.flatten(['foo']) enters an infinite recursive loop).

This has been fixed in svn:

In [1]:import matplotlib.cbook as cb

In [5]:list(cb.flatten(['foo']))
Out[5]:['foo']

See Revision 6128:

http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/lib/matplotlib/cbook.py?view=log

···

It used to be (0.98.0):
    return is_string_like(obj) or not iterable(obj)
and now (0.98.3):
    return not is_string_like(obj) and not iterable(obj)

If it is by purpose, could someone explain it to me ? I'll then have to change my code accordingly.

Thanks a lot in advance,
Cyrille Rosset.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users