Jim Hill wrote:
Is there a way to produce a very long multiline string of output with
variables' values inserted without having to resort to this wacky
"""v = %s"""%(variable)
business?
Try combining Python 2.4's subprocess module with its string
they only need a fraction of it.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list
ase in length, generator expressions generally win in the end due to their
reduced memory impact.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
h
ible to alter that determination though:
Py> from decimal import Decimal
Py> Decimal(1) == int(1)
True
Py> type(Decimal(1))
Py> type(int(1))
The reason your __abs__ example blows up is because the relevant attribute is
missing for string objects - and the
ort reader
Py> parsed = reader(demo, delimiter='|')
Py> for line in parsed: print line
...
['a', 'b', 'c', 'd']
['1', '2', '3', '4']
Cheers,
Nick.
P.S. 'demo' was created via:
Py> from tempfi
et is to assume it's something
in real life that's pissing them off, rather than anything I actually said.
And that assumption usually turns out to be pretty close to the mark, and things
return to being civil after a day or two.
Cheers,
Nick.
P.S. I think this list may experience the
on
composition (although it has the same effect).
From a real world programming point of view, though, it's self-documenting,
runs faster and uses less memory, so it's really a pure win.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
--
a suitable
intermediate format that makes explicit the degree of precision used in the
conversion.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list
emory, and Python's internal
structures are already chewing up some of the address space.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
http://boredomandlaziness.skystorm.n
ed to remind you why you love coding in
Python ;)
Although coding in C when you have the Python API to lean on is a hell of a lot
better than just coding in C. . .
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Bri
Steven Bethard wrote:
Nick Coghlan wrote:
def compose(list_of_functions):
application_order = reversed(list_of_functions)
def composed(x):
for f in application_order:
x = f(x)
return x
return composed
so you either need to call reversed each time in 'composed' o
to do something like
import win32Com.client
pt = win32com.client.Dispatch ("Test.PyTest")
pt.Name = "fred"
print pt.Name
However it doesn't look like the Test.dll is known.
Any pointers?
Thanks
Nick
--
http://mail.python.org/mailman/listinfo/python-list
t().
Or, as I suggested elsewhere in this thread, use a special KeyedById class which
*doesn't copy anything anywhere*.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list
, guarded_operation, lazyval(default_case))
Huh. I think I like the idea of lazy() much better than I like the current PEP
312. There must be something wrong with this idea that I'm missing. . .
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list
s appropriate for this
group? Maybe you should try to lead by example, not decree.
Nick
--
# sigmask || 0.2 || 20030107 || public domain || feed this to a python
print reduce(lambda x,y:x+chr(ord(y)-1),' Ojdl!Wbshjti!=obwAcboefstobudi/psh?')
--
http://mail.python.org/mailman/listinfo/python-list
#x27;re working towards a career
in the political field.
Nick
--
# sigmask || 0.2 || 20030107 || public domain || feed this to a python
print reduce(lambda x,y:x+chr(ord(y)-1),' Ojdl!Wbshjti!=obwAcboefstobudi/psh?')
--
http://mail.python.org/mailman/listinfo/python-list
e of hash() for
sorting into hash buckets and "x == y" for key matching. An identity_dict
variant that uses id() (or object.__hash__ in Jython) and "x is y" would seem to
quite happily meet the use cases you have posted in this th
Nick Coghlan wrote:
def lazycall(x, *args, **kwds):
"""Executes x(*args, **kwds)() when called"""
return lambda : x(*args, **kwds)()
It occurred to me that this should be:
def lazycall(x, *args, **kwds):
"""Executes x()(*args, **kwds) when c
not entirely sure about it
myself, since I'm in a similar boat to you w.r.t. lazy evaluation (I usually
just define functions that do what I want and pass them around).
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
-
est:
float() + Decimal() fails with a TypeError
float() + float(Decimal()) works fine
And I believe Decimal's __float__ operation is a 'best effort' kind of thing, so
I have no problem with Rationals working the same way.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED]
John Machin wrote:
Nick Coghlan wrote:
[snip]
delimeter.
Hey, Terry, another varmint over here!
Heh. Just don't get me started on the issues I have with typing apostrophes in
the right spot. My *brain* knows where they go, but for some reason it refuses
to let my fingers in on the s
:)
Although if you genuinely prefer a functional programming style, I'd go with
Terry's answer rather than mine.
(Incidentally, I didn't even know what the reduce trap *was* until Terry
described it, but the iterative version avoids it automatically)
Cheers,
Nick.
--
Nick
in using sets to classify
mutable objects like lists (such as Antoon's example of applying special
processing to certain graph points).
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
faster than the standard dict() and set(), since they don't
have to deal with user-overridable special methods :)
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
http://bore
playing
well with other types have been considered properly.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list
ver, if you would prefer not to alter jdbc.py, consider trying:
import jdbc
jdbc.AdminConfig = AdminConfig
Global variables are bad karma to start with, and monkeying with __builtin__ is
even worse :)
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
-
7;m not sure why the in-place version is getting
faster (as it makes more method calls and performs more deletions). One
possibility is that as the list gets shorter due to the deletions, the whole
thing gets pulled into the processor's cache and the operations start going
blazingly fast.
Cheer
they demonstrate what they were meant to demonstrate - that there's a
reason filtration is the recommended approach!
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
(*a, **k)) for x, a, k in func_list)
Anyway, thats just some ideas if you're concerned about the plan to have lambda
disappear in 3K.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list
han the new instance.
The __new__ method *creates* the instance, and returns it.
See here for the gory details of overriding immutable types:
http://www.python.org/doc/newstyle.html
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list
case, I don't think we now disagree on anything more substantial than
what the __hash__ documentation in the Language Reference should be saying :)
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane,
long-held assumptions. Those don't get changed
overnight - it takes at least a couple of days :)
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
http://boredomandlaziness.skyst
stands will disappear for the Python 2.x series.
Python 3.0 will be a case of "OK, let's take the things we learned were good and
keep them, and throw away the things we realised were bad"
Undoubtedly, the two languages will co-exist for quite some time.
Cheers,
Nick.
--
Nick C
out
circular imports.
Any extra global configuration properties can be added by updating the
'setConfiguration' function.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
Alex Martelli wrote:
Nick Coghlan <[EMAIL PROTECTED]> wrote:
...
Perhaps something like:
accepts_func( (def (a, b, c) to f(a) + o(b) - o(c)) )
Nice, except I think 'as' would be better than 'to'. 'as' should be a
full keyword in 3.0 anyway (rather than a
Nick Coghlan wrote:
Indeed, lambda as it currently stands will disappear for the Python 2.x
series.
Will NOT disappear. I repeat, will NOT disappear.
Cheers,
Nick.
Damn those missing negators. . .
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
at, I have no idea :)
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list
compile time code optimisation
through static type declarations.
The write up is here:
http://boredomandlaziness.skystorm.net/2004/12/type-checking-in-python.html
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
l it after gentoo's portage, with less features of course.
> Would this be acceptable?
I don't know enough about Portage to answer that question. I do know any package
manager which made it into the standard distribution would need to work for at
least the big three platforms (
))
['Test']
Py> list(x())
[]
Your failing case with len(*args) was due to the iterator having already been
consumed :)
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list
quot;Py>').
I believe PYTHONSTARTUP is handled by CPython's main function before it gets to
the interactive interpreter.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
lassify mutable objects, and then check for membership in those groups.
You can use lists for this, but the lookup is slow. Conventional dictionaries
and sets give a fast lookup, but require that the items in use be hashable.
An identity dictionary (or set) solves the 'object classification&
s well with the CPython interpreter as that, as you may have guessed
from the name, is written in C and exports a direct C/API.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
t;only
add items greater than zero", it is worth checking the timings for calling
extend with a generator expression or list comprehension that filters out the
values you don't want)
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
-
good.
Regards,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list
potential source of precision bugs:
Py> bignum = 2 ** 62
Py> bignum
4611686018427387904L
Py> bignum + 1.0
4.6116860184273879e+018
Py> float(bignum) != bignum + 1.0
False
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
or things to show up :)
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list
m packages but failed with dependence.
I didn't try the rpm's. Just get the source tarball, configure, make,
and make install.
Although one might argue that make altinstall is a safer approach ;)
(Any scripts using "/usr/bin/env python" would then continue to use Python 2.2)
C
#x27;
if the denominator is one, or ''(num / denom)'' if the denominator is
not one.
Is that acceptable?
Sounds fine to me.
On the str() front, I was wondering if Rational("x / y") should be an acceptable
string inpu
requirements. Providing these two data types seemed like a nice way to do an end
run around the bulk of the 'potentially variable hash' key problem.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list
work properly - the default hash is inherited from object anyway.
This *is* a bug (since Guido called it such), but one not yet fixed as the
obvious solution (removing object.__hash__) causes problems for Jython, and a
non-obvious solution has not been identified.
Cheers,
Nick.
--
Nick Co
only way I know of to get an actual Named
Pipe is with CreateNamedPipe.
The folks on the win32 SIG might be able to help you out with more specifics
about the uses of named pipes.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Aust
here you don't want to modify the class definitions for
the objects being annotated or classified.
I don't want the capability enough to pursue it, but Antoon seems reasonably
motivated :)
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
Terry Reedy wrote:
"Nick Coghlan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
This *is* a bug (since Guido called it such), but one not yet fixed as
the obvious solution (removing object.__hash__) causes problems for
Jython,
and a non-obvious solution has not
ooking for feedback on a def-based syntax that came up in a recent
c.l.p discussion:
http://boredomandlaziness.skystorm.net/2004/12/anonymous-functions-in-python.html
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane,
Ed Leafe wrote:
Exactly! Now can we clear anything else up for you? ;-)
How about a computer program than can correctly count the number of letter E's
in your signature? :)
Cheers,
Nick.
I like the sig, if you hadn't guessed. . .
--
Nick Coghlan | [EMAIL PROTECTED] |
s written with the
'other' toolkit track any changes you make to the theme used by your window manager.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
http://boredomandlaziness.s
Paul Rubin wrote:
Nick Coghlan <[EMAIL PROTECTED]> writes:
Anyway, I'm looking for feedback on a def-based syntax that came up in
a recent c.l.p discussion:
Looks like just an even more contorted version of lambda. It doesn't
fix lambda's main deficiency which is inab
Jp Calderone wrote:
On Fri, 31 Dec 2004 00:00:31 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote:
Paul Rubin wrote:
Nick Coghlan <[EMAIL PROTECTED]> writes:
Anyway, I'm looking for feedback on a def-based syntax that came up in
a recent c.l.p discussion:
Looks like just an ev
Batista, Facundo wrote:
[Nick Coghlan]
#- I just don't understand why people complain so much about
#- the restriction to a
#- single expression in lambdas, yet there is nary a peep about
#- the same
#- restriction for generator expressions and list comprehensions.
What *I* don't under
something to think about.
I forgot about that little trap. . .
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python
Carl Banks wrote:
Nick Coghlan wrote:
In much the same way that programmers often spend a lot of time
optimizing parts of their program that will yield very minor dividends,
while they could have spent that time working on other things that will
pay off a lot, many of the wannabe language
x:
( for in if )
def expression_func():
return
def generator():
for in
if :
yield expression_func()
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
http://boredomandlazin
Mariano Draghi wrote:
I think that somehow Python's "J2EE" equivalent is already out there
(sort of...),
I think it's called PEAK. . .
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
(and providing
references for additional information, including books if they're available)
seems like the most reasonable alternative.
Now, if we could just switch to wxPython and Boa Constructor for Py3K. . .
Cheers,
Nick.
Sorry Kurt!
--
Nick Coghlan | [EMAIL PROTECTED] |
e a bit of work (given what a
tangle of ifdef's the function is).
The relevant file is dist/src/Modules/posixmodule.c and the relevant function is
posix_listdir.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---
I had the same trouble. Until this point
everything was going good, but this has really bugged me
Any ideas, suggestions, comments are greatly appreciated
thanks
Nick
--
http://mail.python.org/mailman/listinfo/python-list
> See copy.deepcopy(). It will make sure that everything gets copied and
> nothing just referenced (more or less).
So far copy.deepcopy() seems to be working perfectly.
Thanks for the input
Nick
--
http://mail.python.org/mailman/listinfo/python-list
Thanks, thats a really handy function
"Ron_Adam" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Sun, 27 Mar 2005 09:01:20 GMT, "Nick L" <[EMAIL PROTECTED]>
> wrote:
>
> >I've hit a brick wall on something that I'm guess
Robert Kern <[EMAIL PROTECTED]> writes:
> So yeah, buy it.
Seconded. My copy arrived from ORA yesterday and I'm still giddy with
delight. Even if you have the first edition, the second includes a lot
of recipes that leverage or demonstrate the new features in 2.3 and
2.4.
Nick
ut it is far from being the mess you imply.
My own personal bugbear is the issue of consistency. Java's standard
library might be a huge and clumsy beast with more than its fair share
of overloading and obsolescence, but it at least has the virtue of more
consistently following conventions on
string[2:4], you know instantly by
looking at the slice indices that this contains 4-2 = 2 characters
from the original string. If the last index were included in the
slice, you'd have to remember to add 1 to get the number of
characters in the sliced string.
It all makes perfect sense whe
, but you get
what I'm suggesting, right? To mangle a lwall quote, "The only
substitute for make is make."
Nick
--
# sigmask (lambda deprecation version) 20041028 || feed this to a python
print ''.join([chr(ord(x)-1) for x in 'Ojdl!Wbshjti!=ojdlAwbshjti/psh?'])
--
http://mail.python.org/mailman/listinfo/python-list
= codecs.getwriter("utf-8")(sys.stdout.detach())
> sys.stdout.encoding = 'utf8'
> sys.stderr = codecs.getwriter("utf-8")(sys.stderr.detach())
> sys.stderr.encoding = 'utf8'
Note that calling detach() on the standa
lly. Here's an example:
def spreadsheet(csv_filename):
with open(csv_filename) as csv_file:
for csv_row in list(csv.DictReader(csv_file, delimiter='\t')):
yield csv_row
then invoked using:
for row in spreadsheet("...")
# your processing code here
Cheers,
Nick
--
https://mail.python.org/mailman/listinfo/python-list
>My question is, what do Python interpreters do with power operators where the
>power is a small constant, like 2? Do they know to take the shortcut?
Nope:
Python 3.3.0 (default, Sep 25 2013, 19:28:08)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
utions. Which is to
say, not at all.
-Nick Cash
--
https://mail.python.org/mailman/listinfo/python-list
> and "%s" (which is incredibly useful) is not even documented (I suspect it's
> also not available on all platforms).
The format specifiers available to Python are just whatever is available to the
underlying c time.h.
The manpage for strftime indicates that %s isn't part of the C standard, bu
ou narrow
down where the problem lies.
-Nick Cash
--
https://mail.python.org/mailman/listinfo/python-list
p your past you will do more to damage any
future relationships you will have with developers.
- Nick.
On Thu, Dec 10, 2015 at 2:55 PM françai s wrote:
> Administrators and moderators of Python-list, please erase all the messages
> that I not should have posted here in python-list.
>
Dear python team,
On my 64bit windows10 the SND_ASYNC flag doesn’t cause the sound to play
asynchronously.
Nick McElwaine
Sent from Mail for Windows 10
--
https://mail.python.org/mailman/listinfo/python-list
[0]]
1
>>> for k in d:
... value = d[k]
... break
...
>>> value
1
>>> list(d.values())[0]
1
None of this feels like the "one, and preferably only one, obvious way to do
it" we all strive for. Any other ideas?
Thanks,
Nick
--
https://mail.python.org/mailman/listinfo/python-list
one the same. But some systems will still be reliant on
it.
Then there is also this PEP:
https://www.python.org/dev/peps/pep-0394/
- Nick.
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, Mar 3, 2016 at 10:26 AM ast wrote:
> Hello
>
> This has to be told
>
> I created a file pickle.py
>
You could stop there.
The number of times I've had to correct a student for naming their script
"turtle.py".
And the number of times I've caught myself doing it...
...
Hello All,
Found an odd behavior I'd never known about today, not sure if it's a bug
or known. Python 3.4.4 (anaconda).
True, False, 0, 1 can all be used as dictionary keys.
But Apparently True and 1 hash to the same item and False and 0 hash to the
same item, so they can easily overwrite (whic
On Sat, Mar 26, 2016 at 9:59 AM Aleksander Alekseev
wrote:
> Hello
>
> Recently I spend half an hour looking for a bug in code like this:
>
> eax@fujitsu:~/temp$ cat ./t.py
> #!/usr/bin/env python3
>
> for x in range(0,5):
> if x % 2 == 0:
> next
> print(str(x))
>
> eax@fujitsu:~/
> Am I the only one who'd like to see optional types introduced in Python?
Nope! Some dude named "Guido" would like to see them as well:
https://mail.python.org/pipermail/python-ideas/2014-August/028742.html
--
https://mail.python.org/mailman/listinfo/python-list
ling to consider an update to the C
extension porting guide to be more in line with Brett's latest version of
the Python level porting guide?
Regards,
Nick.
--
https://mail.python.org/mailman/listinfo/python-list
belt-and-suspenders-and-duct-tape approach `data = None`, `del
data`, and `gc.collect()` does nothing.
I'm pretty sure the generator itself is not doubling up on memory because
otherwise a single large value it yields would increase the peak usage, and
in the *same iteration* a large object a
Ah, I think I was equating `yield` too closely with `return` in my head.
Whereas `return` results in the destruction of the function's locals,
`yield` I should have known keeps them around, a la C's `static` functions.
Many thanks!
--
https://mail.python.org/mailman/listinfo/python-list
Roy Smith wrote:
> In article ,
> Nick Timkovich wrote:
>
> > Ah, I think I was equating `yield` too closely with `return` in my head.
> > Whereas `return` results in the destruction of the function's locals,
> > `yield` I should have known keeps them around, a la
On Tue, Feb 25, 2014 at 2:32 PM, mauro wrote:
>
> So I wonder why operations such us intersection, union, difference,
> symmetric difference that are available for sets and are not available
> for dictionaries without going via key dictviews.
How would the set operations apply to the dictionary v
On Thu, Feb 27, 2014 at 10:33 AM, Chris Angelico wrote:
> On Fri, Feb 28, 2014 at 3:27 AM, Eric Jacoboni
> wrote:
> > But, imho, it's far from being a intuitive result, to say the least.
>
> It's unintuitive, but it's a consequence of the way += is defined. If
> you don't want assignment, don't
ndom to the stockbin parameter, the test passes.
Best wishes,
Nick
for qty in [4, 0]:
random.seed(seed)
for cart in range(test_size):
for special in range(randrange(3)):
s.addUpdate_special_to_cart(
ial_id=rnd.randrange(test_size), special_qty=qty,
products=[(rnd.choice(PRODUCTS), rnd.choice(range(10)))
for r in
range(rnd.randrange(7))])
Cheers,
Nick
--
https://mail.python.
xs:
if not cond(x):
break
yield e(x)
and for 'from':
emit = False
for x in xs:
if not emit:
if cond(x):
emit = True
else:
yield e(x)
Cheers,
Nick
--
https://mail.python.org/mailman/listinfo/python-list
On Friday, 27 September 2013 00:39:30 UTC+10, Nick Mellor wrote:
[snip]
> for x in xs:
> if not emit:
> if cond(x):
> emit = True
> else:
> yield e(x)
>
Oops!
for x in xs:
if not emit:
if cond(x):
emit = True
eeded! Although it's not as pretty as the original post, but
neither was Roy's.
-Nick Cash
--
https://mail.python.org/mailman/listinfo/python-list
be added to itertools before, but rejected:
https://mail.python.org/pipermail/python-ideas/2012-July/015671.html and
http://bugs.python.org/issue13095
- Nick Cash
--
https://mail.python.org/mailman/listinfo/python-list
tc. It's not the prettiest solution, but it
could work.
-Nick Cash
--
https://mail.python.org/mailman/listinfo/python-list
501 - 600 of 1626 matches
Mail list logo