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

Weird behavior with the default match operator #23

Open
JGailor opened this issue Feb 12, 2019 · 2 comments
Open

Weird behavior with the default match operator #23

JGailor opened this issue Feb 12, 2019 · 2 comments

Comments

@JGailor
Copy link

JGailor commented Feb 12, 2019

>>> from pampy import match, _

>>> _
_


>>> def matcher(val):
...     return match(val, int, "int", _, "something else",)

>>> matcher("hi")
'something else'


>>> matcher(1)
'int'


>>> matcher("hi")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in matcher
  File "/usr/local/lib/python3.7/site-packages/pampy/pampy.py", line 186, in match
    raise MatchError("'_' not provided. This case is not handled:\n%s" % str(var))
pampy.pampy.MatchError: '_' not provided. This case is not handled:
hi

'_' not provided. This case is not handled:
hi
@santinic
Copy link
Owner

Weird, this doesn't happen in scripts. I think it's an artifact of python shells, because you call "_" before using it. I really don't know why.

@catethos
Copy link

I think this is due to a bug in ipython: ipython/ipython#11325

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

No branches or pull requests

3 participants