Skip to content

Commit 9ea9176

Browse files
committed
Prefer itertools.chain. Closes TODO and avoids issue with premature finalization of tokens in yield from.
1 parent 76e02de commit 9ea9176

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

cssutils/helper.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import os
55
import re
6+
import itertools
67
import urllib.request
78
import urllib.error
89
import urllib.parse
@@ -69,10 +70,7 @@ def path2url(path):
6970
def pushtoken(token, tokens):
7071
"""Return new generator starting with token followed by all tokens in
7172
``tokens``"""
72-
# TODO: may use itertools.chain?
73-
yield token
74-
for t in tokens:
75-
yield t
73+
return itertools.chain([token], tokens)
7674

7775

7876
def string(value):

0 commit comments

Comments
 (0)