Serhiy Storchaka added the comment:

Here is patch for 3.3 which adds alternative parameter name. Now both keyword 
names are allowed, but deprecation warning is emitted if old keyword name is 
used.

>>> import re
>>> p = re.compile('')
>>> p.match()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Required argument 'string' (pos 1) not found
>>> p.match('')
<_sre.SRE_Match object at 0xb705c598>
>>> p.match(string='')
<_sre.SRE_Match object at 0xb705c720>
>>> p.match(pattern='')
__main__:1: DeprecationWarning: The 'pattern' keyword parameter name is 
deprecated.  Use 'string' instead.
<_sre.SRE_Match object at 0xb705c758>
>>> p.match('', string='')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Argument given by name ('string') and position (1)
>>> p.match('', pattern='')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Argument given by name ('pattern') and position (1)

----------
Added file: http://bugs.python.org/file33705/sre_deprecate_pattern_keyword.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20283>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to