New submission from Serhiy Storchaka:
string.Template doesn't allow to specify the self substitute parameter as
keyword argument.
>>> import string
>>> string.Template('the self is $self').substitute(self='bozo')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: substitute() got multiple values for argument 'self'
>>> string.Template('the self is $self').safe_substitute(self='bozo')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: safe_substitute() got multiple values for argument 'self'
The same issue is with string.Formatter.format:
>>> string.Formatter().format('the self is {self}', self='bozo')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: format() got multiple values for argument 'self'
Proposed patch fixes these issues.
----------
components: Library (Lib)
files: string_formatting_self.patch
keywords: patch
messages: 238132
nosy: georg.brandl, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: string.Template doesn't work with the self keyword argument
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file38497/string_formatting_self.patch
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue23671>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com