
I have found a bug. Its small and not harmful. But its still there. If you take the string of a tuple, it will not always return the correct string. If you have a tuple with only one element and cast it using str() it will put the comma at the end of the string before the ) as if there was a second element. sample code:
Christian Yeganeh

On 05/04/2016 01:51 AM, Christian Yeganeh wrote:
Hi Christian, this is not a bug, but expected behavior: since 1-tuples are a valid type, we have to distinguish them from simply parenthesized expressions by the trailing comma. You can see that when trying to write a 1-tuple literal:
And the repr output just mirrors the input syntax. cheers, Georg BTW, trailing commas are also allowed whenever you have a comma-separated list in Python. Always using a trailing comma for line-by-line lists helps in reducing diff churn and not forgetting the comma when adding elements.

On 05/04/2016 01:51 AM, Christian Yeganeh wrote:
Hi Christian, this is not a bug, but expected behavior: since 1-tuples are a valid type, we have to distinguish them from simply parenthesized expressions by the trailing comma. You can see that when trying to write a 1-tuple literal:
And the repr output just mirrors the input syntax. cheers, Georg BTW, trailing commas are also allowed whenever you have a comma-separated list in Python. Always using a trailing comma for line-by-line lists helps in reducing diff churn and not forgetting the comma when adding elements.
participants (2)
-
Christian Yeganeh
-
Georg Brandl