I just learned Prototype for Javascript. It’s super convenient: using the $ shortcut, accessing xml elements is not painful any more!
The question: is there a Prototype-like extension for Python?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Python has lxml which has the
xpathmethod wherein you could use xpath expressions to select elements. As I understand it, $ in prototype searches and returns an element that has a particular id, in which case could be translated in xpath to*[@id=<someid>]like so:I think the Python standard library includes support for a subset of xpath in ElementTree too so you might be able to implement that there somehow if you do not wish to install lxml (which isn’t included in stdlib)…