Python und XML: lxml

May 2005
19

XML war und ist in Python ein Rough Spot (neben WebApplication-Frameworks). Nichts mit “There’s Only One Way To Do It”. Die XML-Komponenten der Standard-Library sind eher ein Witz und man kann deshalb aus vielen alternativen Implementierungen auswählen. Da hat man dann meistens die Wahl zwischen Pythonic aber langsam/featurearm und seltsamer API, dafür aber schnell und mächtig. Dazu kamen seltsame BenchmarksFights in der Community.

Auf der einen Seite hat mir libxml2 gefallen, hauptsächlich wegen der Empfehlung von Mark Pilgrim, der muss es ja wissen :) Auf der anderen — pythonic — Seite hat es mir ElementTree sehr angetan. Nachdem ich das benutzt hatte wollte ich nie mehr Java-Code schreiben der mit XML zu tun hat. ElementTree kann aber kein XSLT und nur eingeschränkt XPath und so musste ich halt mehrere Libraries verwenden, was mich doch gestört hat.

Dank Martijn Faassen hat sich das jetzt aber geändert. Denn der hat einen extrem kühlen Wrapper geschrieben, mit dem man libxml2/libxslt über die ElementTree-API ansprechen kann. lxml ist zwar teilweise noch etwas buggy (aufgrund des Memory-Managements von libxml), aber cheap nfl jerseys gut benutzbar und ein schöne und praktikable Lösung um in Python mit XML zu arbeiten.

Ich konnte den mit ElementTree geschriebenen Teil eins-zu-eins mit lxml weiter benutzen und hab jetzt eine Abhängigkeit weniger in meinem Projekt.

i live in two worlds opinionA three month time frame can be broken up into twelve week segments. Four weeks at a time will help you establish patterns for smaller goals. Modifying your diet and increasing your level of activity will help you achieve those goals sooner then later. “One cheap authentic jerseys time we were sent a lead to try and track Cheap nfl jerseys down the prime suspect in a triple gang related homicide. We went to the area of his ex girlfriend’s apartment and waited to see if he’d show up. I was covering the rear of the apartment building and the rest of the team was set up on the front side.”. Ms. Ramirez put her boyfriend on ice and hired a personal trainer to accommodate officials, but apparently all for nought. The pageant ray ban outlet maintains she violated her contract and they have oakley outlet moved on to the runner up. His career high of 15 long balls was set just last year. He’s halfway there already but I’m sure he would trade some of those home runs for wins. Houston is easily the most disappointing team in baseball after one month. Contact David J. In Advanced Computing at Imperial College London, UK. He Cheap NFL Jerseys is a GlaxoSmithKline Wellcome Trust funded Clinical Fellow at Imperial College London, where he undertakes his research under the direction Diese of Prof. Got it, said Stephen, nodding. You going to stick your neck out, make sure you riding fake oakleys Secretariat. This case, Kroenke $2.6 billion Inglewood project was the prized thoroughbred, and the Triple Crown meant topping the two other cheap jerseys competitors in the race, the San Diego Chargers cheap jerseys and Oakland Raiders, who had teamed to propose a rival stadium concept in Carson. I’m not sure. I really like it. The only real draw back is the cost and contract. On Saturday, in the team of four duplicate event, the Azad Hind team comprising B. Majumdar, Sandeep Dutta, Kastub Bindre, Aniket Sanghvi, Kaustub Nandi and S. Basak was leading with 118 VPs at the end of wholesale nfl jersyes the first set of round robin league. The smallest cat of Africa can reach a speed of 80 km/hour in less than 3 seconds. Cheetahs are classified as an endangered species due to their dwindling habitat and high mortality rate of the cubs. They are found only in the hockey jerseys southern parts of Africa and are extinct outside the African land.. In an effort to promote their HDGameDay event, the social media marketing wizard in charge of Home Depot’s official Twitter account shot this blazing tweet into the ether, challenging millions of people to try to tell the difference between two black guys and a person in a gorilla suit:”More saving. More doing. Less cheap nfl jerseys thinking.

Factory-Pattern in Python

Nov 2004
16

Ich glaube man muss aufpassen, wenn man aus der Java-Welt kommt und den dort üblichen Pattern-Overkill auf Python überträgt. Zudem viele Standard-Pattern aufgrund der Dynamik der Sprache nicht unbedingt gebraucht werden oder es bessere Lösungen gibt.

Nichstdestotrotz hatte ich mal wieder einen Wow-Effekt, beim Versuch eine Factory für meine Klassen zu bauen. Nachdem ich einige Zeit mit Modulen und Packages in Python gekämpft hatte — das ist halt doch etwas anders als in Java — hatte ich ein Modul Bookmarks, in dem meine Klassen für die Bookmark-Repräsentation der unterschiedlichen Browser gesammelt waren (Safari, Firefox und Camino). Die Factory-Methode ist als Funktion des Moduls implementiert, also keiner Klasse zugeordnet und soll mir eine Safari-Klasse geben, wenn ich sie mit dem String “Safari” aufrufe. Nichts leichter als das;

def factory(className, *args):
    aClass = getattr(__import__(__name__), className)
    return apply(aClass, args)

die erste Zeile mit dem getattr-Aufruf sorgt dafür, dass ich über einen String die Objekt-Referenz bekomme. Der komische erste Parameter gibt mir die Referenz auf das Modul, in dem ich mich gerade befinde, sonst müsste ich von außerhalb des Moduls das getattr aufrufen und die Factory dann mit der Referenz auf das Objekt aufrufen.

Die praktische apply-Methode erzeugt mir nun meine Klasse mit allen Parametern, die ich als zusätzliche Parameter übergebe, z.B.:

importer = Bookmarks.factory('Firefox', firefox_file)

Das rockt ;-)

Apropos DesignPattern: Aus der Head-First-Serie von O’Reilly ist ein Titel über DesignPatterns erschienen. Sieht sehr vielversprechend aus, denn das Head First Java und das ganze Konzept der Serie hat mir gut gefallen. Und die Literatur über Pattern ist eher mau. Das GangOfFour ist nicht mein Ding, das freie Thinking in Patterns von Bruce Eckel ist bisher mein Favorit.

Linebackers need to be able to change direction at full cheap authentic jerseys speed and make fast, lateral movements. These athletes should practice short shuttle drills involving both forward sprints and lateral wholesale jerseys movement in a small radius. An example is the 20 yard shuttle. Begin straddling the 10 yard line, move laterally to the 5 yard line and touch the line with your hand, change direction and sprint 10 yards in the opposite direction to the 15 yard cheap cheap football jerseys oakleys sunglasses line and touch the line with your cheap football jerseys hand, then sprint back through the middle back to the 10 yard line. This can be a cheap oakley sunglasses timed drill or performed for a set number of reps.Government, when at its best, should exist to provide those goods and services that the private sector does not. Although cheap nfl jerseys I might need a bridge, a freeway or an airport, I am in no position to build any of these, so I rely on the government to provide these public benefits. Those who advocate spending public money on bringing the NFL to Los Angeles, therefore, need to show that a professional football franchise constitutes a public benefit 19:04:52 and that its funding should take priority over, say, a subway to the sea.Via Wikimedia CommonsBefore recent modern conveniences, people bathed less often, and frequently in the same water. Even nowadays, showering doesn’t kill bacteria or other microorganisms, though it does move them around. A colony of bacteria living on your shower wall might move to your leg; a colony Cheap Jerseys from your leg might move to your head; a colony from your groin might even take up residence on your hands. Of course, using antibacterial soaps can kill microorganisms, though in an effort not to create too many super bacteria, medical experts generally recommend not using these soaps daily.God takes you places not so you can achieve what you set out for, but to play a part and ray ban outlet help something greater than yourself.This has wholesale Jerseys been an amazing journey for me and a truly humbling experience. I have learnt so much and will never forget my time with this team.I want to thank Ben and the entire coaching staff, the players and especially the fans. If you do avoid detection, god help you if you actually fire a shot. That’s where the Boomerang system comes in, which uses an array cheap nhl jerseys of microphones to instantly judge the speed and direction of the shot, based on the muzzle report and the shockwave of the bullet as it zips past. Immediately it knows where the shot came from, and even what kind of weapon it is.Thank you, Norberto, and good morning everyone. Thank you for joining us today. After the great deal of effort invested in strengthening our human resources, balance sheet, and Fake Oakleys overall operations over the past few years, it is gratifying to share with you our Q4 and full year 2011 results. With record revenue across Q4 and the full year, it is clear that our model to invest in both organic and new business growth is working, and that our strategy for the future of IntegraMed is sound.

Python IDEs Tabdump

Jul 2004
14

Muss mal kurz ein paar Tabs loswerden und die ganzen Links zu IDEs für Python an einem Punkt sammeln:

You gotta feel special when they’re asking you to join them,” said Willie Cauley Stein, a Roc Nation client who just completed his wholesale nfl jerseys rookie season with the Sacramento Kings. “It’s so exclusive.”This summer ray bans ale represents a milestone moment for the young agency: NBA star Kevin Durant becomes a free agent July 1, the biggest chance yet for Roc Nation to show it’s more than flash and bravado. There apparently exists a authentic nfl jerseys curious love affair between a majority of the former players responding and the NFL. It transcends disturbing Travel statistics, alarming trends and ominous warnings. Bureau of Labor Cheap NFL Jerseys Statistics, ranked 250 occupations according to work cheap jordans environment, income, outlook, stress, physical demands and security. The NFL player finished 241st overall and was listed in the bottom 10 of each category, except income.My mum come from London though so we visited a lot. renound drinking hole of Dr wholesale jerseys cheap jordans Samuel Johnson genuine living history, perfect beer and Ludicrously cheep price a pint. They provide Taxi services from and to all London Airports Heathrow, Gatwick, Stansted, Luton and London City Airports. They have very good fleet of cars and also very experienced and well mannered drivers . Helpfully, most cities now paint instrucitons on the tarmac at crossings indicating which direction to look for traffic.”We’re really happy for Michael that he’s made the decision to announce this, and we’re proud of him and how he represents Mizzou,” Pinkel said in a statement. “Michael is a great example of just how important it is to be respectful of others, he’s taught a lot of people here first hand that it doesn’t matter what your background is, or your personal orientation, we’re all on the same team and we all support each other. If Michael doesn’t have fake ray bans the support of his teammates like he did this past year, I don’t think there’s any way he has the type of season he put together.”On an official trade visit to Japan in 2003 Vladimir took time out from negotiations to spiritually kick the ray bans sale entire country’s ass with Judo. In front of the Japanese Prime Minister in the Kodokan judo headquarters of Japan, Putin demonstrated his willingness to take on any nation at its custom jerseys own sport. He suited up and showed everyone cheap jordans his version of various sweeps and throws on the center Kodokan instructor in a sparring match. In fact, he’s the only world leader with a special move (Haraigoshi). While Qaddafi has to pay foreigners to fight his own people, you get the impression that if the Russian public ever rebelled Putin would roll up his sleeves and give the cheap nhl jerseys army the day off.

Parsing the command line

May 2004
05

In Python ist es mithilfe des getopt-Modul eh schon relativ einfach die Argumente und Optionen von Shellscripts zu verarbeiten. Noch einfacher und eleganter wird es, wenn man optionparse benutzt. Die schöne Idee: Wenn ich cheap football jerseys schon im Docstring (sozusagen das usage für das Script) die Argumente spezifiziert habe, warum dann nochmals für das getopt-Modul alles genau angeben.

Also einfach den Docstring parsen und daraus die Argumente herausziehen:

"""An example script invoking optionparse, my wrapper around optparse.

usage: %prog [options] args -p, --positional: print positional arguments -1, --option1=OPTION1: print option1 -2, --option2=OPTION2: print option2 """

import optionparse opt, args = optionparse.parse(__doc__) if not opt and not args: optionparse.exit() if opt.positional: print args if opt.option1: print opt.option1 if opt.option2: print opt.option2

Da machen Shellscripte noch mehr Spaß, vorallem wird man auch gezwungen nen sinnvollen Docstring zu schreiben ;-)

So did EA’s ploy to market Dante’s Inferno with a fake protest from devout Christians. The truth came out, everyone talked about how dumb it was, and an otherwise completely forgettable action game got more publicity than they ever would have otherwise. So every now and then a new “controversy” pops up that exists only because the developers planned it, and we all fall for it and make gaming look dumb in the process. It’s not going to stop until humanity manages ray bans sale to avoid cheap jerseys being outraged at something that’s explicitly intended to oakley outlet generate outrage. So, never, probably.The plan was a simple one. We had agreed that, given our stretched finances, we could neither afford nor justify a big bash. After all, just because we were getting married, it didn’t mean we had to go over the top. We’d invite a Trading few friends, wear something off the peg (surely I had something rather lovely at the back of my wardrobe?) and head off to the pub for a steak and a decent bottle of red.Three of my five predictions wholesale football jerseys china have fared extremely well so far this year. I am confident that my Amazon and SodaStream predictions will look even more right in the end, and I’m pretty sure Apple will not see $700 anytime soon. Netflix has surprised many, including myself, but they still have a lot to prove to justify their current share price. In terms of my S 500 volatility prediction, there is still time for it to turn around, but right now, it doesn’t look good. Overall, these predictions have been fairly decent, and I will continue to update you as we get closer fake ray bans to year’s end. One thing is certain. If things continue as they are trending, I will not do any overall market predictions next year!The wireless phone jacks have been approved by the major players in home dish TV. Now one shouldn t worry about the telephone access near the receiver or the dish TV box this is because ray bans sale by using the system the installers can now save their time and energy. Wireless, power line carrier telephone cheap oakleys outlet communication systems provide many important advantages to telephone users, especially where standard telephone jacks are Cheap NFL Jerseys China limited or unavailable and where AC supply power is readily available to the users. He standing inside the Encino compound that been in the family for nearly a quarter century. The two acre estate named for the street it on has served as oakley outlet inspiration for Jackson. Though the main house is under renovation, his younger sister Paris, now cheap nfl jerseys 18, lives in the guesthouse and Jackson visits cheap ray bans often.

Learning Python

Apr 2004
15

Um meine selbst zusammengehackten Python-Kenntnisse mal auf ein solidieres Fundament zu stellen habe ich etwas getan, was ich schon lang nicht mehr gemacht habe: Ein Buch gekauft und *tada* es komplett cheap ray bans durchgelesen ;-)

Über Python gibt es mittlerweile eine ganze Menge an Büchern und nach einiger Recherche hatte sich die Auswahl auf die beiden von O’Reilly Python in a Nutshell und Learning Python verringert.
Learning Python ist mehr an Anfänger gerichtet wogegen das Nutshell Buch ein eben typisches Nutshell ist, kompakte und detaillierte Beschreibung der Sprache.

Ich hab mich dann für Learning cheap oakleys sunglasses Python entschieden, da es gerade in einer zweiten Edition rauskam und damit aktueller ist und mich das Probekapitel des Nutshell-Buchs doch etwas gelangweilt hat (und Amazon hatte gerade ein Sonderangebot *g*). Und auch wenn das Learning Python-Buch teilweise für Anfänger geschrieben ist (z.B. was ist OOP) war es die richtige Entscheidung denn es ist gut und verständlich geschrieben und hat mir denke ich die Python-Konzepte besser erklärt cheap oakleys als die kompakte Beschreibung des Nutshell-Buchs.

Also wer auf der Suche nach ner schönen und umfassenden Einführung in Python ist sollte sich Learning Python mal angucken. Zudem ist qualitativ gut gemacht: ziemlich dünn für 600 Seiten und schöne Typo.

If you Baratas Replicas Ray Ban have only watched recent remakes of the Pink Panther films then I’d have to say that they are nothing like the originals but a grave injustice to comedy fans everywhere! Peter Sellers makes this film (and others in the ray ban sunglasses Pink Panther series) truly a great joy to watch.Carolina Panthers (3 6) It’s hard to believe this team ran roughshod through the cheap jerseys NFL last year. A 15 1 regular season culminated in a Super Bowl berth. Cam Newton brought back the dab and then his team promptly blew a 17 point lead at home. It’s the first time in franchise history they’ve blown a lead that large after halftime at home. (LWR 22)”Clowncest is absurdly common,” says Ken. These Bobo Bubbles hookups cheap nfl jerseys often happen in the car, right after the show. “Because of our tight schedules,” he says, “I’d NFL Jerseys China say with confidence that costumes are mostly kept on. The guy’s wearing the vest, rainbow plaid pants, and bowler hat, and the girl still has her rainbow polka dot dress on and hitched Wholesale Jerseys up.”If you’ve ever wanted to see what it looks like when nightmares breed, hang around a clown’s car after a performance.If you are performing a heavy workout, you can reduce the amount of weight you take on the last set. If you do a 4 set workout, make sure that you use the fourth set to cool down, by lifting a lesser Wholesale China Jerseys weight. Some people work out all their muscles in one day, while others work out a single muscle at a time. Either way, it is important that you give the muscle that you worked out a good long stretch for around 15 to 20 seconds. If you exercise all the muscles in one day, then you will have to stretch all the main muscle groups at the end of your workout. So, stretch your leg muscles, glutes, back, arms, shoulders, etc.That thing new balance floating for louis vuitton purses a while, when barbour jacket outlet the hollister co high roof, low draw from louboutin shoes the bed when the ralph lauren past, but air jordan retro fortunately did prada handbags not encounter, and finally air jordan shoes cheap oakleys got watches into the chimney, just got opinions ray bans thud coach factory outlet online explode. Contact minor leagues, foreign leagues and the Harlem Globetrotters or Harlem Ambassadors (relatively new) exhibition teams for a try out. Bring your own water and hockey jerseys media kits to the try out. If your agent can attend, that even better. Be on your best behavior and act professionally. Try outs are serious business.I mean, the television contract alone for the NCAA tournament is in the billions of dollars. Shouldn’t they get some kind of stipend? And wouldn’t that also help address some of these problems and lessen some of the pressure that players, particularly ones from very impoverished socioeconomic backgrounds face on a year in year out basis.

When Pythons Attack

Feb 2004
09

When Pythons Attack – Common Mistakes of Python Programmers. Auf die meisten Sachen kommt Cheap Jerseys man nach ner Weile auch selbst, aber schön zusammengstellt. Nützlicher ist sicherlich die zweite Seite.

Don’t Code C in Python

Bin stark am überlegen mir das Learning Python, 2nd Edition zu kaufen (was zeigt das oreillynet funktioniert) um die ganze Python-Sache mal auf ne solide Basis zu stellen. Obwohl es für Python jede Menge guter Online-Bücher gibt. Mal noch Cheap NFL Jerseys ein paar Reviews lesen.

five things we learnt as peyton manning’s job security is in doubtAnd I was like hockey jerseys in Zuzuland (ph) for about three days. And I woke up to a doctor standing over me, telling me that I couldn’t play football anymore. So, the concussion debate is a very serious one. Fill up the boxes with participants. The game ray ban outlet is one of chance and does not require any strategy or science, therefore the players should choose the boxes that feel are lucky for them. Fill up the entire board if possible; empty boxes mean there is a chance that Cheap Jerseys there will be no winner. The Texans are 3 2 and still in first place in the AFC South, but you wouldn know it if you replica oakleys talked to Texans fans. That pessimism has a lot to do with Osweiler, who has proven all of the critics of his $72 million deal right through the first five weeks of the season. The 25 year old has been generally inaccurate and his decision making has been atrocious. cheap football jerseys china Only the supervisor said he was 100% happy with his wage level (he is paid a salary on a monthly bonus incentive plan). The mid level employee felt she completed too many tasks for too many people and deserved a higher hourly rate, especially since overtime oakley outlet was discouraged. In the area of attempting to tackle any task assigned, all three said they Sell do try but often NBA Jerseys Cheap don’t finish the job if they don’t understand it; and only finish it if asked why it’s not complete. The majority of these people have a god given talent and work hard to maintain it. Yet, at the same time, we can all be honest about it. The majority of them also couldn’t out smart the children cheering them on. Note where you are. You just have to start. So decide exactly what you want to work on, find a suitable plan and start today.. Monday Night Football regularly sits at the top of weekly TV ratings, at least for the regular season. With so many views, it has been quite an asset for ESPN in the fake oakleys past few years. This contract extension ensures that ESPN enjoys the profits as Monday Night Football continues to become more popular as time goes on. ParticipantsFor this cheap jerseys from china prospective study, we enrolled patients with localized RNFL defects and normal control subjects who visited the glaucoma center at Hanyang University Medical Center from September 2010 to August 2011. The study protocol was approved by the institutional review board of ray ban sunglasses Hanyang University Medical Center and followed the tenets of the Declaration of Helsinki. Informed consent was obtained from all the participants..