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

in [x, y, z]in (x, y, z) #105

Merged
merged 1 commit into from
Oct 10, 2023
Merged

Conversation

DimitriPapadopoulos
Copy link
Contributor

Consistency with previous lines:

if psd in ('probe-p', 'probe-s'):
data, meta, dwelltime, fname_suffix = _process_probe_p(pfile)
elif psd in ('oslaser', 'slaser_cni'):
data, meta, dwelltime, fname_suffix = _process_oslaser(pfile)

@@ -95,9 +95,9 @@ def _process_svs_pfile(pfile):
data, meta, dwelltime, fname_suffix = _process_probe_p(pfile)
elif psd in ('oslaser', 'slaser_cni'):
data, meta, dwelltime, fname_suffix = _process_oslaser(pfile)
elif psd in ('slaser'):
Copy link
Contributor Author

@DimitriPapadopoulos DimitriPapadopoulos Oct 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the above expression is True if psd is a substring of 'slaser'. I think that's not what you want:

>>> psd = 'slaser'
>>> psd in ('slaser')
True
>>> psd = 'las'
>>> psd in ('slaser')
True
>>> psd = 'slzzzzz'
>>> psd in ('slaser')
False
>>> 

Copy link
Contributor Author

@DimitriPapadopoulos DimitriPapadopoulos Oct 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively write:

    elif psd in ('slaser',):

Note the comma:

  • ('slaser') is the same as 'slaser', a string,
  • ('slaser',) is a tuple containing a single element 'slaser'.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this subtle bug

@wtclarke wtclarke merged commit 4cd3ec5 into wtclarke:master Oct 10, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants