|deltab||Jerub: that would cover the only part of AOP that anybody ever seems to explain|
|chrisjw||yes i know i already l0lled it|
|Peper||I 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"
|cattack||Just wondering but what python rpm provides lxml_etree?|
|cybercobra||cattack: etree sounds like ElementTree (google it), but that's only a guess.|
|marienz||cybercobra: nah, lxml is something different iirc|
|Peper||Jerub: is it clear now?|
|marienz||yeah, etree api using libxml2|
|cattack||I am not familure with Python, just an installer for an app uses it and I am missing alot of python on this box.|
|sproingie||if you want to assert some match that you're not subbing *and* do some sub, then use two regexes|
|marienz||use $yourfavoritepackagemanager $searchcommand lxml :)|
|sproingie||the alternative is not just insanely hairy, it's full of backtracks|
|jergens||Is there a simple way in python to define a list using a range? Like a=[1-3,10-20]|
Instead of a for loop?
|marienz||jergens: 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.
|jergens||marienz: Thanks, that works!|
|marienz||jergens: 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|
like "for i in chain(xrange(1, 4), xrange(10, 21)):"
|jergens||No, I need a list :)|
|marienz||this doesn't build any lists in memory so it's considerably faster and memory-friendlier for large ranges.|
|kosh||itertools and generators are great :)|
|sproingie||i wish itertools stuff was built into the language|
|kosh||python sure had done a lot over the last several years to make it very easy to make programs far more memory efficient|
|Peper||sproingie: I will go for per line parsing with startswith then|
|marienz||sproingie: just "from itertools import *" if you feel like that :)|
|sproingie||marienz: because generators are such a cool powerful idiom|
marienz: i'm talking about infix operators
|kosh||sproingie: the generator stuff is built in|