Ask Your Question
1

Unexpected auto-completer behavior when working with pymatgen.

asked 2020-05-09 09:05:49 -0500

hongyi-zhao gravatar image

updated 2020-06-04 15:12:30 -0500

Hi,

I use the pymatgen package for doing some simple tests as following:

import pymatgen

si = pymatgen.Element("Si")
print('\n'.join(dir(si)))

The above command will give the following output:

X
__class__
__doc__
__module__
as_dict
atomic_mass
atomic_radius
average_anionic_radius
average_cationic_radius
average_ionic_radius
block
common_oxidation_states
data
from_Z
from_dict
from_row_and_group
full_electronic_structure
ground_state_term_symbol
group
icsd_oxidation_states
ionic_radii
is_actinoid
is_alkali
is_alkaline
is_chalcogen
is_halogen
is_lanthanoid
is_metal
is_metalloid
is_noble_gas
is_post_transition_metal
is_quadrupolar
is_rare_earth_metal
is_transition_metal
is_valid_symbol
iupac_ordering
max_oxidation_state
metallic_radius
min_oxidation_state
name
nmr_quadrupole_moment
number
oxidation_states
print_periodic_table
row
term_symbols
valence
value

But, when I input this si.F<tab>, it will also give completion suggestion like this: si.Fe which is obviously incorrect. Any hints for this problem?

Regards

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-05-11 11:04:55 -0500

si.Fe is actually valid, though it's not the preferred way of accessing the instance for Fe. What's happening is dir is returning a subset of all the attributes but Wing is displaying all of them. We may change Wing is match dir()'s behavior in a future release.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2020-05-09 09:05:49 -0500

Seen: 69 times

Last updated: May 09