Call for volunteers to help maintain bugs.python.org's issue tracker
The Python Software Foundation's infrastructure committee is looking for volunteers to help maintain the Roundup issue tracker installed for http://bugs.python.org. Responsibilities revolve around maintaining the Roundup installation itself (tracker schema, modifying the installed copy of Roundup, etc.) and the occasional database work (changes to the database, etc.). You do not have to be an expert at Roundup to volunteer! You can learn on the job by doing offline development and submitting patches until you are of a proper level of experience to gain commit access to the code (which can be seen at XXX). If you still have a New Years resolution to help Python out this is a great way to fulfill the promise you made yourself for 2008! If you are interested in volunteering, please email tracker-discuss at python.org. Thanks to all who have helped with the tracker already and those that will in the future! -Brett Cannon Chairman, PSF infrastructure committee -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
Announcement: PyChess Philidor 0.8 final
PyChess Philidor 0.8 has been released. This happens after nearly a year coding, and a rewrite of large parts of the codebase for stability and features. If you haven't already beaten fruit, gnuchess, pychess-engine and your friend with PyChess, now is time to! The most prominent new features include: * Online chess play on the FICS servers. * Ability to undo and pause chess games. * Support for UCI engines like Fruit, Glaurung and Shredder. * Full list of changes: http://code.google.com/p/pychess/wiki/PhilidorRelease Full list of features: http://pychess.googlepages.com/about Downloads: http://www.gnomefiles.com/app.php/PyChess Screenshots: http://pychess.googlepages.com/screenshots Mailing list: http://groups.google.com/group/pychess-people The development of PyChess Stauton 1.0 has just begun. We strive to make this the greatest free chess client out there, so if you have opinions, don't let them go unheard on the mailing list! If you would like help fix the translation of PyChess in your language, see http://code.google.com/p/pychess/wiki/RosettaTranslates to get started. -- Best Regards, Med Venlig Hilsen, Thomas -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
Re: flattening a dict
Steven D'Aprano [EMAIL PROTECTED] wrote: # Untested def flattendict(d): def gen(L): return (x for M in exp(L) for x in rec(M)) def exp(L): return (L+list(kv) for kv in L.pop().iteritems()) def rec(M): return gen(M) if isinstance(M[-1],dict) else [M] return dict((tuple(L[:-1]),L[-1]) for L in gen([d])) No. The function is hard to read, not because it uses lambdas, but because it is obfuscated Python. The lambda syntax doesn't contribute to the obfuscation. In this particular case I think the lambda does contribute to the obfuscation. Yes, they are single expressions, but only because that have been contorted to become single expressions. The first two return generators, so if you don't force them into a lambda you can write them out as for loops with yield. The last one is an if..else statement. Splitting them into multiple statements also removes the need to keep them as short as possible, so you don't need to use single letter variable names everywhere. And as for your point about bad code smells, no, I don't agree. If your function consists of a single expression, and you don't expect func.__name__ to have a meaningful value, then there's nothing wrong with using a named lambda. Anonymous functions are first-class objects in Python, just as classes and modules and named functions are, and people shouldn't make up superstitious rules about not assigning them to names. You've got it backwards here: the lambdas were given names. If they hadn't been assigned to names I'd have no objection. -- http://mail.python.org/mailman/listinfo/python-list
Re: Error messages when using the Console Module
import sys sys.stdout = open(stdout.log,w) sys.stderr = open(stderr.log,w) print This goes to stdout print sys.stderr, This goes to stderr This did the trick. Thanks Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: usage of string.encode('utf-8','xmlcharrefreplace')?
On Feb 19, 12:15 am, J Peyret [EMAIL PROTECTED] wrote: On Feb 18, 10:54 pm, 7stud [EMAIL PROTECTED] wrote: One last point: you can't display a unicode string. The very act of trying to print a unicode string causes it to be converted to a regular string. If you try to display a unicode string without explicitly encode()'ing it first, i.e. converting it to a regular string using a specified secret code--a so called 'codec', python will implicitly attempt to convert the unicode string to a regular string using the default codec, which is usually set to ascii. Yes, the string above was obtained by printing, which got it into ASCII format, as you picked up. Something else to watch out for when posting unicode issues. The solution I ended up with was 1) Find out the encoding in the data file. In Ubuntu's gedit editor, menu 'Save As...' displays the encoding at the bottom of the save prompt dialog. ISO-8859-15 in my case. 2) Look up encoding corresponding to ISO-8859-15 at http://docs.python.org/lib/standard-encodings.html 3) Applying the decode/encode recipe suggested previously, for which I do understand the reason now. #converting rawdescr #from ISO-8859-15 (from the file) #to UTF-8 (what postgresql wants) #no error handler required. decodeddescr = rawdescr.decode('iso8859_15').encode('utf-8') postgresql insert is done using decodeddescr variable. Postgresql is happy, I'm happy. Or, you can cheat. If you are reading from a file, you can make set it up so any string that you read from the file automatically gets converted from its encoding to another encoding. You don't even have to be aware of the fact that a regular string has to be converted into a unicode string before it can be converted to a regular string with a different encoding. Check out the codecs module and the EncodedFile() function: import codecs s = 'he Company\xef\xbf\xbds ticker' f = open('data2.txt', 'w') f.write(s) f.close() f = open('data2.txt') f_special = codecs.EncodedFile(f, 'utf-8', 'iso8859_15') #file, new encoding, file's encoding print f_special.read() #If your display device understands utf-8, you will see the troublesome character displayed. #Are you sure that character is legitimate? f.close() f_special.close() -- http://mail.python.org/mailman/listinfo/python-list
Re: Garbage collection
Ken wrote: What is your __del__ method doing? Actually, nothing but printing a message when the object is deleted, just morbid curiosity. I've yet to see one of the destructor messages, tho from sys import getrefcount print getrefcount(x) Perfect, thanks Simon -- http://mail.python.org/mailman/listinfo/python-list
Re: average of PIL images
def rgbTopixelvalue((r,g,b)): alpha=255 return unpack(l, pack(, b, g, r, alpha))[0] That's much worse than averaging the R,G,B components. oops! the intention was to pack r,g,b components into a single value sothat calculations like finding covariant matrix of a set of images etc can be done..(i need to represent each image as an array of values(either long or float)..i can't work with an array of tuples of ints.. As said above, try to compute using another color space, try HSL. The colorsys module can transform from/to RGB. even if i convert from rgb to hsl i will have a tuple(h,s,l) for each pixel and again i will have to convert it into a single value which i can use in matrix multipln etc is there a workaround sothat rgb color images can be worked on? any advice most welcome.. -- http://mail.python.org/mailman/listinfo/python-list
Re: Garbage collection
Duncan Booth napisał(a): Pretty much. If you have a __del__ method on an object then in the worst case the only thing that can be guaranteed is that it will be called zero, one or more than one times. (Admittedly the last of these only happens if you work at it). If it is called then is may be either immediately the last reference to the object is lost, or it may be later when the garbage collector runs (and not necessarily the first next time the garbage collector runs). Java finalizers are not called upon VM exit, only when object is swept by GC (for example when the object is destroyed upon program exit), the CPython docs read that this is the case for Python too. Is this behaviour standard for all VM implementations or is implementation-dependent (CPython, Jython, IronPython)? -- Jarek Zgoda Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101 We read Knuth so you don't have to. (Tim Peters) -- http://mail.python.org/mailman/listinfo/python-list
Re: average of PIL images
On Feb 19, 12:13 am, Gabriel Genellina [EMAIL PROTECTED] wrote: En Tue, 19 Feb 2008 04:01:04 -0200, vaneric [EMAIL PROTECTED] escribió: On Feb 19, 1:38 am, Robert Kern [EMAIL PROTECTED] wrote: Averaging color images is tricky; you really shouldn't do it in the RGB colorspace. hi, thanx for the guidance and detailed replies..I tried to pack the r,g,b into a single value like below(something a member posted in the past) def rgbTopixelvalue((r,g,b)): alpha=255 return unpack(l, pack(, b, g, r, alpha))[0] That's much worse than averaging the R,G,B components. First, you have to omit the alfa value (or set it at the end). Then, consider this example: (0,0,0)=black and (0,1,0)=almost black, average = (0,0,128) How do you arrive at that average? -- http://mail.python.org/mailman/listinfo/python-list
Re: Garbage collection
Jarek Zgoda [EMAIL PROTECTED] wrote: Is that true assumption that __del__ has the same purpose (and same limitations, i.e. the are not guaranteed to be fired) as Java finalizer methods? One other point I should have mentioned about __del__: if you are running under Windows and the user hits Ctrl+Break then unless you handle it Python will exit without doing any cleanup at all (as opposed to any other method of exiting such as Ctrl+C). If this matters to you then you can install a signal handler to catch the Ctrl+Break and exit cleanly. -- http://mail.python.org/mailman/listinfo/python-list
Re: Garbage collection
Jarek Zgoda [EMAIL PROTECTED] wrote: Ken napisa³(a): The good news is that you almost never have to do anything to clean up. My guess is that you might not even need to overload __del__ at all. People from a C++ background often mistakenly think that they have to write destructors when in fact they do not. Is that true assumption that __del__ has the same purpose (and same limitations, i.e. the are not guaranteed to be fired) as Java finalizer methods? Pretty much. If you have a __del__ method on an object then in the worst case the only thing that can be guaranteed is that it will be called zero, one or more than one times. (Admittedly the last of these only happens if you work at it). If it is called then is may be either immediately the last reference to the object is lost, or it may be later when the garbage collector runs (and not necessarily the first next time the garbage collector runs). The nasty case to watch for is when __del__ is called while the program is exiting: any global variables in the module may have already been cleared so you cannot be sure that you can reference anything other than attributes on the object being destroyed (and if you call methods on the same or other objects they may also find they cannot reference all their globals). Fortunately cases when you actually need to use __del__ are very rare. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to get current module object
On 19 feb, 03:33, Alex [EMAIL PROTECTED] wrote: GabrielGenellinawrote: En Mon, 18 Feb 2008 14:49:02 -0200, Alex [EMAIL PROTECTED] escribió: That's what I've been searching for, thanks. By the way, I know it might be trivial question... but function and class namespaces have __name__ attribute too. Why is global one always returned? I don't understand the question (even with the later correction namespaces-objects) There's no question anymore, I just failed to distinguish function local variables (which don't include __name__) and function object's attributes Why do you want to get the module object? globals() returns the module namespace, its __dict__, perhaps its only useful attribute... To pass it as a parameter to a function (in another module), so it can work with several modules (plugins for main program) in a similar manner. The function could receive a namespace to work with (a dictionary). Then you just call it with globals() == the namespace of the calling module. Yes, but access to module seems more verbose: module_dict['x']() xxx Instead of just: module.x() xxx You could write a wrapper class on the client side, but I guess it's easier to pass the module object directly, as you said earlier. Anyway, this class would fake attribute access for dictionary entries: py class Idx2Attr(object): ... def __init__(self, d): self.__dict__[None] = d ... def __getattr__(self, name): ... try: return self.__dict__[None][name] ... except KeyError: raise NameError, name ... def __setattr__(self, name, value): ... self.__dict__[None][name]=value ... py import htmllib py dir(htmllib) ['AS_IS', 'HTMLParseError', 'HTMLParser', '__all__', '__buil tins__', '__doc__', '__file__', '__name__', 'sgmllib', 'test '] py mod = Idx2Attr(htmllib.__dict__) # htmllib.__dict__ is what you get if you use globals() inside htmllib py mod.__file__ 'C:\\APPS\\PYTHON25\\lib\\htmllib.pyc' py mod.foo = 3 py htmllib.foo 3 ([None] is to avoid name collisions to some extent) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Garbage collection
Simon Pickles [EMAIL PROTECTED] writes: Ken wrote: What is your __del__ method doing? Actually, nothing but printing a message when the object is deleted, just morbid curiosity. I've yet to see one of the destructor messages, tho Do your objects participate in reference cycles? In that case they are deallocated by the cycle collector, and the cycle collector doesn't invoke __del__. class X(object): ... def __del__(self): print gone ... a = X() a = 1 gone b = X() b.someslot = b b = 1 import gc gc.collect() 0 -- http://mail.python.org/mailman/listinfo/python-list
Re: average of PIL images
On 19 feb, 06:28, vaneric [EMAIL PROTECTED] wrote: def rgbTopixelvalue((r,g,b)): alpha=255 return unpack(l, pack(, b, g, r, alpha))[0] That's much worse than averaging the R,G,B components. oops! the intention was to pack r,g,b components into a single value sothat calculations like finding covariant matrix of a set of images etc can be done..(i need to represent each image as an array of values(either long or float)..i can't work with an array of tuples of ints.. As said above, try to compute using another color space, try HSL. The colorsys module can transform from/to RGB. even if i convert from rgb to hsl i will have a tuple(h,s,l) for each pixel and again i will have to convert it into a single value which i can use in matrix multipln etc is there a workaround sothat rgb color images can be worked on? any advice most welcome.. a) Work with the 3 components in parallel (that is, use 3 separate matrices, one for each component, and regenerate the image at the end). b) Convert to grayscale (and lose the color information) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: Phatch = PHoto bATCH processor and renamer based on PIL
On Feb 19, 4:23 am, Daniel Fetchinson [EMAIL PROTECTED] wrote: On 2/18/08, SPE - Stani's Python Editor [EMAIL PROTECTED] wrote: I'm pleased to announce the release of Phatch which is a powerful batch processor and renamer. Phatch exposes a big part of the Python Imaging Library through an user friendly GUI. (It is using python-pyexiv2 to offer more extensive EXIF and IPTC support.) Phatch is not targeted at manipulating individual pictures (such as with Gimp), but repeating the same actions on hundreds or thousands of images. If you know PIL and have some nice recipes laying around, it is very easy to write plugins as Phatch generates the corresponding GUI automagically just like in Django. Any existings PIL scripts can be added very easily. Let me know if you want to contribute or have any questions. Homepage:http://photobatch.stani.be(free download link below) Tutorials:http://photobatch.wikidot.com/tutorials Translations:https://translations.launchpad.net/phatch/trunk/+pots/phatch License: GPLv3 Screenshot: http://photobatch.wikidot.com/local--files/start/Screenshot-Phatch3d.jpg (the perspective and reflection is produced by Phatch itself) This is pretty cool! I have one question about the equally cool website: what tool did you use for creating this image: http://photobatch.wikidot.com/local--files/start/Screenshot-Phatch3d.jpg This is Phatchs own dogfood. I guess you missed the tutorials link. There is a tutorial how you can achieve this effect: http://photobatch.wikidot.com/tutorial-round-3d-reflect I run Phatch on three screenshots I have to put them in perspective with rounded corners and perspective. I let Phatch save them as a png so transparency is preserved. Afterwards I opened Gimp and put the three together on the background of a radial gradient. Let me know if it works for you. Stani -- http://mail.python.org/mailman/listinfo/python-list
Re: Double underscores -- ugly?
Berwyn [EMAIL PROTECTED] wrote: Is it just me that thinks __init__ is rather ugly? Not to mention if __name__ == '__main__': ...? That ugliness has long been my biggest bugbear with python, too. The __name__ == '__main__' thing is something I always have to look up, every time I use it, too ... awkward. I'd settle for: hidden def init(self): # which could be extended to work for everything hidden x=3 ... And for __name__ == '__main__' how about: if sys.main(): ... Or even: @hidden def init(self): ... @main def mymainfunc(): ... The first of those probably wants some metaclass support to make it work cleanly, but here's a sample implementation for the second one: import sys, atexit def main(f): Decorator for main function def runner(): sys.exit(f()) if f.func_globals['__name__']=='__main__': atexit.register(runner) return f print define mymainfunc @main def mymainfunc(args=sys.argv): print Got args, args return 3 print end of script If you have multiple functions marked as main that will run them in reverse order, so it might be better to put them on a list and use a single runner to clear the list. Also, I have no idea what happens to the exit code if you use this decorator more than once. BTW, should anyone be wondering, you can still use atexit inside a function called from atexit and any registered functions are then called when the first one returns. -- http://mail.python.org/mailman/listinfo/python-list
Re: average of PIL images
On 19 feb, 06:55, 7stud [EMAIL PROTECTED] wrote: On Feb 19, 12:13 am, Gabriel Genellina [EMAIL PROTECTED] wrote: En Tue, 19 Feb 2008 04:01:04 -0200, vaneric [EMAIL PROTECTED] escribió: On Feb 19, 1:38 am, Robert Kern [EMAIL PROTECTED] wrote: Averaging color images is tricky; you really shouldn't do it in the RGB colorspace. thanx for the guidance and detailed replies..I tried to pack the r,g,b into a single value like below(something a member posted in the past) def rgbTopixelvalue((r,g,b)): alpha=255 return unpack(l, pack(, b, g, r, alpha))[0] That's much worse than averaging the R,G,B components. First, you have to omit the alfa value (or set it at the end). Then, consider this example: (0,0,0)=black and (0,1,0)=almost black, average = (0,0,128) How do you arrive at that average? (0,0,0) - 0, (0,1,0) - 256, (0+256)/2=128, 128 - (0,0,128) (ignoring alpha, or using alpha=0) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: pyinstall and matplotlib
Traceback (most recent call last): File multicolor.py, line 11, in ? File pylab.pyc, line 1, in ? File matplotlib\pylab.pyc, line 222, in ? File matplotlib\backends\__init__.pyc, line 24, in pylab_setup File matplotlib\backends\backend_tkagg.pyc, line 7, in ? ImportError: No module named Tkinter Any ideas? Thanks, BTW: I don't use Tkinter for GUI, I use PythonCard and wxPython. May be the Tkinter is invoked by the multicolor.py sample? I tried another application which I know for sure doesn't use Tkinter and yet it still tries to invoke Tkinter. So, I need to disable the backend_tkagg.pyc somehow. Any suggestions? Thanks, hi John, I've started a discussion on the MatPlotLib list, (and others, but now limited to matplotlib-list) you might want to follow the discussion over there. I just read that the real solution seems to be in setup.cfg, and AFAIK that file is missing in the distro. cheers, Stef -- http://mail.python.org/mailman/listinfo/python-list
Re: The big shots
[EMAIL PROTECTED] schrieb: I'm a little dissatisfied, and just thinking aloud. Some of the ideas that have been proposed on Python-ideas as well as Python, have received partial evaluation from the alphas. Lesser individuals than they could not have invented Python, and would be liable to ban me merely for this post. Notwithstanding. The reason they have cited is, It is not in prevalent use. The printing press, rail, automobiles, and Python, were not in prevalent use before their invention. I.e., they -can't- come if one doesn't build it. However, there were writing, transportation, and programming before these respectively; does it merely suffice to answer, Yes it is? The Python gurus' combined professional judgement results in Python. Looking through http://www.python.org/dev/peps/ , their own proposals don't meet their own criteria. Start there. It is neither necessary nor sufficient that an expansion is or would be used. I don't get it as well - in all other open-source-communities I've been participating, the anonymous wacko shelling out half-baked, incomprehensible ideas faster than a gatling gun *immediately* had the full attention of the big-wigs, and after a short time became project lead. No idea what's wrong with these people here - but I bet if you team up with Illias, you can start working on his language-to-rule-them-all in no time, shortening the delivery goal of 2011 immensly. Looking-forward-to-it-ly yours, Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Garbage collection
Ken napisał(a): The good news is that you almost never have to do anything to clean up. My guess is that you might not even need to overload __del__ at all. People from a C++ background often mistakenly think that they have to write destructors when in fact they do not. Is that true assumption that __del__ has the same purpose (and same limitations, i.e. the are not guaranteed to be fired) as Java finalizer methods? -- Jarek Zgoda Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101 We read Knuth so you don't have to. (Tim Peters) -- http://mail.python.org/mailman/listinfo/python-list
Re: flattening a dict
Duncan Booth wrote: In this particular case I think the lambda does contribute to the obfuscation. Yes, they are single expressions, but only because that have been contorted to become single expressions. The first two return generators, so if you don't force them into a lambda you can write them out as for loops with yield. The last one is an if..else statement. The key word is become, and in this particular case the discussion thread is witness to the fact that it doesn't apply as you say. The three single expressions came about from a (misshappen, OK, but I never pretended otherwise) attempt to divide into pieces what was already a single expression in Arnaud's code while keeping in the spirit. BTW, I have a particular issue with your statement : A lambda which is assigned directly to a variable is a bad code smell. My problem is that I can't discuss its pure content with which I simply disagree, because that would legitimize its abstracted form with which I have the strongest issues, although largely OT. Best, BB -- http://mail.python.org/mailman/listinfo/python-list
Rsync
Is there any thing in python that synchronize directories like rsync? -- Felipe Leal Coutinho -- http://mail.python.org/mailman/listinfo/python-list
CFP: DTVCS 2008 - Design, Testing and Formal Verification Techniques for Integrated Circuits and Systems
Apologies for any multiple copies received. We would appreciate it if you could distribute the following call for papers to any relevant mailing lists you know of. CALL FOR PAPERS Special Session: Design, Testing and Formal Verification Techniques for Integrated Circuits and Systems DTVCS 2008 August 18-20, 2008 (Kailua-Kona, Hawaii, USA) http://digilander.libero.it/systemcfl/dtvcs = Special Session in the IASTED International Conference on Circuits and Systems (CS 2008) - The IASTED International Conference on Circuits and Systems (CS 2008) will take place in Kailua-Kona, Hawaii, USA, August 18-20, 2008. URL: http://www.iasted.org/conferences/cfp-625.html. Aims and Scope --- The main target of the Special Session DTVCS is to bring together engineering researchers, computer scientists, practitioners and people from industry to exchange theories, ideas, techniques and experiences related to the areas of design, testing and formal verification techniques for integrated circuits and systems. Contributions on UML and formal paradigms based on process algebras, petri-nets, automaton theory and BDDs in the context of design, testing and formal verification techniques for integrated circuits and systems are also encouraged. Topics -- Topics of interest include, but are not limited to, the following: * digital, analog, mixed-signal and RF test * built-in self test * ATPG * theory and foundations: model checking, SAT-based methods, use of PSL, compositional methods and probabilistic methods * applications of formal methods: equivalence checking, CSP applications and transaction-level verification * verification through hybrid techniques * verification methods based on hardware description/system-level languages (e.g. VHDL, SystemVerilog and SystemC) * testing and verification applications: tools, industrial experience reports and case studies Industrial Collaborators and Sponsors This special session is partnered with: * CEOL: Centre for Efficiency-Oriented Languages Towards improved software timing, University College Cork, Ireland (http://www.ceol.ucc.ie) * International Software and Productivity Engineering Institute, USA ( http://www.intspei.com) * Intelligent Support Ltd., United Kingdom (http://www.isupport-ltd.co.uk) * Minteos, Italy (http://www.minteos.com) * M.O.S.T., Italy (http://www.most.it) * Electronic Center, Italy (http://www.el-center.com) * Legale Fiscale, Italy (http://www.legalefiscale.it) This special session is sponsored by: * LS Industrial Systems, South Korea (http://eng.lsis.biz) * Solari, Hong Kong (http://www.solari-hk.com/) Technical Program Committee * Prof. Vladimir Hahanov, Kharkov National University of Radio Electronics, Ukraine * Prof. Paolo Prinetto, Politecnico di Torino, Italy * Prof. Alberto Macii, Politecnico di Torino, Italy * Prof. Joongho Choi, University of Seoul, South Korea * Prof. Wei Li, Fudan University, China * Prof. Michel Schellekens, University College Cork, Ireland * Prof. Franco Fummi, University of Verona, Italy * Prof. Jun-Dong Cho, Sung Kyun Kwan University, South Korea * Prof. AHM Zahirul Alam, International Islamic University Malaysia, Malaysia * Prof. Gregory Provan, University College Cork, Ireland * Dr. Emanuel Popovici, University College Cork, Ireland * Dr. Jong-Kug Seon, System LSI Lab., LS Industrial Systems Co. Ltd., South Korea * Dr. Umberto Rossi, STMicroelectronics, Italy * Dr. Graziano Pravadelli, University of Verona, Italy * Dr. Vladimir Pavlov, International Software and Productivity Engineering Institute, USA * Dr. Jinfeng Huang, Philips LiteOn Digital Solutions Netherlands, Advanced Research Centre, The Netherlands * Dr. Thierry Vallee, Georgia Southern University, Statesboro, Georgia, USA * Dr. Menouer Boubekeur, University College Cork, Ireland * Dr. Ana Sokolova, University of Salzburg, Austria * Dr. Sergio Almerares, STMicroelectronics, Italy * Ajay Patel (Director), Intelligent Support Ltd, United Kingdom * Monica Donno (Director), Minteos, Italy * Alessandro Carlo (Manager), Research and Development Centre of FIAT, Italy * Yui Fai Lam (Manager), Microsystems Packaging Institute, Hong Kong University of Science and Technology, Hong Kong Important Dates --- April 1, 2008: Deadline for submission of completed papers May 15, 2008: Notification of acceptance/rejection to authors Please visit our web-site for further information on the hosting conference of DTVCS, submission guidelines,
Re: Garbage collection
Jarek Zgoda [EMAIL PROTECTED] wrote: Duncan Booth napisa³(a): Pretty much. If you have a __del__ method on an object then in the worst case the only thing that can be guaranteed is that it will be called zero, one or more than one times. (Admittedly the last of these only happens if you work at it). If it is called then is may be either immediately the last reference to the object is lost, or it may be later when the garbage collector runs (and not necessarily the first next time the garbage collector runs). Java finalizers are not called upon VM exit, only when object is swept by GC (for example when the object is destroyed upon program exit), the CPython docs read that this is the case for Python too. Is this behaviour standard for all VM implementations or is implementation-dependent (CPython, Jython, IronPython)? Yes, CPython does reference counting so it can call __del__ immediately an object is unreferenced. The GC only comes into play when there is a reference loop involved. If an object is directly involved in a reference loop then __del__ is not called for that object, but a loop could reference another object and its __del__ would be called when the loop was collected. Other Python implementations may behave differently: presumably Jython works as for Java (but I don't know the details of that), and IronPython uses the CLR which has its own peculiarities: finalizers are all called on a single thread which is *not* the thread used to construct the object, so if you use finalizers in a CLR program your program is necessarily multi-threaded with all that implies. Also it takes at least two GC cycles to actually release memory on a CLR object with a finalizer, on the first cycle objects subject to finalization are simply added to a list (so are again referenceable), on the second cycle if the finalizer has completed and the object is unreferenced it can be collected. CLR finalizers also have the interesting quirk that before the finalizer is called any references the object has to other objects are cleared: that allows the system to call finalizers in any order. Otherwise I think the behaviour on exit is pretty standard. If I remember correctly there is a final garbage collection to give finalizers a chance to run. Any objects which become newly unreferenced as a result of that garbage collection will have __del__ called as usual, but any which merely become unreachable and therefore would be caught in a subsequent garbage collection won't. -- http://mail.python.org/mailman/listinfo/python-list
Re: The big shots
Diez B. Roggisch a écrit : [EMAIL PROTECTED] schrieb: I'm a little dissatisfied, and just thinking aloud. (snip remaining of mostly inarticulate post, just couldn't make sens of it - as usual) No idea what's wrong with these people here - but I bet if you team up with Illias, you can start working on his language-to-rule-them-all in no time, shortening the delivery goal of 2011 immensly. Hum... Perhaps a bit harsh, but there's something here : castironpi's posts definitively have something in common with Illias' ones. Couldn't name exactly what, but still... op If you really hope to get any serious attention, stop whining and learn to express yourself clearly. This won't necessarily make anybody agree with your proposals, but at least chances are someone will read them. /op -- http://mail.python.org/mailman/listinfo/python-list
Re: Garbage collection
Hrvoje Niksic [EMAIL PROTECTED] wrote: Simon Pickles [EMAIL PROTECTED] writes: Ken wrote: What is your __del__ method doing? Actually, nothing but printing a message when the object is deleted, just morbid curiosity. I've yet to see one of the destructor messages, tho Do your objects participate in reference cycles? In that case they are deallocated by the cycle collector, and the cycle collector doesn't invoke __del__. class X(object): ... def __del__(self): print gone ... a = X() a = 1 gone b = X() b.someslot = b b = 1 import gc gc.collect() 0 If you want to avoid this particular problem, use a weakref. c = X() from weakref import proxy c.weak_reference = proxy(c) c.weak_reference.__del__ bound method X.__del__ of __main__.X object at 0xb7d1e56c c = 1 gc.collect() gone 0 Or perhaps slightly more realistically, here is an example of using a WeakKeyDictionary instead of __del__ methods for keeping an accurate track of all classes of a given type. from weakref import WeakKeyDictionary class Y(object): _registry = WeakKeyDictionary() def __init__(self): self._registry[self] = True @classmethod def list(cls): return cls._registry.keys() a = Y() b = Y() c = Y() Y.list() a = 1 c = 1 Y.list() Which produces the output [__main__.Y object at 0xb7d9fc8c, __main__.Y object at 0xb7d9fcac, __main__.Y object at 0xb7d9fc2c] [__main__.Y object at 0xb7d9fc8c] (It behaves slightly differently in the interactive interpreter for reasons I don't understand - so save it to a file and try it!) In fact I find most of the times I wanted __del__ can be fixed by using a weakref.WeakValueDictionary or weakref.WeakKeyDictionary for a much better result. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list
Call for volunteers to help maintain bugs.python.org's issue tracker
The Python Software Foundation's infrastructure committee is looking for volunteers to help maintain the Roundup issue tracker installed for http://bugs.python.org. Responsibilities revolve around maintaining the Roundup installation itself (tracker schema, modifying the installed copy of Roundup, etc.) and the occasional database work (changes to the database, etc.). You do not have to be an expert at Roundup to volunteer! You can learn on the job by doing offline development and submitting patches until you are of a proper level of experience to gain commit access to the code (which can be seen at XXX). If you still have a New Years resolution to help Python out this is a great way to fulfill the promise you made yourself for 2008! If you are interested in volunteering, please email tracker-discuss at python.org. Thanks to all who have helped with the tracker already and those that will in the future! -Brett Cannon Chairman, PSF infrastructure committee -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: Phatch = PHoto bATCH processor and renamer based on PIL
SPE - Stani's Python Editor wrote: I'm pleased to announce the release of Phatch which is a powerful batch processor and renamer. Phatch exposes a big part of the Python Imaging Library through an user friendly GUI. (It is using python-pyexiv2 to offer more extensive EXIF and IPTC support.) Phatch is not targeted at manipulating individual pictures (such as with Gimp), but repeating the same actions on hundreds or thousands of images. Perhaps you could put a link to the source on the Windows instalL page? I don't mind being a second-class citizen, but it's annoying to have to jump around like that. Looks like a nice piece of work. regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: usage of string.encode('utf-8','xmlcharrefreplace')?
On Mon, 18 Feb 2008 22:24:56 -0800 (PST), J Peyret wrote [...] You are right, I am confused about unicode. Guilty as charged. You should read http://www.amk.ca/python/howto/unicode to clear up some of your confusion. [...] Also doesn't help that I am not sure what encoding is used in the data file that I'm using. That is, incidentally, the direct cause of the error message below. [...] class 'psycopg2.ProgrammingError' invalid byte sequence for encoding UTF8: 0x92 HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by client_encoding. What this error message means is that you've given the database a byte string in an unknown encoding, but you're pretending (by default, i.e. by not telling the database otherwise) that the string is utf-8 encoded. The database is encountering a byte that should never appear in a valid utf-8 encoded byte string, so it's raising this error, because your string is meaningless as utf-8 encoded text. This is not surprising, since you don't know the encoding of the string. Well, now we know it's not utf-8. column is a varchar(2000) and the guilty characters are those used in my posting. I doubt that. The error message is complaining about a byte with the value 0x92. That byte appeared nowhere in the string you posted, so the error message must have been caused by a different string. Now for the solution of your problem: If you don't care what the encoding of your byte string is and you simply want to treat it as binary data, you should use client_encoding latin-1 or iso8859_1 (they're different names for the same thing). Since latin-1 simply maps the bytes 0 to 255 to unicode code points 0 to 255, you can store any byte string in the database, and get the same byte string back from the database. (The same is not true for utf-8 since not every random string of bytes is a valid utf-8 encoded string.) Hope this helps, -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Linux/Python Issues
[EMAIL PROTECTED] a écrit : [EMAIL PROTECTED] wrote: IOW: all this is assumed to be common *n*x knowledge. Both GNOME and KDE put Windows to shame. An old Windows guy, like me, can just start using either one without needing 'common *n*x knowledge.' Err... Ever tried to compile them from sources ?-) Too bad the *n*x community isn't more welcoming to outsiders. C'mon, Martin, be serious. Compiling softwares from sources requires at least some minimal 'insider' knowledge *whatever the platform*. You can't seriously hope each and every source distrib to provide newbie-oriented doc for what's obviously a power-user operation. Or do you imply that there should be Windows installations instructions explaining the concepts of window, mouse, etc ? FWIW, I haven't seen so far any source distrib of any software targeting the Windows platform that didn't assume some 'common Windows knowledge'. You label yourself as an old Windows guy. This means you have a good knowledge of this platform. How long did it take to gain this knowledge ? More than a couple weeks, I bet ? FWIW, a couple weeks is the time it took me - coming from Mac then Windows - to be able to compile Python (or almost any other software) from sources on linux - and most of this time was spent solving dependancies issues badly managed by the particular distro I was using by that time, which wasn't the more standard nor documented one. So, here's the basic scheme: - download the source tarball, preferably in /usr/local/src - unpack it - cd into the unpacked source directory - *carefully* read the README, INSTALL and other relevant docs - run ./configure with the relevant options - run make - run make install Wasn't too hard, was it ?-) And before you say it: yes indeed, it assumes you know how to use the command line, navigate your filesystem, copy/move things around, unpack an archive, read a text file etc... IOW, some more 'common *n*x knowledge' that you just can't hope to avoid learning if you want to properly use a *n*x system. Sorry. -- http://mail.python.org/mailman/listinfo/python-list
Re: Seemingly odd 'is' comparison.
Arnaud Delobelle wrote: On Feb 13, 10:19 pm, Tobiah [EMAIL PROTECTED] wrote: print float(3.0) is float(3.0) True print float(3.0 * 1.0) is float(3.0) False [You don't need to wrap your floats in float()] def f(): ... return 3.0 is 3.0, 3.0*1.0 is 3.0 ... f() (True, False) import dis dis.dis(f) 2 0 LOAD_CONST 1 (3.0) 3 LOAD_CONST 1 (3.0) 6 COMPARE_OP 8 (is) 9 LOAD_CONST 3 (3.0) 12 LOAD_CONST 1 (3.0) 15 COMPARE_OP 8 (is) 18 BUILD_TUPLE 2 21 RETURN_VALUE As you can see when 3.0 is 3.0 is evaluated the same float object is put on the stack twice so the 'is' comparison is True (LOAD_CONST 1 / LOAD_CONST 1 / COMPARE_OP 8). Whereas when 3.0*1.0 is 3.0 is evaluated, *two* different float objects are put on the stack and compared (LOAD_CONST 3 / LOAD_CONST 1 / COMPARE_OP 8). Therefore the result is False. Looks good, but doesn't pass the sanity check ;) Consider def f(): return 3 is 3, 3*1 is 3 import dis dis.dis(f) 2 0 LOAD_CONST 1 (3) 3 LOAD_CONST 1 (3) 6 COMPARE_OP 8 (is) 9 LOAD_CONST 3 (3) 12 LOAD_CONST 1 (3) 15 COMPARE_OP 8 (is) 18 BUILD_TUPLE 2 21 RETURN_VALUE f() (True, True) Cheers, BB -- http://mail.python.org/mailman/listinfo/python-list
Is there a sort-of clear function in Pythonwin now?
Looks like there are some years old questions talking about how to clear the Pythonwin environment. But still no answer. Do we have to close Pythonwin again and again to update our modules? Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: Garbage collection
Nick Craig-Wood [EMAIL PROTECTED] wrote: [__main__.Y object at 0xb7d9fc8c, __main__.Y object at 0xb7d9fcac, __main__.Y object at 0xb7d9fc2c] [__main__.Y object at 0xb7d9fc8c] (It behaves slightly differently in the interactive interpreter for reasons I don't understand - so save it to a file and try it!) Any expression in the interactive interpreter is implicitly assigned to the variable '_', so after your first call to Y.list() you've saved references to the complete list in _. Assignments aren't expressions so after assigning to a and c you haven't changed _. If you throw in another unrelated expression you'll be fine: a = Y() b = Y() c = Y() Y.list() [__main__.Y object at 0x0117F230, __main__.Y object at 0x0117F2B0, __main__.Y object at 0x0117F210, __main__.Y object at 0x0117F670, __main__.Y object at 0x0117F690, __main__.Y object at 0x0117F6B0, __main__.Y object at 0x0117F310] a = 1 c = 1 c 1 Y.list() [__main__.Y object at 0x0117F6B0] In fact I find most of the times I wanted __del__ can be fixed by using a weakref.WeakValueDictionary or weakref.WeakKeyDictionary for a much better result. The WeakValueDictionary is especially good when you want a Python wrapper round some external non-python thing, just use the address of the external thing as the key for the dictionary and you can avoid having duplicate Python objects. The other option for classes involved in a cycle is to move the __del__ (and anything it needs) down to another class which isn't part of the cycle, so the original example becomes: class Monitor(object): def __del__(self): print gone class X(object): def __init__(self): self._mon = Monitor() a = X() a = 1 gone b = X() b.someslot = b b = 1 import gc gc.collect() gone 8 -- http://mail.python.org/mailman/listinfo/python-list
Re: Call for volunteers to help maintain bugs.python.org's issue tracker
Brett Cannon [EMAIL PROTECTED] writes: The Python Software Foundation's infrastructure committee is looking for volunteers to help maintain the Roundup issue tracker installed for http://bugs.python.org. Responsibilities revolve around maintaining the Roundup installation itself (tracker schema, modifying the installed copy of Roundup, etc.) and the occasional database work (changes to the database, etc.). Didn't Python.org choose the proprietary Roundup system over a free bug tracker precisely to avoid having to do that kind of maintainance? -- http://mail.python.org/mailman/listinfo/python-list
Thankyou for rounding help
you guys all said pretty much the same thing, use a .0 and the end or float() and they all worked. Thankyou so much Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python seems to be ignoring my except clause...
Adam W. [EMAIL PROTECTED] wrote: I am trying to handle a Unicode error but its acting like the except clause is not even there. Here is the offending code: def characters(self, string): if self.initem: try: self.data.append(string.encode()) except: self.data.append('No habla la Unicode') And the exception: File C:\Users\Adam\Desktop\XMLWorkspace.py, line 65, in characters try: UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in position 83: ordinal not in range(128) Its got to be something really dumb I'm missing, this make no sence. The example you posted isn't complete and while I can easily expand it to a working example it will unfortunately be a working example. Try cutting it down yourself to a minimal self-contained example that you can post. 99% of the time you'll find the problem when you do that and avoid having to post at all. In this case, judging by the stack backtrace quoting the wrong line, I'd guess you only just added the try..except and for some reason are still executing the old code without the exception handling. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python seems to be ignoring my except clause...
Hi Adam, def characters(self, string): Please note that string is also a name of a very commonly used module so it is not advised to use as a local variable name. Istvan -- http://mail.python.org/mailman/listinfo/python-list
Re: File.write() not working in a sleepy loop
Gavin Lusby wrote: write outfile o=open(os.getcwd()+g.dsep+file, 'w') if g.verbose: print '...writing to '+os.getcwd()+g.dsep+file o.write('%over = (njobs = '+str(answer)+');\n') o.close ### sleep now # sleep(refresh) Try o.close() ;) Christian -- http://mail.python.org/mailman/listinfo/python-list
Re: Call for volunteers to help maintain bugs.python.org's issue tracker
Duncan Booth [EMAIL PROTECTED] writes: Ok, I'll bite. In what way is Roundup proprietary? Whoops! I was thinking of JIRA, the proprietary system (if I got it right THAT time), that was rejected in favor of Roundup. Sorry!!! http://mail.python.org/pipermail/python-dev/2006-October/069139.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Double underscores -- ugly?
On Feb 18, 3:28 pm, benhoyt [EMAIL PROTECTED] wrote: Hi guys, I've been using Python for some time now, and am very impressed with its lack of red tape and its clean syntax -- both probably due to the BDFL's ability to know when to say no. Most of the things that got me initially have been addressed in recent versions of Python, or are being addressed in Python 3000. But it looks like the double underscores are staying as is. This is probably a good thing unless there are better alternatives, but ... Is it just me that thinks __init__ is rather ugly? Not to mention if __name__ == '__main__': ...? I realise that double underscores make the language conceptually cleaner in many ways (because fancy syntax and operator overloading are just handled by methods), but they don't *look* nice. A solution could be as simple as syntactic sugar that converted to double underscores behind the scenes. A couple of ideas that come to my mind (though these have their problems too): def ~init(self): # shows it's special, but too like a C++ destructor def +init(self): # a bit too additive :-) defop add(self, other): # or this, equivalent to def __add__ def operator add(self, other): # new keyword, and a bit wordy Has anyone thought about alternatives? Is there a previous discussion on this I can look up? Cheers, Ben. Hmm. I must be the only person who doesn't think the double underscores are ugly. To me, they seem to provide plenty of attention to the special methods, but still appear clean due to their almost white-space-like nature. Given the use of underscores to indicate italics in plain-text, the special methods seem (to me) to have extra emphasis. I don't print my code often, so that's a caveat, and I came from a C/C+ + background. I agree with Ben, that your suggestions don't particularly stand out. They might stand out if the editor you used supported syntax highlighting. Personally, I find the examples with the plus and tilde (+, ~) to be more noisy and ugly than the underscores. Think of the underscores as a serene white-space day, with a simple black road that takes you to the special name. Or, you can wonder what I'm smoking when I code *grin* --Jason -- http://mail.python.org/mailman/listinfo/python-list
Re: Call for volunteers to help maintain bugs.python.org's issue tracker
Paul Rubin http://[EMAIL PROTECTED] wrote: Brett Cannon [EMAIL PROTECTED] writes: The Python Software Foundation's infrastructure committee is looking for volunteers to help maintain the Roundup issue tracker installed for http://bugs.python.org. Responsibilities revolve around maintaining the Roundup installation itself (tracker schema, modifying the installed copy of Roundup, etc.) and the occasional database work (changes to the database, etc.). Didn't Python.org choose the proprietary Roundup system over a free bug tracker precisely to avoid having to do that kind of maintainance? Ok, I'll bite. In what way is Roundup proprietary? So far as I can tell it has a very unrestrictive license: maintain the copyright notice and otherwise do what you want, except for the parts derived from Zope which use the ZPL v2.0. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python seems to be ignoring my except clause...
On Feb 19, 8:49 am, Duncan Booth [EMAIL PROTECTED] wrote: The example you posted isn't complete and while I can easily expand it to a working example it will unfortunately be a working example. Try cutting it down yourself to a minimal self-contained example that you can post. 99% of the time you'll find the problem when you do that and avoid having to post at all. In this case, judging by the stack backtrace quoting the wrong line, I'd guess you only just added the try..except and for some reason are still executing the old code without the exception handling.- Hide quoted text - - Show quoted text - You hit the nail on the head with the old code, I found it funny myself it was quoting the try statement and not the code within. So I deleted my .pyc files and reran, same thing, but then I closed all open windows and reran it, and it recompiled the pyc and the code worked. But now there is a new problem. I added a print statement to the except clause to make sure it was executing, and something funny happen, it printed 3 times and then spat this out: File C:\Users\Adam\Desktop\XMLWorkspace.py, line 72, in parsexml parse(url, FeedHandlerInst) File C:\Python25\lib\xml\sax\__init__.py, line 33, in parse parser.parse(source) File C:\Python25\lib\xml\sax\expatreader.py, line 107, in parse xmlreader.IncrementalParser.parse(self, source) File C:\Python25\lib\xml\sax\xmlreader.py, line 123, in parse self.feed(buffer) File C:\Python25\lib\xml\sax\expatreader.py, line 211, in feed self._err_handler.fatalError(exc) File C:\Python25\lib\xml\sax\handler.py, line 38, in fatalError raise exception SAXParseException: http://revision3.com/systm/feed/wmv-large/:78:83: undefined entity Huh? Why did it not raise this BEFORE it attempted to append the string, why did my print statment print 3 times before this error? I think I got past the hump I was hitting, and found a new one, 3 items later, I will investigate. But now I know I have to keep deleting my pyc files or else I will run into trouble. -- http://mail.python.org/mailman/listinfo/python-list
Re: Double underscores -- ugly?
Ben Finney wrote: I realise that double underscores make the language conceptually cleaner in many ways (because fancy syntax and operator overloading are just handled by methods), but they don't *look* nice. That's a good thing, in that it draws attention to the names. Well, double underscore is awful when you have to read code with the wrong typeface, possibly printed. -- http://mail.python.org/mailman/listinfo/python-list
File.write() not working in a sleepy loop
Hello, I am getting odd behaviour when I am trying to write a file in a while loop with a sleep function call. I am trying to periodically change the number of jobs on a cluster depending on the current usage and a dummy version that does not require access to the cluster usage is attached at the end. The crux of the matter is in the main loop. When I run it, it writes a blank file on the first iteration, then sleeps and on the 2nd iteration, it finally puts in the correct value. I simply can't understand why it postpones the open, write, close section of the 1st loop until the sleep is finished. The sleep() is clearly after the write(). Thanks in advance, Gavin ___sample_code___sample_code___sample_code___sample_code___sample_code___sample_code___sample_code while i == 1: if pid -1: i = pid_exists(pid) if g.verbose: os.system('clear') ## get data ### freeload, halfload, fullload = 20,20,40#getnodedata()--- dummy data weekend, phase = gettimedata() userload = 2#getuserdata()-- dummy data if g.verbose: print '...total nodes =',2 * (freeload + halfload + fullload) if g.verbose: print '...used nodes =',halfload + 2 * fullload if g.verbose: print '...free nodes =',2 * freeload + halfload if g.verbose: print '...user nodes =',userload # usage logic # if weekend or phase == 3: answer = maxnode if g.verbose: print '...maxing out the machine with '+str(answer) else: answer = max(minnode,2*freeload+halfload-slack) if g.verbose: print '...limiting runs to '+str(answer)+' nodes' write outfile o=open(os.getcwd()+g.dsep+file, 'w') if g.verbose: print '...writing to '+os.getcwd()+g.dsep+file o.write('%over = (njobs = '+str(answer)+');\n') o.close ### sleep now # sleep(refresh) #! /data/gen27/utg/lusbg1/bin/Python-2.5.1/python import sys, os, getopt, datetime from time import sleep from subprocess import Popen, PIPE from getpass import getuser class g: ''' global variables class ''' if os.name in ('nt','dos','ce'): dsep = '\\' else: dsep = '/' verbose = False def main(): ''' main iterative subroutine ''' if g.verbose: os.system('clear'); print '\n...loadmax.py' ### get opts ## try: opts, args = getopt.getopt(sys.argv[1:], o:p:r:l:u:s:thv, [help,verbose]) except getopt.GetoptError: usage() sys.exit() file = 'mybad' slack = 20 minnode = 40 maxnode = 100 refresh = 10*60 tracker = 'tracker.dat' answer = 0 pid = -1 for opt, arg in opts: if opt == -v: # verbosity switch g.verbose = True if opt == -o: # output filename switch file = arg if opt == -t: # tracker filename switch tracker = True if opt == -r: # refresh rate converted min-sec refresh = float(arg)*60.0 if opt == -u: # maximum permissable nodes maxnode = int(arg) if opt == -l: # minimum permissable nodes minnode = int(arg) if opt == -p: # follow specified pid pid = int(arg) if opt == -s: # no of slack nodes slack = int(arg) if opt in (-h, --help): # help! usage() sys.exit() if file == 'mybad': print '...error: output file not specified' usage() sys.exit() i = 1 while i == 1: if pid -1: i = pid_exists(pid) if g.verbose: os.system('clear') ## get data ### freeload, halfload, fullload = 20,20,40#getnodedata() weekend, phase = gettimedata() userload = 2#getuserdata() if g.verbose: print '...total nodes =',2 * (freeload + halfload + fullload) if g.verbose: print '...used nodes =',halfload + 2 * fullload if g.verbose: print '...free nodes =',2 * freeload + halfload if g.verbose: print '...user nodes =',userload # usage logic # if weekend or phase == 3: answer = maxnode if g.verbose: print '...maxing out the machine with '+str(answer) else: answer = max(minnode,2*freeload+halfload-slack) if g.verbose: print '...limiting runs to
[EMAIL PROTECTED]
test -- http://mail.python.org/mailman/listinfo/python-list
psycopg2: connect copy_from and copy_to
Hi, I want to copy data from a production database to a testing database. Up to now I used psycopg2 and copy_from and copy_to with two cursors and a temporary file. This works, but it would be better, if the data gets piped from one cursor to the next without a temporary file. The psycopg2 methods look like this: copy_to(fd, table) # read data copy_from(fd, table) # write data Using select (wait until fd has data) does not work, since I pass in the fd. If copy_to would return the file descriptor, I could use it to pass the data to copy_from. I found no way to connect them. Maybe it could be done with threading, but I try to avoid threads. Since the script will run only on Unix, I could use pipes. But this would fail, too, since copy_to() would block before I can call copy_from (since buffer is full and no one is reading the data from the pipe). Any suggestions? Thomas -- http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED]
test -- http://mail.python.org/mailman/listinfo/python-list
Re: Seemingly odd 'is' comparison.
Boris Borcic [EMAIL PROTECTED] wrote: Arnaud Delobelle wrote: Whereas when 3.0*1.0 is 3.0 is evaluated, *two* different float objects are put on the stack and compared (LOAD_CONST 3 / LOAD_CONST 1 / COMPARE_OP 8). Therefore the result is False. Looks good, but doesn't pass the sanity check ;) Consider def f(): return 3 is 3, 3*1 is 3 import dis dis.dis(f) 2 0 LOAD_CONST 1 (3) 3 LOAD_CONST 1 (3) 6 COMPARE_OP 8 (is) 9 LOAD_CONST 3 (3) 12 LOAD_CONST 1 (3) 15 COMPARE_OP 8 (is) 18 BUILD_TUPLE 2 21 RETURN_VALUE f() (True, True) s/different/possibly different depending on implementation details/ Arnaud's point remains valid: in the first comparison you can see that the same object is used, in the second case all bets are off. -- http://mail.python.org/mailman/listinfo/python-list
Re: Seemingly odd 'is' comparison.
Duncan Booth wrote: Boris Borcic [EMAIL PROTECTED] wrote: Arnaud Delobelle wrote: Whereas when 3.0*1.0 is 3.0 is evaluated, *two* different float objects are put on the stack and compared (LOAD_CONST 3 / LOAD_CONST 1 / COMPARE_OP 8). Therefore the result is False. Looks good, but doesn't pass the sanity check ;) Consider def f(): return 3 is 3, 3*1 is 3 import dis dis.dis(f) 2 0 LOAD_CONST 1 (3) 3 LOAD_CONST 1 (3) 6 COMPARE_OP 8 (is) 9 LOAD_CONST 3 (3) 12 LOAD_CONST 1 (3) 15 COMPARE_OP 8 (is) 18 BUILD_TUPLE 2 21 RETURN_VALUE f() (True, True) s/different/possibly different depending on implementation details/ 0 substitutions made, but whatever s/on implementation details/on further implementations details/ Arnaud's point remains valid: in the first comparison you can see that the same object is used, in the second case all bets are off. Sure, but the issue was to explain the strangeness that (3.0 is 3.0)!=(3.0*1.0 is 3.0) and I just pointed out - without drawing any conclusion - that a structurally identical explanation would explain the contrafactual (3 is 3)!=(3*1 is 3). Best, BB -- http://mail.python.org/mailman/listinfo/python-list
Re: SOAP strategies
On Sat, 2008-02-16 at 10:59 -0600, Paul Watson wrote: What are the reasonable current day choices and best bets for the future when doing SOAP programming in Python? SOAP batteries do not appear to be in the standard Python distribution. Most of the SOAP related information I have been able to find on the web is from 2001-2002. I am not sure if some packages are still maintained. Most of this is old news. http://soapy.sourceforge.net/ http://pywebsvcs.sourceforge.net/ (SOAPpy) and what is the relation of this to ZSI http://www.intertwingly.net/stories/2002/12/20/sbe.html http://www.ibm.com/developerworks/library/ws-pyth5/ http://www.opensourcetutorials.com/tutorials/Server-Side-Coding/Python/python-soap-libraries/page1.html http://www.gossamer-threads.com/lists/python/python/619251 This is current, but is this a long term strategy or a short term tactic? Have I offended? My apologies if I have. I thought I showed that I had done some homework and used Google and did the other things to show that I was willing to put forth some effort. Please tell me if I have missed something. If I should look somewhere besides Python for doing SOAP, then please say that also. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Seemingly odd 'is' comparison.
Christian Heimes [EMAIL PROTECTED] writes: id(2000) 3084440752 id(2001) 3084440752 Python 2.4.4 (#1, Oct 23 2006, 13:58:00) id(2000) 155211416 id(2001) 155211416 id(2000) == id(2001) False From the docs: id( object) Return the ``identity'' of an object. This is an integer (or long integer) which is guaranteed to be unique and constant for this object during its lifetime. Two objects with non-overlapping lifetimes may have the same id() value. (Implementation note: this is the address of the object.) What has happened is id(2000) allocates a memory cell and puts 2000 in it, prints out the id, then deallocates the cell. id(2001) then re-uses the same cell. With the equality comparison, both cells are alive at the same time, so the uniqueness requirement guarantees that their id's are unequal. A Python implementation with a compacting garbage collector might choose not to store a unique id in any object, unless you actually call the id function and remember the value. So, calling id(x) could end up costing some cpu time and memory by permanently attaching an id number to x. -- http://mail.python.org/mailman/listinfo/python-list
Re: psycopg2: connect copy_from and copy_to
On Feb 19, 6:23 pm, Thomas Guettler [EMAIL PROTECTED] wrote: Doesn't PostGres come with Export/Import apps ? That would be easiest (and faster). Yes, you can use pg_dump production ... | psql testdb, but this can lead to dead locks, if you call this during a python script which is in the middle of a transaction. The python script locks a table, so that psql can't write to it. I don't think calling pg_dump and psql/pg_restore is faster. prod_cursor.execute('select data from production') for each_record in cursor.fetchall(): dev_cursor.execute('insert into testing') I know, but COPY is much faster. Thomas I'm used to Oracle which doesn't exhibit this problem... ;) -- http://mail.python.org/mailman/listinfo/python-list
Re: Double underscores -- ugly?
On Feb 19, 4:01 am, Duncan Booth [EMAIL PROTECTED] wrote: Berwyn [EMAIL PROTECTED] wrote: Is it just me that thinks __init__ is rather ugly? Not to mention if __name__ == '__main__': ...? That ugliness has long been my biggest bugbear with python, too. The __name__ == '__main__' thing is something I always have to look up, every time I use it, too ... awkward. I'd settle for: hidden def init(self): # which could be extended to work for everything hidden x=3 ... And for __name__ == '__main__' how about: if sys.main(): ... Or even: @hidden def init(self): ... @main def mymainfunc(): ... I'd much rather type a few underscores than have to constantly use decorators. I don't see what's so ugly about __init__. To me it just looks like it's underscored, though maybe that comes from having worked with a lot of wikis. But I really don't find it an encumbrance, and the fact that it requires no special handling from the parser is just part of the beautiful simplicity of Python. Hyuga -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: Phatch = PHoto bATCH processor and renamer based on PIL
Steve Holden [EMAIL PROTECTED] said : Perhaps you could put a link to the source on the Windows instalL page? I don't mind being a second-class citizen, but it's annoying to have to jump around like that. I'm interested too, and was also wondering if Phatch is as full-featured unders Windows as under Linux, specifically the EXIF/IPTC functions made available through pyexiv2 : exiv2 itself seems to discriminate between the two, the Windows package only has the executable, not the library. -- YAFAP : http://www.multimania.com/fredp/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Double underscores -- ugly?
Jason wrote: Hmm. I must be the only person who doesn't think the double underscores are ugly. Nope. I like them too. :) Frankly, I think it's just a matter of adaption. I too found it rather ugly in the beginning, but with anything, I've gotten used to it. (And I wholeheartedly support your looks like underlined / is unintrusive like whitespace argument.) /W -- http://mail.python.org/mailman/listinfo/python-list
Re: Seemingly odd 'is' comparison.
Steven D'Aprano wrote: is is a comparison operator: it compares identity, not equality. It is more or less equivalent to the expression id(x) == id(y). Yes, the implementation of the is operator comes down to the comparison of PyObject* pointer addresses and in CPython id() returns the address of the PyObject*. But it's very important to understand that a is b can have a different result than id(a) == id(b). CPython uses all sorts of tricks to speed up common operations. Memory allocation/de-allocation and object creation can have a huge speed impact. Therefor Python uses free lists to keep some empty objects around for recycling. Small integers are cached, too. Compare id(0) 135689168 id(1) 135689184 id(2) 135689200 with id(2000) 3084440752 id(2001) 3084440752 id(2002) 3084440752 to see the effect of small int cache vs. int free list. Christian -- http://mail.python.org/mailman/listinfo/python-list
Re: psycopg2: connect copy_from and copy_to
On Feb 19, 5:06 pm, Thomas Guettler [EMAIL PROTECTED] wrote: Hi, I want to copy data from a production database to a testing database. Up to now I used psycopg2 and copy_from and copy_to with two cursors and a temporary file. This works, but it would be better, if the data gets piped from one cursor to the next without a temporary file. The psycopg2 methods look like this: copy_to(fd, table) # read data copy_from(fd, table) # write data Using select (wait until fd has data) does not work, since I pass in the fd. If copy_to would return the file descriptor, I could use it to pass the data to copy_from. I found no way to connect them. Maybe it could be done with threading, but I try to avoid threads. Since the script will run only on Unix, I could use pipes. But this would fail, too, since copy_to() would block before I can call copy_from (since buffer is full and no one is reading the data from the pipe). Any suggestions? Thomas Doesn't PostGres come with Export/Import apps ? That would be easiest (and faster). Else, prod_cursor.execute('select data from production') for each_record in cursor.fetchall(): dev_cursor.execute('insert into testing') that is one way of doing it -- http://mail.python.org/mailman/listinfo/python-list
Python seems to be ignoring my except clause...
I am trying to handle a Unicode error but its acting like the except clause is not even there. Here is the offending code: def characters(self, string): if self.initem: try: self.data.append(string.encode()) except: self.data.append('No habla la Unicode') And the exception: File C:\Users\Adam\Desktop\XMLWorkspace.py, line 65, in characters try: UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in position 83: ordinal not in range(128) Its got to be something really dumb I'm missing, this make no sence. -- http://mail.python.org/mailman/listinfo/python-list
Re: psycopg2: connect copy_from and copy_to
Doesn't PostGres come with Export/Import apps ? That would be easiest (and faster). Yes, you can use pg_dump production ... | psql testdb, but this can lead to dead locks, if you call this during a python script which is in the middle of a transaction. The python script locks a table, so that psql can't write to it. I don't think calling pg_dump and psql/pg_restore is faster. prod_cursor.execute('select data from production') for each_record in cursor.fetchall(): dev_cursor.execute('insert into testing') I know, but COPY is much faster. Thomas -- http://mail.python.org/mailman/listinfo/python-list
Re: Seemingly odd 'is' comparison.
Asun Friere wrote: So was that a yes or no? I mean is it even possible for the identity behaviour of mutables to vary between implementations? I can't see how they can possibly be interned, but is there some other factor I'm missing in regard to identity behaviour which could in fact vary between implementations? In CPython some strings are interned (see the intern builtin). The free list of lists, tuples, dict and the block allocation of ints and floats can have an interning like effect, too. IronPython and Jython may not have interning or free list at all. Even in CPython the interning and free lists are an implementation detail that may chance between releases. In a matter of fact I'm messing around with free lists to speed up Python 2.6/3.0 and to give back memory earlier. Christian -- http://mail.python.org/mailman/listinfo/python-list
Re: Linux/Python Issues
[EMAIL PROTECTED] wrote: CNR, which is now free, is absolutely marvelous when it's got what you need. If Python2.5 were in the warehouse, I'd have clicked, gone to make a cup of coffee and the appropriate icon would be on my desktop when I came back. If I were Python.org I'd not consider anything ready for release until it was in the warehouse. Er, so how is it supposed to get into the warehouse if it's not first released from python.org ? -- \S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/ Frankly I have no feelings towards penguins one way or the other -- Arthur C. Clarke her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump -- http://mail.python.org/mailman/listinfo/python-list
Re: Linux/Python Issues
[EMAIL PROTECTED] wrote: CNR, which is now free, is absolutely marvelous when it's got what you need. If Python2.5 were in the warehouse, I'd have clicked, gone to make a cup of coffee and the appropriate icon would be on my desktop when I came back. Why don't you switch to a distribution which offers Python 2.5 binaries? All major ones do (from Debian and Ubuntu I know it for sure). And there's no time for coffee unless you've got a /really/ slow computer. If I were Python.org I'd not consider anything ready for release until it was in the warehouse. Sorry, the python.org warehouse only offers construction sets. If you order it, you'll have to build it yourself the same way you would build all other kits. This requires a bit of knowledge and experience. So why not use a distribution that doesn't force the users to build recent software but do it themselves for their users? Regards, Björn -- BOFH excuse #326: We need a licensed electrician to replace the light bulbs in the computer room. -- http://mail.python.org/mailman/listinfo/python-list
Re: Encrypting a short string?
Hi Erik, I really don't recommend the ROT13 cipher, as this is extremely easy to crack. Most grade school kids could break this one in seconds. ;-) If the project that you are working upon has low security needs, (in other words, it's not a financial institution), than you might try something quite basic such as a Vigenere, transposition, or even a playfair. These encryption methodologies are not secure and can be cracked by hackers. Yet, for the average Joe, it will keep them away from the information / data stored inside. One thing that seems to work well is to use to ciphers together. For example, encrypt the data using the playfair cipher -- and then run a transposition cipher. This will erase most of the data signatures that are needed for most hackers to crack the code. At this point, brute force is what most people have to resort upon -- and it's mostly governments that have this ability. ;-) Best wishes! Dusty --- Bjoern Schliessmann wrote: Lie wrote: There is a simple encryption, called ROT13 (Rotate 13). This is very unsecure for any cryptographical purpose, For enhanced security use TROT13 (triple ROT13). but enough to make uninformed user to think it's just a random piece of letters. Security by obscurity doesn't work. If it needs to be protected, protect it well. If it doesn't need to, you don't need to obscure it at all. Regards, Björn -- http://mail.python.org/mailman/listinfo/python-list
Re: Linux/Python Issues
[EMAIL PROTECTED] wrote: Both GNOME and KDE put Windows to shame. An old Windows guy, like me, can just start using either one without needing 'common *n*x knowledge.' Sure, go and compile them from the sources. The X server too, please (I got half insane from that once). Too bad the *n*x community isn't more welcoming to outsiders. I think the automobile community could be more welcoming to outsiders either. I just can refill fuel and perhaps change motor oil, but assembling a car from its components is too hard for me. Evil automobilers, why do they make it so complicated! 8) Regards, Björn -- BOFH excuse #362: Plasma conduit breach -- http://mail.python.org/mailman/listinfo/python-list
Re: psycopg2: connect copy_from and copy_to
Doesn't PostGres come with Export/Import apps ? That would be easiest (and faster). Yes, PostgreSQL core has import/export apps, but they tend to target general administration rather than transactional loading/moving of data. ie, dump and restore a database or schema. There is a pgfoundry project called pgloader that appears to be targeting a more general scenario of, well, loading data, but I imagine most people end up writing custom ETL for data flow. Else, prod_cursor.execute('select data from production') for each_record in cursor.fetchall(): dev_cursor.execute('insert into testing') that is one way of doing it In any high volume cases you don't want to do that. The current best practice for loading data into an existing PostgreSQL database is create temp, load into temp using COPY, merge from temp into destination(the last part is actually the tricky one ;). -- http://mail.python.org/mailman/listinfo/python-list
Re: psycopg2: connect copy_from and copy_to
On Feb 19, 9:23 am, Thomas Guettler [EMAIL PROTECTED] wrote: Yes, you can use pg_dump production ... | psql testdb, but this can lead to dead locks, if you call this during a python script which is in the middle of a transaction. The python script locks a table, so that psql can't write to it. Hrm? Dead locks where? Have you considered a cooperative user lock? Are just copying data? ie, no DDL or indexes? What is the script doing? Updating a table with unique indexes? I don't think calling pg_dump and psql/pg_restore is faster. Normally it will be. I've heard people citing cases of COPY at about a million records per second into nicely configured systems. However, if psycopg2's COPY is in C, I'd imagine it could achieve similar speeds. psql and psycopg2 both being libpq based are bound to have similar capabilities assuming the avoidance of interpreted Python code in feeding the data to libpq. I know, but COPY is much faster. yessir. -- http://mail.python.org/mailman/listinfo/python-list
Re: psycopg2: connect copy_from and copy_to
On Feb 19, 8:06 am, Thomas Guettler [EMAIL PROTECTED] wrote: Any suggestions? If you don't mind trying out some beta quality software, you can try my pg_proboscis driver. It has a DBAPI2 interface, but for you to use COPY, you'll need to use the GreenTrunk interface: import postgresql.interface.proboscis.dbapi2 as db # yeah, it doesn't use libpq, so you'll need to spell everything out. And, no dsn either, just keywords. src = db.connect(user = 'pgsql', host = 'localhost', port = 5432, database = 'src') dst = db.connect(suer = 'pgsql', host = 'localhost', port = 5432, database = 'dst') fromq = src.greentrunk.Query(COPY tabl TO STDOUT) toq = dst.greentrunk.Query(COPY tabl FROM STDIN) toq(fromq()) It's mostly pure-python, so if you don't have any indexes on the target table, you'll probably only get about 100,000 - 150,000 records per second(of course, it depends on how beefy your CPU is). With indexes on a large destination table, I don't imagine the pure Python COPY being the bottleneck. $ easy_install pg_proboscis Notably, it currently(version 0.9) uses the qmark paramstyle, but I plan to make 1.0 much more psyco. =) [python.projects.postgresql.org, some of the docs are outdated atm due to a recent fury of development =] -- http://mail.python.org/mailman/listinfo/python-list
python-ldap for plone 3 (python 2.4.4)
Hi friend!! I need download python-ldap for my plone 3.0.5 that use python 2.4.4. Do you know where I can find it? bye -- http://mail.python.org/mailman/listinfo/python-list
Re: Py_Finalize ERROR!
On Feb 19, 12:11 am, zaley [EMAIL PROTECTED] wrote: Py_Finalize ERROR! In my C++ program ,python is embeded . I create one win thread to run embedded Python code . So at the begin of thread function I call Py_Initialize and at the end of thread function call Py_Finalize . But after I began thread several times,the program crashed in function Py_Finalize. I can see the error occured at function PyObject_ClearWeakRefs when Py_Finalize called type_dealloc; Note: the python25.dll(lib) is builded by VC6(SP6) I think I ran into this error with my pgsql PL project--at some point. I think I fixed it by *not* calling Py_Finalize(). =) However, I'm sure a report would be welcome, so if you don't mind going through some hassle, I'd suggest making a trip to the bug tracker. -- http://mail.python.org/mailman/listinfo/python-list
Re: average of PIL images
a) Work with the 3 components in parallel (that is, use 3 separate matrices, one for each component, and regenerate the image at the end). that wd be ok for image generation ..but to calculate covariance matrix from the set of images i don't know if it wd work eric -- http://mail.python.org/mailman/listinfo/python-list
Re: python-ldap for plone 3 (python 2.4.4)
Erol Robaina Cepero wrote: I need download python-ldap for my plone 3.0.5 that use python 2.4.4. Do you know where I can find it? http://python-ldap.sourceforge.net/download.shtml Ciao, Michael. -- http://mail.python.org/mailman/listinfo/python-list
Re: SOAP strategies
On 19 Feb, 16:59, Paul Watson [EMAIL PROTECTED] wrote: Have I offended? My apologies if I have. I thought I showed that I had done some homework and used Google and did the other things to show that I was willing to put forth some effort. Please tell me if I have missed something. If I should look somewhere besides Python for doing SOAP, then please say that also. Thanks. There's a Wiki page here about Web services in Python: http://wiki.python.org/moin/WebServices I don't think that there's been a great deal of visible activity around SOAP in the Python community other than that you've already noticed. I entertained the idea of doing some more complete SOAP support as an add-on to the libxml2dom project, but not wanting to implement all the related specifications (schemas, service descriptions), I struggle to see the benefit compared to simpler solutions. That's not to say that SOAP has no value. Clearly, if you consider the different use cases, SOAP is probably more appropriate for some than other solutions would be. If one were exposing some kind of repository through some kind of Web service, I'd consider approaches like REST, along with technologies like WebDAV (which overlaps with REST), XML- RPC and SOAP. But if the Web service were to involve issuing relatively complicated queries, and/or the repository wasn't strictly hierarchical (or couldn't be elegantly represented in such a way), then it would arguably be less appropriate to deploy a pure REST solution, favouring XML-RPC and SOAP instead. What undermines SOAP for me is that if I'm not too interested in treating it like some kind of RPC mechanism, then I can get most of the pertinent benefits from exchanging plain XML documents. You can, of course, do SOAP like this, but the obligation to look after the boilerplate elements (which should permit lots of fancy features like routing, if such stuff is actually used in the real world) seems like a distraction to me. Paul -- http://mail.python.org/mailman/listinfo/python-list
Re: Threading the Python interpreter
In article [EMAIL PROTECTED], Nick Stinemates [EMAIL PROTECTED] writes: MooJoo wrote: Since I'm running each python instance in a new process, I don't believe that there is a problem and, in my testing so far, I haven't encountered anything that would lead me to believe there is a potential time bomb here. Am I correct in my assumption this is OK or just lucky so far? FYI -- That's not multi threading that's multiprocessing. You're safe. Actually that's multiprogramming (or less commonly multitasking). It's a common confusion, but in the literature, multiprocessing means the use of multiple processors (often via multiple cores in todays desktop systems). Unfortunately for the cause of language regularity, the terms developed separately in somewhat different communities. The term multiprocessing evolved in the early 1960s associated with a hardware manufacturer of multiprocessor systems. The term process evolved in the mid 1960s associated with the academic community. And the term multiprogramming evolved in the late 1960s. All three terms were eventually accepted by the larger computing community with little change in their original meanings. But, the OP should still be safe. - dmw -- . Douglas Wells . Connection Technologies . . Internet: -sp9804- -at - contek.com- . -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: Phatch = PHoto bATCH processor and renamer based on PIL
I'm pleased to announce the release of Phatch which is a powerful batch processor and renamer. Phatch exposes a big part of the Python Imaging Library through an user friendly GUI. (It is using python-pyexiv2 to offer more extensive EXIF and IPTC support.) Phatch is not targeted at manipulating individual pictures (such as with Gimp), but repeating the same actions on hundreds or thousands of images. If you know PIL and have some nice recipes laying around, it is very easy to write plugins as Phatch generates the corresponding GUI automagically just like in Django. Any existings PIL scripts can be added very easily. Let me know if you want to contribute or have any questions. Homepage:http://photobatch.stani.be(free download link below) Tutorials:http://photobatch.wikidot.com/tutorials Translations:https://translations.launchpad.net/phatch/trunk/+pots/phatch License: GPLv3 Screenshot: http://photobatch.wikidot.com/local--files/start/Screenshot-Phatch3d.jpg (the perspective and reflection is produced by Phatch itself) This is pretty cool! I have one question about the equally cool website: what tool did you use for creating this image: http://photobatch.wikidot.com/local--files/start/Screenshot-Phatch3d.jpg This is Phatchs own dogfood. I guess you missed the tutorials link. There is a tutorial how you can achieve this effect: http://photobatch.wikidot.com/tutorial-round-3d-reflect I run Phatch on three screenshots I have to put them in perspective with rounded corners and perspective. I let Phatch save them as a png so transparency is preserved. Afterwards I opened Gimp and put the three together on the background of a radial gradient. Let me know if it works for you. Yep, I indeed missed the tutorial :) Now it's clear, thanks a lot! Cheers, Daniel -- http://mail.python.org/mailman/listinfo/python-list
Re: Seemingly odd 'is' comparison.
On Feb 19, 1:47 pm, Boris Borcic [EMAIL PROTECTED] wrote: Arnaud Delobelle wrote: On Feb 13, 10:19 pm, Tobiah [EMAIL PROTECTED] wrote: print float(3.0) is float(3.0) True print float(3.0 * 1.0) is float(3.0) False [You don't need to wrap your floats in float()] def f(): ... return 3.0 is 3.0, 3.0*1.0 is 3.0 ... f() (True, False) import dis dis.dis(f) 2 0 LOAD_CONST 1 (3.0) 3 LOAD_CONST 1 (3.0) 6 COMPARE_OP 8 (is) 9 LOAD_CONST 3 (3.0) 12 LOAD_CONST 1 (3.0) 15 COMPARE_OP 8 (is) 18 BUILD_TUPLE 2 21 RETURN_VALUE As you can see when 3.0 is 3.0 is evaluated the same float object is put on the stack twice so the 'is' comparison is True (LOAD_CONST 1 / LOAD_CONST 1 / COMPARE_OP 8). Whereas when 3.0*1.0 is 3.0 is evaluated, *two* different float objects are put on the stack and compared (LOAD_CONST 3 / LOAD_CONST 1 / COMPARE_OP 8). Therefore the result is False. Looks good, but doesn't pass the sanity check ;) Consider def f(): return 3 is 3, 3*1 is 3 import dis dis.dis(f) 2 0 LOAD_CONST 1 (3) 3 LOAD_CONST 1 (3) 6 COMPARE_OP 8 (is) 9 LOAD_CONST 3 (3) 12 LOAD_CONST 1 (3) 15 COMPARE_OP 8 (is) 18 BUILD_TUPLE 2 21 RETURN_VALUE f() (True, True) Cheers, BB Looks good, but doesn't pass the sanity check ;) Consider: def f(): ... return 100 is 100, 100*1 is 100 ... f() (True, False) dis.dis(f) 2 0 LOAD_CONST 1 (100) 3 LOAD_CONST 1 (100) 6 COMPARE_OP 8 (is) 9 LOAD_CONST 3 (100) 12 LOAD_CONST 1 (100) 15 COMPARE_OP 8 (is) 18 BUILD_TUPLE 2 21 RETURN_VALUE Small integers are special because they are interned, that's why you got True for the second comparison. With a larger integer that doesn't happen. -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list
Re: problem with mod_python
Pradnyesh Sawant wrote: Hello, I have a small program which does 'import hashlib'. This program runs fine with python2.5. But when I try running the same program through mod_python, I get the error: 'ImportError: No module named hashlib' in the apache2 error.log Searching online suggested me to include md5.so or md5module.so in apache2. but I don't see that in a package for debian lenny (the system I'm using). So, my Q is, is it possible to make mod_python use the same PYTHONPATH as the python2.5 interpreter? if so, how? It sounds like your mod_python may be compiled against a different version of Python than your main installation? How did you install mod_python? How did you install your main python installation? What is the output of the command: ldd /path/to/mod_python.so (the full path on my system is /usr/lib/apache2/mod_python.so) There should be a line something like: libpython2.5.so.1.0 = /usr/lib/libpython2.5.so.1.0 (0xb7e37000) If it is pointing to libpython.2.4.so.1.0, then that could be the reason for you troubles. Hope that helps. j -- http://mail.python.org/mailman/listinfo/python-list
Re: Py_Finalize ERROR!
On 19 feb, 05:11, zaley [EMAIL PROTECTED] wrote: Py_Finalize ERROR! In my C++ program ,python is embeded . I create one win thread to run embedded Python code . So at the begin of thread function I call Py_Initialize and at the end of thread function call Py_Finalize . But after I began thread several times,the program crashed in function Py_Finalize. I can see the error occured at function PyObject_ClearWeakRefs when Py_Finalize called type_dealloc; Note: the python25.dll(lib) is builded by VC6(SP6) Try to not call repeatedly Py_Initialize/Py_Finalize, only at the start/end of your program. If only one thread is running Python at the same time I *think* you don't have to do any special handling. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Why must implementing Python be hard unlike Scheme?
http://codespeak.net/pypy/dist/pypy/doc/getting-started.html#what-is-... George I'm very excited about PyPy. It would still be nice to see a nice succinct list of major design principles of Python implementations somewhere. chris -- http://mail.python.org/mailman/listinfo/python-list
firefox cache Python
Hi, I have got into an interesting problem. Today I found that if I type about:cache?device=disk (without the quotes) in the address bar of firefox, it displays disk cache information. Now I am thinking to write a Python program that will read this cache info. My initial idea is to somehow save the page in a file and parse it. But how to save the page without human intervention (pressing ctrl+s) :) ? Hope I could make it clear what I am trying to do... Any clue? regards, Subeen. http://love-python.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python seems to be ignoring my except clause...
On Feb 19, 6:14 am, Adam W. [EMAIL PROTECTED] wrote: So I deleted my .pyc files and reran, same thing, but then I closed all open windows and reran it, and it recompiled the pyc and the code worked. ... But now I know I have to keep deleting my pyc files or else I will run into trouble. What editor are you using? It sounds like it doesn't set the timestamp on the files you are editing properly. That is, every time you save your file it should update the timestamp of the .py file so that python can see that there is an older .pyc next to a newer .py. But that is probably the least of your worries right now... -- http://mail.python.org/mailman/listinfo/python-list
Querying a complex website
Greetings, I am attempting to use python to submit a query to the following URL: https://ramps.uspto.gov/eram/patentMaintFees.do The page looks simple enough - it requires submitting a number into 2 form boxes and then selecting from the pull down. However, my test scripts have been hung up, apparently due to the several buttons on the page having the same name. Ideally, I would have the script use the Get Bibligraphic Data link. Any assistance would be appreciated. ~Jon -- http://mail.python.org/mailman/listinfo/python-list
Threads vs. continuations
I've been doing some thinking, and I've halfway convinced myself of the following statement: that threads as implemented by Python (or Java) are exactly equivalent to one-shot continuations in Scheme. Am I right? (I'd have asked in the scheme groups, but I feel like I'm less likely to get flamed to death here... hehe.) If that's the case, it seems threads plus hygeinic macros and a few primitives a la Scheme would form a solid basis upon which to build a programming language. The only thing preventing Python from being that language is the difficulty of integrating a macro system, n'est- ce pas? Thanks! Paul -- http://mail.python.org/mailman/listinfo/python-list
Re: Using a signal to terminate a programm running with an asyncore loop
On Feb 8, 4:03 pm, Larry Bates [EMAIL PROTECTED] wrote: When signal is caught handle_shutdown_signal is called. At that point SHUTDOWN_PERFORMED will ALWAYS be False. Normally all you do in this function is to set SHUTDOWN_PERFORMED to True and have a test somewhere in your main program loop that tests if SHUTDOWN_PERFORMED:... I know that when you reach if not SHUTDOWN_PERFORMED: SHUTDOWN_PERFORMED will always be False so #do some stuff will get executed. Setting SHUTDOWN_PERFORMED = True doesn't do any good unless you catch this back in the main program. If I were you I would try to issue kill from console first to see if it works. Then try os.kill(). Hope this helps some. -Larry Sorry for the slow response. I had other tasks come up last week that took priority. Got back to this today and tried it. I simplified my code so right now the signal handler looks like this: def handle_shutdown_signal(signum, frame): print 'in shutdown handler, caught signal', signum asyncore.socket_map.clear() exit() I'm still registering the handler the same way: signal.signal(signal.SIGTERM, handle_shutdown_signal) I'm still not convinced the handler function is getting called. I tried killing the process from the command line (# kill -s SIGTERM pid) and my print message doesn't get shown; and running ps ax shows the program is still running. I'm wondering if there is something else going on. I've checked my code and nothing else registers any signal handlers, but there are places that use asyncore.dispatcher and asynchat to handle some network communication; perhaps something in there re-registers the signal handlers? I tried writing a simple test program; running it from one shell and killing it from another works fine: #!/usr/bin/env python import signal def handler(signum, frame): print 'caught signal', signum exit() signal.signal(signal.SIGTERM, handler) while True: a = 1 print 'out' After I issue the fill command, I get the following output: caught signal 15 Which is what I expected; since the handler calls exit() I didn't expect to see the 'out' message ever get printed. Any thoughts? - David -- http://mail.python.org/mailman/listinfo/python-list
Re: C function in a Python context
#include string #include vector This modification required: compilercommand='c:/programs/mingw/bin/g++' and strctypes= { 'i': 'int', 's': 'const char*', 'O': 'PyObject*' } The output is: #include c:/programs/python/include/Python.h [ user code ] static PyObject * extcode_enumfactors(PyObject *self, PyObject *args) { PyObject* result; int arg0; const char* arg1; PyArg_ParseTuple(args, is, arg0, arg1 ); result= enumfactors( arg0, arg1 ); return Py_BuildValue( O, result ); } static PyMethodDef ExtcodeMethods[] = { { enumfactors, extcode_enumfactors, METH_VARARGS, }, {NULL, NULL, 0, NULL} }; PyMODINIT_FUNC initextcode(void) { (void) Py_InitModule(extcode, ExtcodeMethods); } The benefits are automatic parameter parsing and automatic method table construction. The costs are portability and parameter parsing flexibility. Add up. -- http://mail.python.org/mailman/listinfo/python-list
Re: Threads vs. continuations
[EMAIL PROTECTED] wrote: I've been doing some thinking, and I've halfway convinced myself of the following statement: that threads as implemented by Python (or Java) are exactly equivalent to one-shot continuations in Scheme. Am I right? (I'd have asked in the scheme groups, but I feel like I'm less likely to get flamed to death here... hehe.) If that's the case, it seems threads plus hygeinic macros and a few primitives a la Scheme would form a solid basis upon which to build a programming language. The only thing preventing Python from being that language is the difficulty of integrating a macro system, n'est- ce pas? Thanks! Paul An interesting question to which I shall stay tuned for an answer. However, allow me to point out that there is a macro language for Python. It's called 'm4' ... ducks and runs -- Tim Daneliuk [EMAIL PROTECTED] PGP Key: http://www.tundraware.com/PGP/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Passing a callable object to Thread
The ice-cream example given earlier does /not/ fit the idea of a tuple to me; Vanilla, Chocolate, and Strawberry isn't a tuple -- it's a list... Flavor* flavors[]= { Vanilla, Chocolate, Strawberry }; flavorct= 3; -- http://mail.python.org/mailman/listinfo/python-list
Re: SOAP strategies
On Tue, 2008-02-19 at 10:01 -0800, Paul Boddie wrote: On 19 Feb, 16:59, Paul Watson [EMAIL PROTECTED] wrote: Have I offended? My apologies if I have. I thought I showed that I had done some homework and used Google and did the other things to show that I was willing to put forth some effort. Please tell me if I have missed something. If I should look somewhere besides Python for doing SOAP, then please say that also. Thanks. There's a Wiki page here about Web services in Python: http://wiki.python.org/moin/WebServices I don't think that there's been a great deal of visible activity around SOAP in the Python community other than that you've already noticed. I entertained the idea of doing some more complete SOAP support as an add-on to the libxml2dom project, but not wanting to implement all the related specifications (schemas, service descriptions), I struggle to see the benefit compared to simpler solutions. That's not to say that SOAP has no value. Clearly, if you consider the different use cases, SOAP is probably more appropriate for some than other solutions would be. If one were exposing some kind of repository through some kind of Web service, I'd consider approaches like REST, along with technologies like WebDAV (which overlaps with REST), XML- RPC and SOAP. But if the Web service were to involve issuing relatively complicated queries, and/or the repository wasn't strictly hierarchical (or couldn't be elegantly represented in such a way), then it would arguably be less appropriate to deploy a pure REST solution, favouring XML-RPC and SOAP instead. What undermines SOAP for me is that if I'm not too interested in treating it like some kind of RPC mechanism, then I can get most of the pertinent benefits from exchanging plain XML documents. You can, of course, do SOAP like this, but the obligation to look after the boilerplate elements (which should permit lots of fancy features like routing, if such stuff is actually used in the real world) seems like a distraction to me. Paul Many thanks for your comments. I will take a look at the site. My primary orientation is in accessing large (one or more terabyte) databases and doing data integration (ETL, ELT, EAI, EII) work. Any other suggestions? -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: Phatch = PHoto bATCH processor and renamer based on PIL
SPE - Stani's Python Editor [EMAIL PROTECTED]: I develop Phatch on Ubuntu/Linux, but I have tested and polished it regularly on Windows and Mac Os X. (Only the droplet functionality needs to be ported.) Phatch is submitted to Debian unstable and Ubuntu Hardy. Packagers for other platforms are welcome. Requirements: - PIL 1.1.5 or higher - wxPython 2.6 or higher - pyexiv2 (optional) - python nautilus bindings (optional) Hm. I just gave it a try on Windows, but in vain. See below. C:\build\phatch-0.1.bzr385python setup.py install just says Sorry your platform is not yet supported. from PIL import Image Image.VERSION '1.1.5' import wx wx.__version__ '2.8.7.1' By greping for Sorry you platform, I found config.py and there (abbreviated) the following function: def check_config_paths(config_paths): if config_paths: return config_paths p = sys.prefix if sys.platform[:5] == 'linux': return { PHATCH_IMAGE_PATH : ... } else: sys.stderr.write('Sorry your platform is not yet supported.\n') sys.exit() How is this supposed to work on Windows? -- Wir danken für die Beachtung aller Sicherheitsbestimmungen -- http://mail.python.org/mailman/listinfo/python-list
Re: The big shots
On Feb 19, 5:17 am, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: Diez B. Roggisch a écrit : [EMAIL PROTECTED] schrieb: I'm a little dissatisfied, and just thinking aloud. (snip remaining of mostly inarticulate post, just couldn't make sens of it - as usual) No idea what's wrong with these people here - but I bet if you team up with Illias, you can start working on his language-to-rule-them-all in no time, shortening the delivery goal of 2011 immensly. Hum... Perhaps a bit harsh, but there's something here : castironpi's posts definitively have something in common with Illias' ones. Couldn't name exactly what, but still... op If you really hope to get any serious attention, stop whining and learn to express yourself clearly. This won't necessarily make anybody agree with your proposals, but at least chances are someone will read them. /op Ok, take this one. C is faster than Python. It would be useful, in certain cases, to write C. It is possible but inconvenient, out of the way. Date: Sat, 9 Feb 2008 11:48:51 -0800 (PST) Subject: C function in a Python context http://groups.google.com/group/comp.lang.python/browse_frm/thread/cd2f79dd12e81912/ A simple compile and link function. Useful for basic cases; if you want to get fancy, don't use it. My suspicion is that my choices of message subjects, function names, and variable names, is the biggest hang up. -- http://mail.python.org/mailman/listinfo/python-list
Re: The big shots
On Tue, 2008-02-19 at 12:49 -0800, [EMAIL PROTECTED] wrote: Ok, take this one. C is faster than Python. It would be useful, in certain cases, to write C. It is possible but inconvenient, out of the way. Making that easier is a worthy goal... Date: Sat, 9 Feb 2008 11:48:51 -0800 (PST) Subject: C function in a Python context http://groups.google.com/group/comp.lang.python/browse_frm/thread/cd2f79dd12e81912/ A simple compile and link function. Useful for basic cases; if you want to get fancy, don't use it. ...and THAT's your solution?!? That solution is more insane than clever. I enjoy thinking outside the box as much as anybody, but requiring the run-time environment to have a compiler so that it can compile a piece of inline C code every time the program is run is absolutely ludicrous. My suspicion is that my choices of message subjects, function names, and variable names, is the biggest hang up. I think your biggest hangup is that you believe too much in your own creativity. There are already viable solutions out there for integrating C and Python: Pyrex, Cython, and ctypes come to mind. -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list
Re: standardization allows?
On Feb 13, 4:41 pm, [EMAIL PROTECTED] wrote: Standardization helps avoid the readability and reliability problems which arise when many different individuals create their own slightly varying implementations, each with their own quirks and naming conventions. Standardization allows RCA cables, bumpers, and 115V plugs. The Bill of Rights allows Huckleberry Finn. What is the analogue of the Bill of Rights for programmers and users, whether of programming languages or latter-generation software? -- http://mail.python.org/mailman/listinfo/python-list
Re: SOAP strategies
On Tue, 2008-02-19 at 10:01 -0800, Paul Boddie wrote: On 19 Feb, 16:59, Paul Watson [EMAIL PROTECTED] wrote: Have I offended? My apologies if I have. I thought I showed that I had done some homework and used Google and did the other things to show that I was willing to put forth some effort. Please tell me if I have missed something. If I should look somewhere besides Python for doing SOAP, then please say that also. Thanks. There's a Wiki page here about Web services in Python: http://wiki.python.org/moin/WebServices I don't think that there's been a great deal of visible activity around SOAP in the Python community other than that you've already noticed. I entertained the idea of doing some more complete SOAP support as an add-on to the libxml2dom project, but not wanting to implement all the related specifications (schemas, service descriptions), I struggle to see the benefit compared to simpler solutions. That's not to say that SOAP has no value. Clearly, if you consider the different use cases, SOAP is probably more appropriate for some than other solutions would be. If one were exposing some kind of repository through some kind of Web service, I'd consider approaches like REST, along with technologies like WebDAV (which overlaps with REST), XML- RPC and SOAP. But if the Web service were to involve issuing relatively complicated queries, and/or the repository wasn't strictly hierarchical (or couldn't be elegantly represented in such a way), then it would arguably be less appropriate to deploy a pure REST solution, favouring XML-RPC and SOAP instead. What undermines SOAP for me is that if I'm not too interested in treating it like some kind of RPC mechanism, then I can get most of the pertinent benefits from exchanging plain XML documents. You can, of course, do SOAP like this, but the obligation to look after the boilerplate elements (which should permit lots of fancy features like routing, if such stuff is actually used in the real world) seems like a distraction to me. Paul Many thanks for your comments. I will take a look at the site. My primary orientation is in accessing large (one or more terabyte) databases and doing data integration (ETL, ELT, EAI, EII) work. Any other suggestions? -- http://mail.python.org/mailman/listinfo/python-list
Re: Threads vs. continuations
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: If that's the case, it seems threads plus hygeinic macros and a few primitives a la Scheme would form a solid basis upon which to build a programming language. The only thing preventing Python from being that language is the difficulty of integrating a macro system, n'est- ce pas? Difficulty as measured in Guido being less likely than the survival of a snowball in the Sahara to ever consider anything like hygenic macros. -- Aahz ([EMAIL PROTECTED]) * http://www.pythoncraft.com/ All problems in computer science can be solved by another level of indirection. --Butler Lampson -- http://mail.python.org/mailman/listinfo/python-list
Re: The big shots
On Feb 19, 3:15 pm, Carsten Haese [EMAIL PROTECTED] wrote: On Tue, 2008-02-19 at 12:49 -0800, [EMAIL PROTECTED] wrote: Ok, take this one. C is faster than Python. It would be useful, in certain cases, to write C. It is possible but inconvenient, out of the way. Making that easier is a worthy goal... Date: Sat, 9 Feb 2008 11:48:51 -0800 (PST) Subject: C function in a Python context http://groups.google.com/group/comp.lang.python/browse_frm/thread/cd2... A simple compile and link function. Useful for basic cases; if you want to get fancy, don't use it. ...and THAT's your solution?!? That solution is more insane than clever. I enjoy thinking outside the box as much as anybody, but requiring the run-time environment to have a compiler so that it can compile a piece of inline C code every time the program is run is absolutely ludicrous. My suspicion is that my choices of message subjects, function names, and variable names, is the biggest hang up. I think your biggest hangup is that you believe too much in your own creativity. There are already viable solutions out there for integrating C and Python: Pyrex, Cython, and ctypes come to mind. -- Carsten Haesehttp://informixdb.sourceforge.net OH YEAH. Color me absent-minded. File under No, they're not compiled. On the other hand, a number of modules are not available on all platforms. 'extcode' is merely not available on all machines. -- http://mail.python.org/mailman/listinfo/python-list
Re: standardization allows?
[EMAIL PROTECTED] wrote: Standardization allows RCA cables, bumpers, and 115V plugs. The Bill of Rights allows Huckleberry Finn. What is the analogue of the Bill of Rights for programmers and users, whether of programming languages or latter-generation software? I want that drogues, man -- http://mail.python.org/mailman/listinfo/python-list
Re: Double underscores -- ugly?
Marco Mariani [EMAIL PROTECTED] writes: Ben Finney wrote: I realise that double underscores make the language conceptually cleaner in many ways (because fancy syntax and operator overloading are just handled by methods), but they don't *look* nice. That's a good thing, in that it draws attention to the names. Well, double underscore is awful when you have to read code with the wrong typeface, possibly printed. The wrong typeface can make anything awful to read. This is unrelated to double-underscores. The solution, therefore, is also unrelated to double-underscores: choose an appropriate typeface. -- \ “Courage is not the absence of fear, but the decision that | `\ something else is more important than fear.” —Ambrose | _o__) Redmoon | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: standardization allows?
[EMAIL PROTECTED] writes: Standardization allows RCA cables, bumpers, and 115V plugs. The Bill of Rights allows Huckleberry Finn. What is the analogue of the Bill of Rights for programmers and users, whether of programming languages or latter-generation software? http://gplv3.fsf.org ;-) -- http://mail.python.org/mailman/listinfo/python-list
Re: The big shots
On Feb 19, 12:37 am, George Sakkis [EMAIL PROTECTED] wrote: On Feb 19, 12:08 am, [EMAIL PROTECTED] wrote: The problem did not seem to be miscommunication, rather bias. IMHO it's partly because of the obscurity of the ideas and the code you suggest, and partly because of the poor job you do to explain them. By the way, you may have noticed that you have been mostly replying to your own posts here in c.l.py, which indicates that the lack of responses has nothing to do with the supposed snobbishness of the big shots. George I'm going to start marking my subjective comments with a star, so it's clear what is emperically verifiable, and what is not. It's a bad sign. If you aren't keeping your thoughts to yourself, and thrashing about the world for a peer, a social network, a support group, or a community, then you missed the day in grammar school when they were handing out smiles. But they're not handing them out anymore. Even on my emperical claims, I'm wrong 90% of the time. On the subjective ones, I'm not only wrong that much, but no one else want to hear, or even can verify them. Smell's fine to me. Emotions are prejudiced; and even in my own concrete thoughts, I will misidentify myself with another, and others with me. When I say I, I mean you. French and Spanish have impersonal pronouns: on and se, respectively. In English, they often come out as, we, they, and you a lot, on occasion a one, and sometimes, even, I. -- http://mail.python.org/mailman/listinfo/python-list
Re: What's the standard for code docs?
On Feb 16, 1:56 am, John Nagle [EMAIL PROTECTED] wrote: Preston Landers wrote: Hey guys and gals. What are all the cool kids using these days to document their code? HTML. Text-only docs are so last-cen. My sarcasometer is broken today... are you being serious? -- http://mail.python.org/mailman/listinfo/python-list
Re: standardization allows?
On Feb 19, 4:05 pm, Paul Rubin http://[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] writes: Standardization allows RCA cables, bumpers, and 115V plugs. The Bill of Rights allows Huckleberry Finn. What is the analogue of the Bill of Rights for programmers and users, whether of programming languages or latter-generation software? http://gplv3.fsf.org ;-) What are the words that everyone understands? -- http://mail.python.org/mailman/listinfo/python-list