Skip to content

Chapter 6 bad choice of variable name #94

alexrudnick opened this Issue Jan 17, 2012 · 0 comments

1 participant

Natural Language Toolkit member

Which version of the book are you using? Online

Please specify the chapter and section number(s) 6

Please describe any problems in as much detail as possible, and feel free
to suggest fixes.

In the section, Gender Identification the following example:

>>> from nltk.corpus import names
>>> import random
>>> names = ([(name, 'male') for name in names.words('male.txt')] +
... [(name, 'female') for name in names.words('female.txt')])
>>> import random
>>> random.shuffle(names)

While it works, as it is, it might be a better example to use a different
variable name than "names" for the list of male and female names after just
importing a "names" module.

Migrated from

earlier comments

StevenBird1 said, at 2009-12-07T01:11:44.000Z:

Thanks for pointing out this problem. Unfortunately there are many references to "names" that would have to be fixed -- we need to decide if this is feasible for the reprinting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.