2021年3月21日星期日

How in the world is this a list if it uses ()? [duplicate]

So in python I have this tuple, or at least it SHOULD be a tuple:

    listOfNames = ([(name, 'male') for name in names.words('male.txt')] + [(name, 'female') for name in names.words('female.txt')])  

Yet when I run type(listOfNames), it returns "list". But why? There are clearly parentheses on the outside. Is this some new convention I am not aware of?

https://stackoverflow.com/questions/66739781/how-in-the-world-is-this-a-list-if-it-uses March 22, 2021 at 10:59AM

没有评论:

发表评论