Message209229
| Author |
serhiy.storchaka |
| Recipients |
ezio.melotti, mrabarnett, pitrou, serhiy.storchaka, taleinat, terry.reedy |
| Date |
2014年01月25日.19:19:35 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1390677575.43.0.25754418539.issue20283@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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) |
|