[issue44341] Conflict between re.match and match keyword

2021-06-07 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: As Steven mentions, match is a soft keyword: >>> import keyword >>> keyword.softkwlist ['_', 'case', 'match'] And they don't follow the same rules as keywords. Check the pattern matching PEPs for more info. --

[issue44341] Conflict between re.match and match keyword

2021-06-07 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: I don't understand this example. > importing re.match directly into __main__ replaces the keyword with the > function. It has not replaced anything, if you do a match statement it works and doesn't call your function. For example: >>> x = [1,2]

[issue44341] Conflict between re.match and match keyword

2021-06-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: `match` is a soft keyword. Which means that the interpreter should still recognise `match 'str': ...` even if the *name* "match" is defined. -- nosy: +steven.daprano ___ Python tracker

[issue44341] Conflict between re.match and match keyword

2021-06-07 Thread Finn Mason
Change by Finn Mason : -- nosy: -finnjavier08 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44341] Conflict between re.match and match keyword

2021-06-07 Thread Finn Mason
New submission from Finn Mason : >>> import re >>> re.match('str', 'str').group() 'str' >>> match 'str': ... case 'str': ... print('match!') ... match! >>> from re import match >>> match As the above example demonstrates, while re.match doesn't raise an error despite having a