Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

BUG: Allocatable array variables don't show up in dir #27696

Copy link
Copy link
Open
@HaoZeke

Description

@HaoZeke
Issue body actions
          @HaoZeke Thank you very much for the fix!

I installed using

pip install git+https://github.com/numpy/numpy.git@refs/pull/27695/merge

Yes, it is including the lanedata module. Interestingly, the allocatable module variable theta, however, is not listed by dir

In [9]: dir(laneemden._solver.lanedata)
Out[9]: 
['__call__',
 '__class__',
 '__delattr__',
 '__dir__',
 '__doc__',
 '__eq__',
 '__format__',
 '__ge__',
 '__getattribute__',
 '__getstate__',
 '__gt__',
 '__hash__',
 '__init__',
 '__init_subclass__',
 '__le__',
 '__lt__',
 '__ne__',
 '__new__',
 '__reduce__',
 '__reduce_ex__',
 '__repr__',
 '__setattr__',
 '__sizeof__',
 '__str__',
 '__subclasshook__',
 'maxdata',
 'ndata']

but it is accessible, and returns None if not allocated and returns the array when allocated. Even when allocated, however, it is not listed.

In [11]: laneemden._solver.lanedata.<TAB>
maxdata ndata   
In [11]:

This may not be new behaviour (I do not recall having tried this before), but is a bit curious, and might be confusing.

Before allocating

In [5]: laneemden._solver.lanedata.theta

In [6]:

and after allocating (laneemden.solver.test())

In [10]: laneemden._solver.lanedata.theta
Out[10]: 
array([[ 1.00000000e+00,  0.00000000e+00],
       [ 9.99999999e-01, -2.03450521e-05],
       [ 9.99999998e-01, -4.06901040e-05],
       ...,
       [ 5.09606183e-06, -4.24312354e-02],
       [ 2.50628767e-06, -4.24304844e-02],
       [-8.34406605e-08, -4.24297334e-02]])

In [11]:

Originally posted by @2sn in #27695 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.