1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Used ternary if/else in utils.lorem_ipsum.words().

This commit is contained in:
Michael Lelyakin 2016-12-14 14:36:34 -08:00 committed by Tim Graham
parent e5d3f98abc
commit fb1349ce8c

View File

@ -103,10 +103,7 @@ def words(count, common=True):
If `common` is True, then the first 19 words will be the standard
'lorem ipsum' words. Otherwise, all words will be selected randomly.
"""
if common:
word_list = list(COMMON_WORDS)
else:
word_list = []
word_list = list(COMMON_WORDS) if common else []
c = len(word_list)
if count > c:
count -= c