#python - Sun 18 Feb 2007 between 19:49 and 20:43

NY Lost Funds



deltabJerub: that would cover the only part of AOP that anybody ever seems to explain
chrisjwyes i know i already l0lled it
PeperI know I can parse every line and filter out with startswith
what's not clear?
I have a file
and I want to sub "bar" with "test" if "bar" is not followed by "blah" and if the line is not starting with "foo"
cattackJust wondering but what python rpm provides lxml_etree?
cybercobracattack: etree sounds like ElementTree (google it), but that's only a guess.
marienzcybercobra: nah, lxml is something different iirc
actionmarienz checks-
marienzchecks-
PeperJerub: is it clear now?
marienzyeah, etree api using libxml2
cattackI am not familure with Python, just an installer for an app uses it and I am missing alot of python on this box.
marienzdistro-specific.
sproingieif you want to assert some match that you're not subbing *and* do some sub, then use two regexes
marienzuse $yourfavoritepackagemanager $searchcommand lxml :)
sproingiethe alternative is not just insanely hairy, it's full of backtracks
jergensIs there a simple way in python to define a list using a range? Like a=[1-3,10-20]
Instead of a for loop?
marienzjergens: range(1, 4) + range(10, 21) assuming I guess what you mean correctly.
jergens: range returns a list, you can concatenate lists with +
jergens: not particularly efficient for huge lists though.
jergensmarienz: Thanks, that works!
marienzjergens: also if you don't actually need a list, you just need to iterate over those numbers, and they're large, use xrange and itertools.ichain
err, chain
like "for i in chain(xrange(1, 4), xrange(10, 21)):"
jergensNo, I need a list :)
marienzthis doesn't build any lists in memory so it's considerably faster and memory-friendlier for large ranges.
koshitertools and generators are great :)
sproingiei wish itertools stuff was built into the language
koshpython sure had done a lot over the last several years to make it very easy to make programs far more memory efficient
Pepersproingie: I will go for per line parsing with startswith then
marienzsproingie: why?
koshs/has/had
marienzsproingie: just "from itertools import *" if you feel like that :)
koshs/had/has
sproingiemarienz: because generators are such a cool powerful idiom
marienz: i'm talking about infix operators
marienzahhh
koshsproingie: the generator stuff is built in

Page: 5 12 19 26 33 40 

IrcArchive

NY Lost Funds