[OT] fortran lib which provide python like data type
rustompmody at gmail.com
Fri Jan 30 02:40:03 CET 2015
On Friday, January 30, 2015 at 4:09:19 AM UTC+5:30, beli... at aol.com wrote:
> On Thursday, January 29, 2015 at 10:01:00 AM UTC-5, Liu Zhenhai wrote:
> > Hi,
> > I am not sure here is the right place to ask this question, but I want to give it a shot:)
> > are there fortran libs providing python like data type, such as set, dict, list?
> > Thanks,
> > Yours liuzhenhai
> The "Fortran library" http://bigdft.org/Wiki/index.php?title=Fortran_library appears to have some of what you want. I have not tried the code.
> "The flib library provides an object called dictionary which is -- strictly speaking -- more than just a dictionary. It is polymorphic and can be a list or a dictionary, as in the python language. The other difference is that it keeps the order of the elements, which is very useful if we want to dump its contents to the yaml output. It represents indeed a tree of data, and for these reasons it will most likely change name into f_tree in a future release of the module.
> These dictionaries are also used in the other parts of the flib library and are thus essential for its proper use. There are many examples in the file dicts.f90."
Note the very first minimal example
type(dictionary), pointer :: d
v = d//'toto'
The corresponding python
d = dict()
d['toto'] = 1
v = d['toto']
In particular note the del in the python.
Should highlight the point that languages with gc, support data structures
in a way that gc-less languages - Fortran, C, C++ - do not and cannot.
More information about the Python-list