On 2020-09-20 23:59, Avi Gross via Python-list wrote:
There is a simple and obvious way to make sure you have a tuple by invoking the 
keyword/function in making it:

a=('first')
type(a)
<class 'str'>

a=("first",)
type(a)
<class 'tuple'>

a=tuple("first")
type(a)
<class 'tuple'>

That seems more explicit than adding a trailing comma. It also is a simple way 
to make an empty tuple but is there any penalty for using the function tuple()?

[snip]
>>> tuple("first")
('f', 'i', 'r', 's', 't')

Not the same as ("first",).

A simpler way to make an empty tuple is just ().
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to