metapensiero / metapensiero.pj

Javascript for refined palates: a Python 3 to ES6 Javascript translator
Other
900 stars 73 forks source link

Allow attribute to be used as an index #82

Closed TEParsons closed 2 months ago

TEParsons commented 2 months ago

Same as my last PR (#81), a collaborator found a class of index which doesn't translate.

This is quite typical to do in PsychoPy:

stimuli = ["a.png", "b.png", "c.png"]
trials = TrialHandler(...)
for trial in trials:
    stim = stimuli[trials.thisN]

and we've found that stimuli[trials.thisN] doesn't translate as trials.thisN is an ast.Attribute and this isn't included in the assertion for adding a slice.

azazel75 commented 2 months ago

Thanks

azazel75 commented 2 months ago

I've released the new version 0.13, would you be so kind to test it and let me know? Thanks