Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[npy format parser] complicated dtypes #500

Open
SylvainCorlay opened this issue Oct 30, 2017 · 2 comments
Open

[npy format parser] complicated dtypes #500

SylvainCorlay opened this issue Oct 30, 2017 · 2 comments
Labels

Comments

@SylvainCorlay
Copy link
Member

In the npy file format, the descr key contains

An object that can be passed as an argument to the numpy.dtype() constructor to create the array’s dtype.

which can potentially be anything, including a python object, or list comprehension syntax, if I understand correctly. Potentially, this may contain the } character, breaking the parsing of the top-level dictionary.

However, the alphabetical ordering of the top-level dictionary guarantees that this key is always first, so I guess that if we parse the header backwards, we can still read shape and fortran_order properly...

cc @wolfv @llohse

@wolfv wolfv changed the title [npy] complex dtypes [npy] complicated dtypes Oct 30, 2017
@llohse
Copy link

llohse commented Oct 30, 2017

The parser of the newest version of libnpy was completely rewritten to be clearer and more robust. The new parser now only requires the 3 keywords 'descr', 'fortran_order', and 'shape' to be unique.

@SylvainCorlay
Copy link
Member Author

@llohseThanks for letting us know about the re-write.

What do you mean by unique? That they may not be a 'shape' key somewhere under descr?

The issue with the current spec is that descr may contain anything with any sort of nesting of dicts, lists etc...

@SylvainCorlay SylvainCorlay changed the title [npy] complicated dtypes [npy format parser] complicated dtypes Nov 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants