Re: How can i eval subindex on list[ ][ ] ?
"James Stroud" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | jairodsl wrote: | > Excuse me, i was trying in too many ways but i couldnt access subindex | > on a list , the problem is the next: | > | > I have | > | > indif=[[0,'A'],[1,'B'],[2,'C'],[3,'D']] | > | > and | > | > indic=[[0,'B'],[1,'C'],[2,'D'],[3,'E']] | > | > i need to eval if indic[i][j] is equal to indif[i][j] | > | > I used a double for but i had got "list index out of range". How can i | > do ??? | > | > Thanks a lot, | > | > Cordially, | > | > jDSL | > | | py> i = 1 | py> j = 0 | py> indif[i][j] == indic[i][j] | True Or, if you mean for every i and j, just indif == indic and let the types equality method do the work for you. -- http://mail.python.org/mailman/listinfo/python-list
Re: connection to server not accepted (but no error) only after several hours
Hi Dennis, I am using indeed using python logging in the appel_log2 module. But I wanted to keep it extremly simple while accepting connection from different processes or thread. Regarding my main problem, I did some more testing : 1) I have enabled one time server that can be run as a service (R C C time server) and this service is responding correctly, when at the same time (before I kill it ) the python time server is not responding. 2) I have also tried two python time server downloaded from effbot site. Both are not responding after the "non response from the time server I rn" even for the first interrogation once they are started. (Of course I have killed my time server when I run a new one). Same behaviour no response given but no error neither. 3) If I try to start the R c c time server when the python time server is running there is an error (from the rcc service) The python time server program is really bound to port 37. if we look at the previous tests : 4) The same python program runned on port 38 aftter the blocking is working properly from the start. 5) There is no exception on the python time server whether it is responding or not. -- partial conclusion - It is only python programs that are listening from the port 37 that are blocked at a certain time. How is it possible (without firewall enabled) ? Thanks . Sebastien. Dennis Lee Bieber a écrit : > On 16 Jan 2007 07:39:35 -0800, "seb" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > > > Once it is blocked, I killes it, wait for about 15 minutes without > > running the server and then started again but this gives me the same > > behaviour (no response). > > > Can't help with the lock-up problem... but... > > > > import socket > > import struct, time > > import threading > > import os > > import appel_log2 as appel_log > > import sys > > > > > > class TimeServer(threading.Thread) : > > def __init__(self): > > nom_function_actuelle= str(sys._getframe().f_code.co_filename) > > +"___"+str(sys._getframe().f_code.co_name) > > try : > > threading.Thread.__init__(self) > > self.log_file="timeserverlog.txt" > > self.PORT=37 > > self.TIME1970=2208988800L > > self._continue=1 > > self.time_shift=0 > > message=nom_function_actuelle+"\t "+"STARTED OK " > > appel_log.write_log("info",message) > > Have you considered using Python's logging module? > > while 1==1 : > > Redundant test... > > In all historical versions of Python > > while 1: > > sufficed, and newer versions have > > while True: > -- > WulfraedDennis Lee Bieber KD6MOG > [EMAIL PROTECTED] [EMAIL PROTECTED] > HTTP://wlfraed.home.netcom.com/ > (Bestiaria Support Staff: [EMAIL PROTECTED]) > HTTP://www.bestiaria.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: How to determine what exceptions a method might raise?
Ben Finney wrote: > Ed Jensen <[EMAIL PROTECTED]> writes: > > > it would be handy if there was something I could do in the > > interactive interpreter to make it tell me what exceptions the file > > method might raise (such as IOError). > > For what purpose would this be handy? Surely the benefit of the > interactive interpreter is that you can simply try it out and *see* > what happens. > > But, in case it helps: Any code may raise any exception at any > time. This is a feature, since it encourages program that are tested > properly. That's a silly argument, really, unless perhaps you'd consider a box of pills that look like M&Ms a 'feature' since it encourages parents to hide them from their kids. A better answer would be along the lines of "yes, that would be nice to have but in general it's not possible in a dynamic language; that's the price you have to pay for leaving the static typing world". As for the OP's question, since file is a fixed builtin, I think it should be possible to know all the possible exceptions that can be raised; I'm not sure if it's clearly documented though. George -- http://mail.python.org/mailman/listinfo/python-list
Re: Conflicting needs for __init__ method
On 1/16/07, Ben Finney <[EMAIL PROTECTED]> wrote: > "BJörn Lindqvist" <[EMAIL PROTECTED]> writes: > > > import rational > > rational.rational(45) > > rational.rational(45.0) > > rational.rational([45, 45.5]) > > > > def rational(obj): > > initers = [(int, from_int), (basestring, from_str), (list, from_list)] > > for obj_type, initer in initers: > > if isinstance(obj, obj_type): > > return initer(obj) > > raise ValueError("Can not create a rational from a %r" % > > type(obj).__name__) > > You've just broken polymorphism. I can't use your factory function > with an instance of my custom type that behaves like a list, but is > not derived from list (or a non-'int' int, or a non-'basestring' > string). Indeed, but I do not think that is fatal. There are many functions in Pythons stdlib that breaks duck typing exactly like that. > Use the supplied value as you expect to be able to use it, and catch > the exception (somewhere) if it doesn't work. That will allow *any* > type that exhibits the correct behaviour, without needlessly > restricting it to a particular inheritance. Can you show an example of that? It seems like that approach would lead to some very convoluted code. -- mvh Björn -- http://mail.python.org/mailman/listinfo/python-list
Re: How to determine what exceptions a method might raise?
In <[EMAIL PROTECTED]>, George Sakkis wrote: > Ben Finney wrote: > >> But, in case it helps: Any code may raise any exception at any >> time. This is a feature, since it encourages program that are tested >> properly. > > That's a silly argument, really, unless perhaps you'd consider a box of > pills that look like M&Ms a 'feature' since it encourages parents to > hide them from their kids. A better answer would be along the lines of > "yes, that would be nice to have but in general it's not possible in a > dynamic language; that's the price you have to pay for leaving the > static typing world". I don't thing that's a dynamic vs. static thing because in statically typed languages it's not that easy to find out all possible exceptions unless the language forces you to declare them. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I create a linked list in Python?
In <[EMAIL PROTECTED]>, bearophileHUGS wrote: > In CPython they are dynamic arrays, they aren't lists. Try adding > elements at the beginning of a list compared to adding elements at the > beginning or in the middle of a python "list" and you will see the > efficiency differences. Python has a list type without the "s, it's a real list. Don't confuse the *ADT list* with *linked lists* which are just one implementation of the ADT list. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
Re: Class data members in C
"Nick Maclaren" <[EMAIL PROTECTED]> wrote: > > Hmm. The extensions documentation describes how to add instance > members to a class (PyMemberDef), but I want to add a class member. > Yes, this is constant for all instances of the class. > > Any pointers? When? - at time of defining base class, between class definition and first instance, at time of creating instance, or after instance creation? After instance creation is not easy, I think you would have to add to each instance... But then, I may be wrong - I often am. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list
Re: asyncore/asynchat and terminator string
"David Hirschfield" <[EMAIL PROTECTED]> wrote: 8< --- problems on syncing up in serial comms - I have seen people address this with success by using stuff like: "XXHEADERXX" as a "here starts the lesson" identifier, with no trouble, on a high volume newsfeed. If you assume that any binary value is possible and equally likely, then the problem looks hopeless, but in practice if you do this kind of thing, followed by a length, which automatically points to the next "instance" of the "here starts the lesson" in a stream, then it becomes extremely unlikely to occur in the wild. If you also repeat the length at the end, then you can "scan Backwards" through the stream. And if its not like that, its a "false sync"... The other way is to take a leaf out of the bit oriented protocols' book, and to "frame" the "packets" between (possibly repetitious) occurrences of a character that is guaranteed not to occur in the data, known as a "flag" character. You do this by a process that is called "escaping" the occurrences of the flag character in the data with yet another "escape char", that also needs special treatment if it happens in the data... Escaping can be accomplished by replacing each instance of the "Poison Characters" by an instance of the escape char, followed by the bitwise inversion of the poison char. Unescaping has to do the reverse. Using a tilde "~" as a flag char, and the ordinary slash as an escape char works well. So a packet with both poison chars in it will look like this: "~~ordinary chars followed by tilde" + "/\x81"+ "ordinary followed by slash" +"/\xd0" + "somestuff~~" So you sync up by looking for a tilde followed by a non tilde, and the end is when you hit a tilde again. To unescape, you look for slashes and invert the chars following them. Also Yahoo for "netstrings" If you want to be Paranoid, then you also implement message numbers, to make sure you don't lose packets, and for hyper paranoia, put in a BCC or LRC to make sure what you send off is received... If you are running over Ethernet, the last lot is not warranted, as its done anyway - but on a serial port, where you are on your own, it makes sense. HTH - Hendrik -- http://mail.python.org/mailman/listinfo/python-list
Re: Conflicting needs for __init__ method
"BJörn Lindqvist" <[EMAIL PROTECTED]> writes: > On 1/16/07, Ben Finney <[EMAIL PROTECTED]> wrote: > > Use the supplied value as you expect to be able to use it, and > > catch the exception (somewhere) if it doesn't work. That will > > allow *any* type that exhibits the correct behaviour, without > > needlessly restricting it to a particular inheritance. > > Can you show an example of that? It seems like that approach would > lead to some very convoluted code. Perhaps so. I don't recommend either of those approaches; I recommend, instead, separate factory functions for separate input types. -- \"When I was crossing the border into Canada, they asked if I | `\ had any firearms with me. I said, 'Well, what do you need?'" | _o__) -- Steven Wright | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: smtplib question
>> The mail server in my organization is MS exchange. Obviously I can >> email to >> any email address from my MS outlook. >> >> What's the easiest way to fix the program? > > You will need to get smtplib to authenticate when connecting to the > exchange server.Use the login function and the same username/pw > that you use to login to Outlook. > > server.login(user, password) > > Note: Your exchange administrator may have disabled this function. ( > Your Outlook will almost certainly be using MAPI not SMTP to talk to > the server). > It's very often a pain to talk with Exchange. If Outlook Web Access is enabled, you can use urlib/urllib2 to send your emails exactly like you'd do it by a web browser. It's sometimes easier than using the regular smtplib capabilities. Regards, jm -- http://mail.python.org/mailman/listinfo/python-list
Re: How to determine what exceptions a method might raise?
"George Sakkis" <[EMAIL PROTECTED]> wrote: > As for the OP's question, since file is a fixed builtin, I think it > should be possible to know all the possible exceptions that can be > raised; I'm not sure if it's clearly documented though. Just calling 'file' the most obvious exceptions it can raise are: IOError MemoryError ValueError I'm not sure if it can return UnicodeDecodeError, it looks as though it may be possible on windows, but I couldn't trigger it. Assigning the result to a variable can of course raise absolutely any exception. That's the main problem: just because a C function raises only a few different exceptions doesn't mean that the line of code calling it cannot generate a host more. -- http://mail.python.org/mailman/listinfo/python-list
Re: I wrote a C++ code generator in Python, would anyone please help me to review the code? :)
I've added a document for fgen. Please check it. Thanks, Kevin [EMAIL PROTECTED] wrote: > Kevin Wan wrote: > > fgen is a free command line tool that facilitates cross platform c++ > > development, including header generation, cpp file generation, makefile > > generation, unit test framework generation, etc. > > > > http://sf.net/projects/fgen > > > > I'm not very familiar with Python. Any feedback are appreciated! > > No documentation? > > Am I supposed to reverse engineer all the source files to figure out > how I'm > supposed to use it? > > > Or > > anyone like to develop it with me? > > > > Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Class data members in C
In article <[EMAIL PROTECTED]>, "Hendrik van Rooyen" <[EMAIL PROTECTED]> writes: |> > |> > Hmm. The extensions documentation describes how to add instance |> > members to a class (PyMemberDef), but I want to add a class member. |> > Yes, this is constant for all instances of the class. |> |> When? - at time of defining base class, between class definition and |> first instance, at time of creating instance, or after instance creation? |> |> After instance creation is not easy, I think you would have to add |> to each instance... Oh, one of the first two - I am not bonkers! Changing a class after instance creation is guaranteed to cause confusion, if nothing else. Regards, Nick Maclaren. -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I create a linked list in Python?
Marc 'BlackJack' Rintsch: > Python has a list type without the "s, it's a real list. Don't confuse > the *ADT list* with *linked lists* which are just one implementation of > the ADT list. Right, I was mostly talking about (single/double) linked lists :-) Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list
2.3-2.5 what improved?
A large cgi based web Python-2.3 application needs to be speed improved. experiments show the following under reasonable testing (these are 2 second reportlab pdf productions) 1) 2.3 --> 2.5 improvement small 1-2% 2) cgi --> fcgi improvement medium 10-12% I sort of remember claims being made about 2.5 being 10% faster than 2.4/2.3 etc etc. Can anyone say where the speedups were? Presumably we have a lot of old cruft that could be improved in some way eg moving loops into comprehensions, using iterator methods etc. Are those sort of things what we should look at? -- Robin Becker -- http://mail.python.org/mailman/listinfo/python-list
Re: Check a windows service
awel wrote: > Sorry, but could you give me an example with a real service 'cause I've > tried this script but nothings happened, no error, nothings ; even if I > launch it in cmd prompt. Well, as that example said, it was designed to show automatic services which are not running. If you don't have any then nothing will show. I assumed you could use this as a starting point. To list all services try this: import wmi c = wmi.WMI () for service in c.Win32_Service (): print service.Caption To show a specific service: import wmi c = wmi.WMI () for service in c.Win32_Service (Caption="Task Scheduler"): print service TJG -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and Soap protocol
On 1/16/07, Grzegorz Smith <[EMAIL PROTECTED]> wrote: > Hi folks > I must write webb application that will comunicate with delphi desktop > application by SOAP protocol. Can you recommend any Python Soap Libary? > I founded: SOAPpy and Zolera SOAP Infrastructure (ZSI). Any tip which is > better to use? IFAICT, SOAPpy isn't maintained any longer, so on that basis I'd recommend ZSI. -- Cheers, Simon B [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Regex Question
At Tuesday 16/1/2007 16:36, Bill Mill wrote: > py> import re > py> rgx = re.compile('1?') > py> rgx.search('a1').groups() > (None,) > py> rgx = re.compile('(1)+') > py> rgx.search('a1').groups() But shouldn't the ? be greedy, and thus prefer the one match to the zero? This is my sticking point - I've seen that plus works, and this just confuses me more. Perhaps you have misunderstood what search does. search( pattern, string[, flags]) Scan through string looking for a location where the regular expression pattern produces a match '1?' means 0 or 1 times '1', i.e., nothing or a single '1'. At the start of the target string, 'a1', we have nothing, so the re matches, and returns that occurrence. It doesnt matter that a few characters later there is *another* match, even if it is longer; once a match is found, the scan is done. If you want "the longest match of all possible matches along the string", you should use findall() instead of search(). -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas -- http://mail.python.org/mailman/listinfo/python-list
Re: Making a simple script standalone
At Tuesday 16/1/2007 19:49, Rikishi 42 wrote: What I want to do is to compile/bundle/prepare/whatever_term a simple Python script for deployment on a Windows machine. Installing Python itself on that machine, is not an option. Ideally I would like to obtain a single executable file, but a script+runtime is acceptable. distutils + py2exe -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas -- http://mail.python.org/mailman/listinfo/python-list
Re: Help: asyncore/asynchat and terminator string
At Tuesday 16/1/2007 20:05, David Hirschfield wrote: I'm implementing a relatively simple inter-application communication system that uses asyncore/asynchat to send messages back and forth. The messages are prefixed by a length value and terminator string, to signal that a message is incoming, and an integer value specifying the size of the message, followed by the message data. My question is: how can I produce a short terminator string that won't show up (or has an extremely small chance of showing up) in the binary data that I send as messages? If you send previously the size of data to follow, there is no need for a terminator. On the receiving side, just read so many bytes; it's a lot easier. Anyway you can add a terminator, and check for it after the data arrives, just a small consistency test. If you can't do that for whatever reason, usually it's done backwards: ensure the chosen (fixed) terminator never happens inside the message. Example: encoding using || as terminator, % as quote character: - any | inside the message is prefixed by the quote character: | -> %| - any % inside the message is doubled: % -> %% This way, any terminator inside the message would be converted to %|%| and could never be confused. At the receiving side, decode as follows: - search for any % character; when found, delete it and keep the following character; keep searching until no more % are found. -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas -- http://mail.python.org/mailman/listinfo/python-list
Re: How can i eval subindex on list[ ][ ] ?
At Tuesday 16/1/2007 20:08, jairodsl wrote: Excuse me, i was trying in too many ways but i couldnt access subindex on a list , the problem is the next: I have indif=[[0,'A'],[1,'B'],[2,'C'],[3,'D']] and indic=[[0,'B'],[1,'C'],[2,'D'],[3,'E']] i need to eval if indic[i][j] is equal to indif[i][j] I used a double for but i had got "list index out of range". How can i do ??? Posting your actual code would help. indif[i][j] should be fine, if i is between 0 and 3 inclusive, and j is 0 or 1. -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas -- http://mail.python.org/mailman/listinfo/python-list
Re: Anyone has a nice "view_var" procedure ?
At Tuesday 16/1/2007 20:13, Stef Mientki wrote: Ok, here's my current solution, probably not very Pythonian, (so suggestions are welcome) but it works. It appears that you're a number crunching guy - you absolutely ignore all types except numeric ones! :) (Too bad I can get the name of the var into a function ;-) I don't understand this, but if you are saying that you can't get the name of the variable you're showing - just pass the name to the function: def pm(V, name) # count the occurances of the different types N_int,N_float,N_complex,N_list,N_tuple,N_array,N_unknown = 0,0,0,0,0,0,0 Ouch, seven counters... your guts should be saying that this is candidate for a more structured type... what about a dictionary indexed by the element type? count = {} for i in range(len(V)): You're going to iterate along all the items in V, not along its indices... if type(V[i]) == int: N_int += 1 elif type(V[i]) == float: N_float += 1 elif ... Using a dict: for item in V: t = type(item) try: count[t] = count[t]+1 except IndexError: count[t] = 1 (That is: if the type is found in the dictionary, increment the count; if not, this is the first time: set the count to 1) # print the occurances of the different types # and count the number of types that can easily be displayed if type(V)==list: line = 'list:' else: line = 'tuple:' N = 0 if N_int > 0: line = line + ' N_Int=' + str(N_int) ; N += 1 if N_float > 0: line = line + ' N_Float=' + str(N_float) ; N += 1 We'll replace all of this with: for key,value in count: line += ' %s=%d' % (key, value) if N == 1: line += ' == Homogeneous ==' if len(count)==1: line += ' == Homogeneous ==' print line -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas -- http://mail.python.org/mailman/listinfo/python-list
Re: How to convert float to sortable integer in Python
At Wednesday 17/1/2007 03:36, shellon wrote: I'm sorry I mistake the function name, the function is floatToRawIntBits(), it convert ieee 754 floating point number to integer, e.g. if f1>f2 then floatToRawBits(f1) > floatToRawBits(f1) I want convert floating point number to sortable string to index in Lucene, so I want first to conver the floating point number to integer first, and than convert the integer to sortable string? The following two functions may be useful; they do more-or-less the same thing, but returning a string instead of an integer. Note that this property: f1>f2 => floatToRawBits(f1) > floatToRawBits(f2), only holds for nonnegative numbers; this code has the same restriction. The code assumes a few things: float(repr(x))==x for 0.5<=x<1 (that is, repr(x) is exact in that range); the maximum double value has an exponent (as given by frexp) less than 5000; the minimum positive value has an exponent greater than -5000; 0 is the only number having mantissa==0; and surely I'm assuming many more but I'm not aware of them. I think it's not dependent on a particular FP hardware or representation. Beasts like denormals, INFs and NaNs are not considered at all. It appears to work OK for "normal" numbers, but I've not checked all corner cases. It was only tested on Windows XP. After such long disclaimer... I hope it's useful :) --- begin fpsrepr.py --- import math def float2srepr(f): """Convert a floating point number into a string representation which can be sorted lexicographically maintaining the original numerical order (only for numbers >= 0). That is, given f1,f2 >= 0, f1 float2srepr(f1) 1.0 and curr < prev: prev = curr curr /= 2.0 return prev def find_minf(): # smallest x such x>0 prev, curr = 1.0, 0.5 while curr > 0.0 and curr < prev: prev = curr curr /= 2 return prev eps = find_eps() print "eps=%r %r" % (eps, 1.0+eps) minf = find_minf() print "minf=%r %r" % (minf, -minf) values = [0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9, 1.0,1.0+eps,1.0+2*eps,1.0-eps,1.0-2*eps, 2,3,10,10.001,10.001, 123.456,1234.567,12345.678,123456.789,1.234e10, 123412341234,123412341234123412341234.0,1.234e20, 1e100,1e200,1e300,math.pi,math.e] values += [1.0/x for x in values if x>0] + [eps, minf] values += [-x for x in values] values = sorted(values) for x in values: s = float2srepr(x) xr = srepr2float(s) print '%-30r %s' % (x, s) assert x==xr, '%r!=%r' % (x, xr) f2svalues = [float2srepr(x) for x in values if x>=0] s2fvalues = [srepr2float(x) for x in sorted(f2svalues)] assert s2fvalues == sorted(s2fvalues), s2fvalues --- end fpsrepr.py --- -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas -- http://mail.python.org/mailman/listinfo/python-list
Re: 2.3-2.5 what improved?
Robin Becker wrote: > A large cgi based web Python-2.3 application needs to be speed improved. > experiments show the following under reasonable testing (these are 2 > second reportlab pdf productions) > > 1) 2.3 --> 2.5 improvement small 1-2% > 2) cgi --> fcgi improvement medium 10-12% > > I sort of remember claims being made about 2.5 being 10% faster than > 2.4/2.3 etc etc. Can anyone say where the speedups were? Presumably we > have a lot of old cruft that could be improved in some way eg moving > loops into comprehensions, using iterator methods etc. Are those sort of > things what we should look at? Python 2.5 became quite fat. For bare CGI the Python load/init time eats all improvements. Smaller scripts even loose lot of speed. I still like Python 2.3 for many other reasons for many applications - especially for CGI's, on Windows, for deployable apps, GUI's etc. because the fat coming with Python 2.4 is not balanced by necessary goods - mostly just fancy things. ( I run even a list of patches and module copies/addaptations down to 2.3 because of that :-) ) Real news come with Py3K Robert -- http://mail.python.org/mailman/listinfo/python-list
Distributed computation of jobs (was: Parallel Python)
On 2007-01-12, robert <[EMAIL PROTECTED]> wrote: >> >> [1] http://www.python.org/pypi/parallel > > I'd be interested in an overview. > For ease of use a major criterion for me would be a pure python > solution, which also does the job of starting and controlling the > other process(es) automatically right (by default) on common > platforms. Let me add a few cents to the discussion with this announcement: About three years ago, I wrote two Python modules, one called 'exec_proxy', which uses ssh to run another exec_proxy instance at a remote machine, thus providing ligh-weight transparent access to a machine across a network. The idea behind this module was/is that by just using ssh you have network transparency, much more light weight than most other distributed modules where you have to start deamons at all machines. Recently, the 'rthread' module was announced which takes the same approach (it seems from the announcement). I have not compared both modules with each other. The more interesting Python module called 'batchlib' lies on top of the former (or any other module that provides transparency across the network). It handles distribution of computation jobs in the form of a 'start-computation' and 'get-results' pair of functions. That is, you give it a set of machines it may use, you say to the entry-point, compute for me this-and-this function with this-and-this parameters, and batchlib does the rest. (that is, it finds a free machine, copies the parameters over the network, runs the job, the result is transported back, and you can get the result of a computation by using the same (uniq) identification given by you when the job was given to batchlib.) We used it as computation backend for optimization problems, but since 'computation job' may mean anything, the module should be very generically applicable. Compared to most other parallel/distributed modules, I think that the other modules more-or-less compare with exec_proxy (that is, they stop with transparent network access), where exec_proxy was designed to have minimal impact on required infra structure (ie just ssh or rsh which is generally already available) and thus without many of the features available from the other modules. Batchlib starts where exec_proxy ends, namely lifting network primitives to the level of providing a simple way of doing distributed computations (in the case of exec_proxy, without adding network infra structure such as deamons). Until now, both modules were used in-house, and it was not clear what we wanted to do further with the software. Recently, we have decided that we have no further use for this software (we think we want to move into a different direction), clearing the way to release this software to the community. You can get the software from my home page http://seweb.se.wtb.tue.nl/~hat Both packages can be downloaded, and include documentation and an example. The bad news is that I will not be able to do further development of these modules. The code is 'end-of-life' for us. Maybe you find the software useful, Albert -- http://mail.python.org/mailman/listinfo/python-list
Re: Projects anyone?
placid wrote: > Hi all, > > I'm looking for anyone who is working on a project at the moment that > needs help (volunteer). The last project i worked on personally was > screen-scraping MySpace profiles (read more at the following link) > > http://placid.programming.projects.googlepages.com/screen-scrapingmyspaceprofiles > > > but that didn't go all to well, so im kinda bored and need something to > do, with Python. So any suggestions anyone? > > Cheers Please, contact me at: billiejoex [EMAIL PROTECTED] gmail.com I could need help for 3 projects. -- http://mail.python.org/mailman/listinfo/python-list
Re: A note on heapq module
On 2007-01-16, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > In few minutes I have just written this quite raw class, it lacks > doctring (the same of the functions of the heapq module), it may > contain bugs still, I haven't tested it much. It's just a simple > wrapper around some of the functions of the heapq module (nsmallest and > nlargest are missing). Usually I use classes only when I need then, I > like functional programming enough, and this class seems to just slow > down the functions of the heapq module. But I think an improved class > similar to this one may be useful (added, replacing isn't necessary) > into the heapq module, because it can avoid cetain errors: I know what > Heaps are and how they work, but some time ago I have written a bug > into small program that uses the functions of the heapq module, because > I have added an item to the head of the heap using a normal list > method, breaking the heap invariant. With a simple class like this one > all the methods of your object keep the heap invariant, avoiding that > kind of bugs. (If you are interested I can improve this class some, > it't not difficult.) > > [ Heap class based on heapq ] For me, your class has the same drawback as the heappush, heappop procedurers: no way to specify a comparision function. Somewhere in my experimental code I work with line segments in two dimensions. Now in one place I want from the available segments the one in which the first point is farthest to the left. In a second place I want from the available segments the one in which the second point is farthest to the left. Both can be done with a heap, but currently I can't get both behaviours while using the same class and using the heapq module or your Heap class. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
generate tuples from sequence
Hi, I'd like a generator that takes a sequence and yields tuples containing n items of the sqeuence, but ignoring the 'odd' items. For example take_group(range(9), 3) -> (0,1,2) (3,4,5) (6,7,8) This is what I came up with.. def take_group(gen, count): i=iter(gen) while True: yield tuple([i.next() for _ in xrange(count)]) Is this the most efficient solution? Regards, Will McGugan -- http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list
Re: A note on heapq module
On 2007-01-16, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Scott David Daniels: >> I'd suggest some changes. It is nice to have Heaps with equal >> contents equal no matter what order the inserts have been >> done. Consider how you want Heap([1, 2, 3]) and Heap([3, 1, >> 2]) to behave. Similarly, it is nice to have str and repr >> produce canonical representations (I would skip the __str__ >> code, myself, though). Also, subclasses should get their >> identities tweaked as so: > > My version was a *raw* one, just an idea, this is a bit better: > http://rafb.net/p/nLPPjo35.html > I like your changes. In the beginning I didn't want to put > __eq__ __ne__ methods at all, because they are too much slow, > but being them O(n ln n) I think your solution is acceptable. > > Some methods may have a name different from the heap functions: > def smallest(self): > def push(self, item): > def pop(self): > def replace(self, item): > > Two things left I can see: I think the __init__ may have a > boolean inplace parameter to avoid copying the given list, so > this class is about as fast as the original heapify function > (but maybe such thing is too much dirty for a Python stdlib): One more idea, cribbed from the linked list thread elsewhere: it might be nice if your Heap could optionally use an underlying collections.deque instead of a list. I don't know how excellent Python's deque is, but it's possible a deque would provide a faster heap than a contiguous array. C++'s std::deque is the default implementation of C++'s std::priority_queue for that reason (unless I'm confused again). -- Neil Cerutti We will sell gasoline to anyone in a glass container. --sign at Santa Fe gas station -- http://mail.python.org/mailman/listinfo/python-list
Re: generate tuples from sequence
Will McGugan wrote: > Hi, > > I'd like a generator that takes a sequence and yields tuples containing > n items of the sqeuence, but ignoring the 'odd' items. For example Forgot to add, for my purposes I will always have a sequence with a multiple of n items. Will -- http://mail.python.org/mailman/listinfo/python-list
Re: 2.3-2.5 what improved?
Robin Becker a écrit : > A large cgi based web Python-2.3 application needs to be speed improved. > experiments show the following under reasonable testing (these are 2 second > reportlab pdf productions) > > 1) 2.3 --> 2.5 improvement small 1-2% > 2) cgi --> fcgi improvement medium 10-12% > > I sort of remember claims being made about 2.5 being 10% faster than 2.4/2.3 > etc > etc. Can anyone say where the speedups were? AFAIK, most of the speedup comes from optimization of the builtin dict type, which is the central data structure in Python. But anyway, as Robert pointed out, using CGI means lauching a new Python process for each and every HTTP request. > Presumably we have a lot of old > cruft that could be improved in some way eg moving loops into comprehensions, > using iterator methods etc. Are those sort of things what we should look at? Consider profiling your code before doing anything else - unless you're planning on wasting your time. -- http://mail.python.org/mailman/listinfo/python-list
Re: 2.3-2.5 what improved?
robert wrote > Robin Becker wrote: > > A large cgi based web Python-2.3 application needs to be speed improved. > > experiments show the following under reasonable testing (these are 2 > > second reportlab pdf productions) > > > > 1) 2.3 --> 2.5 improvement small 1-2% > > 2) cgi --> fcgi improvement medium 10-12% > > > > I sort of remember claims being made about 2.5 being 10% faster than > > 2.4/2.3 etc etc. Can anyone say where the speedups were? Presumably we > > have a lot of old cruft that could be improved in some way eg moving > > loops into comprehensions, using iterator methods etc. Are those sort of > > things what we should look at? > > Python 2.5 became quite fat. For bare CGI the Python load/init > time eats all improvements. Smaller scripts even loose lot of speed. > I still like Python 2.3 for many other reasons for many > applications - especially for CGI's, on Windows, for deployable > apps, GUI's etc. because the fat coming with Python 2.4 is not > balanced by necessary goods - mostly just fancy things. What do you mean? Fat of libraries or fat itself? I tought that 2.5 was faster than precedent versions! :-\ -- http://mail.python.org/mailman/listinfo/python-list
Re: generate tuples from sequence
Will McGugan wrote: > I'd like a generator that takes a sequence and yields tuples containing > n items of the sqeuence, but ignoring the 'odd' items. For example > > take_group(range(9), 3) -> (0,1,2) (3,4,5) (6,7,8) I like >>> items = range(9) >>> N = 3 >>> zip(*[iter(items)]*N) [(0, 1, 2), (3, 4, 5), (6, 7, 8)] Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: generate tuples from sequence
On 17 Jan 2007 04:50:33 -0800, Will McGugan <[EMAIL PROTECTED]> wrote: > > Will McGugan wrote: > > > Hi, > > > > I'd like a generator that takes a sequence and yields tuples containing > > n items of the sqeuence, but ignoring the 'odd' items. For example > > Forgot to add, for my purposes I will always have a sequence with a > multiple of n items. something along the lines of... >>> [ (x,x+1,x+2) for x in xrange(0,9,3) ] [(0, 1, 2), (3, 4, 5), (6, 7, 8)] HTH :) -- http://mail.python.org/mailman/listinfo/python-list
IMAP SEARCH Error
I am using the imaplib to fetch mails. There is an error thrown in the search function, which I am not able to comprehend. My program is as follows : import imaplib M = imaplib.IMAP4("10.1.1.1",1143) M.login("roopesh", "roopesh12") type, data = M.select("INBOX", 1) print type, data print M.status("INBOX", '(MESSAGES UNSEEN RECENT)') typ, data = M.search(None, '(ALL)') print typ, data for num in data[0].split(): typ, data = M.fetch(num, '(RFC822)') print 'Message %s\n%s\n' % (num, data[0][1]) M.close() M.logout() And the OUTPUT in the console is as follows : == OK ['24'] ('OK', ['INBOX ( MESSAGES 24 UNSEEN 0 RECENT 0)']) Traceback (most recent call last): File "imap_test1.py", line 10, in ? typ, data = M.search(None, '(ALL)') File "c:\python24\lib\imaplib.py", line 602, in search typ, dat = self._simple_command(name, *criteria) File "c:\python24\lib\imaplib.py", line 1028, in _simple_command return self._command_complete(name, self._command(name, *args)) File "c:\python24\lib\imaplib.py", line 860, in _command_complete raise self.abort('command: %s => %s' % (name, val)) imaplib.abort: command: SEARCH => unexpected response: '*' Can anyone tell me why this happens ? Regards Roopesh -- http://mail.python.org/mailman/listinfo/python-list
Re: generate tuples from sequence
On 2007-01-17, Will McGugan <[EMAIL PROTECTED]> wrote: > Hi, > > I'd like a generator that takes a sequence and yields tuples containing > n items of the sqeuence, but ignoring the 'odd' items. For example > > take_group(range(9), 3) -> (0,1,2) (3,4,5) (6,7,8) > > This is what I came up with.. > > def take_group(gen, count): > i=iter(gen) > while True: > yield tuple([i.next() for _ in xrange(count)]) > > Is this the most efficient solution? This is starting to seem like an FAQ. ;) The Python library contains a recipe for this in the itertools recipes in the documentation (5.16.3). def grouper(n, iterable, padvalue=None): "grouper(3, 'abcdefg', 'x') --> ('a','b','c'), ('d','e','f'), ('g','x','x')" return izip(*[chain(iterable, repeat(padvalue, n-1))]*n) It's more general and cryptic than what you asked for, though. -- Neil Cerutti We're not afraid of challenges. It's like we always say: If you want to go out in the rain, be prepared to get burned. --Brazillian soccer player -- http://mail.python.org/mailman/listinfo/python-list
Number methods
I can't find any description of these. Most are obvious, but some are not. Note that this is from the point of view of IMPLEMENTING them, not USING them. Specifically: Does Python use classic division (nb_divide) and inversion (nb_invert) or are they entirely historical? Note that I can very easily provide the latter. Is there any documentation on the coercion function (nb_coerce)? It seems to have unusual properties. Thanks for any hints. Regards, Nick Maclaren. -- http://mail.python.org/mailman/listinfo/python-list
Re: generate tuples from sequence
Hi! r=iter(range(9)) print zip(r,r,r) But, it's few like Peter... -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list
Re: How can i eval subindex on list[ ][ ] ?
its working for me i think its better to mention the value of i and j for both lists or you might have done mistake while formatting strings it should be %s for strings and %d for numbers if any subelement in lists does not formatted properly it may lead to error -- http://mail.python.org/mailman/listinfo/python-list
Re: 2.3-2.5 what improved?
Robin> I sort of remember claims being made about 2.5 being 10% faster Robin> than 2.4/2.3 etc etc. Can anyone say where the speedups were? What's New might be enlightening: http://www.google.com/search?q=what%27s+new+site%3Apython.org Skip -- http://mail.python.org/mailman/listinfo/python-list
The proper use of QSignalMapper
Hi. I am trying to implement QTCore.QSignalMapper using PyQT. I finally got to a point where I don't receive any compile or runtime error messages, but I also do not see the final slot function fire off. Here is a snippet of the code: self.signalMapper = QtCore.QSignalMapper(window) # Use qsignalmapper to use of one slot function for multiple # widgets. The map() function sends the slot an extra param # that identifies the sender. for idx in range(1, maxIngredients+1): wName = 'chkProductIngredientsDelete_'+str(idx) w = self.__dict__[wName] self.app.connect(w, QtCore.SIGNAL("stateChanged(int)"), self.signalMapper, QtCore.SLOT("self.signalMapper.map")) self.signalMapper.setMapping(w, idx) self.app.connect(self.signalMapper, QtCore.SIGNAL( "self.signalMapper.mapped(int)"), self.deleteProductIngredient) def deleteProductIngredient(self, state, widgetIdx): """Delete a product ingredient.""" print "INSIDE FUNCTION\n" The idea here is to iterate through several checkbox widgets (named "chkProductIngredientsDelete_1, _2, etc.) and connect each object's "stateChanged" signal to the mapper's map() function, then connect the map() function to the actual slot, deleteProductIngredient(). By the way, I've checked to ensure the statements inside the loop are being executed. -- http://mail.python.org/mailman/listinfo/python-list
Re: Conflicting needs for __init__ method
Ben Finney wrote this on Wed, Jan 17, 2007 at 08:27:54PM +1100. My reply is below. > I recommend, instead, separate factory functions for separate input > types. Uh, how 'bout separate subclasses for separate input types? -- .. Chuck Rhode, Sheboygan, WI, USA .. Weather: http://LacusVeris.com/WX .. 7° — Wind SW 10 mph -- http://mail.python.org/mailman/listinfo/python-list
Re: IMAP SEARCH Error
> imaplib.abort: command: SEARCH => unexpected response: '*' > > Can anyone tell me why this happens ? It looks like a server problem. What kind of server are you using ? Exchange, Cyrus ? Did you try with two different Imap servers ? If it is a unix server, did you have a look in /var/log ? Or in windows event log ? -- http://mail.python.org/mailman/listinfo/python-list
Re: Distributed computation of jobs (was: Parallel Python)
A.T.Hofkamp skrev: > > Let me add a few cents to the discussion with this announcement: [Notes about exec_proxy, batchlib and rthread] I've added entries for these modules, along with py.execnet, to the parallel processing solutions page on the python.org Wiki: http://wiki.python.org/moin/ParallelProcessing Thanks for describing your work to us! Paul -- http://mail.python.org/mailman/listinfo/python-list
Re: IMAP SEARCH Error
Roopesh wrote: > I am using the imaplib to fetch mails. There is an error thrown in the > search function, which I am not able to comprehend. I had difficulties with the imaplib, too. It is very low level. You need to know some parts of the IMAP protocol. I solved my problems by checking with ethereal (wireshark) what other applications (KMail, getmail) do. getmail is like fetchmail, but written in Python. I found some hints by looking at its source. HTH, Thomas -- Thomas Güttler, http://www.thomas-guettler.de/ http://www.tbz-pariv.de/ E-Mail: guettli (*) thomas-guettler + de Spam Catcher: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: *POLL* How many sheeple believe in the 911 fairy tale and willing to accept an Orwellian doublespeak and enslavement world ?
Dear schoenfeld: > After 6 years we still have a situation where almost all > the worlds physicists, engineers, and other so called > "academics" promote the idea that a few minor fires > can cause two towers to free fall. Why should physics and mechanics be any different than it is for 12 story buildings? http://www.chinadaily.com.cn/en/doc/2004-01/27/content_301145.htm ... buildings collapse all the time when you design to the cold-formed strength rather than the hot-formed strength of a material, then heat the material removing its tempered strength (which for steel occurs at much lower than usual flame temeratures). And what did this rant have to do with any of the sci.* or programming newsgroups you posted it to? David A. Smith -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie: Capture traceback message to string?
Sean Schertell wrote: > Hello! > > I'm new to Python and this is my first post to the list. > > I'm trying to simply capture exception text to a few strings which > can be passed to a PSP page to display a pretty error message. The > problem is that I just can't seem to figure out how to get the basic > components of the traceback message into strings. Here's what I want > to do: > # http://www.thomas-guettler.de/vortraege/python/beispiele.py.txt def foo(): raise("Das ist eine Exception") try: foo() except: import traceback import cStringIO (exc_type, exc_value, tb) = sys.exc_info() exc_file = cStringIO.StringIO() traceback.print_exception(exc_type, exc_value, tb, file=exc_file) exc_string=exc_file.getvalue() print exc_string Why don't you use cgitb? It is one reason why I like this language. HTH, Thomas -- Thomas Güttler, http://www.thomas-guettler.de/ http://www.tbz-pariv.de/ E-Mail: guettli (*) thomas-guettler + de Spam Catcher: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Python Web Frameworks
Hi Gurus, I want to build a Python web app but im not sure which one to go for. I prefer something like asp.Net , which would allow me to fully seperate the presentation layer from the logic. Please advise? thanks, "Shortash' -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Web Frameworks
Shortash wrote: > Python Web Frameworks weak google skills you have, young friend. http://wiki.python.org/moin/WebFrameworks Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: The proper use of QSignalMapper
borntonetwork wrote: > I am trying to implement QTCore.QSignalMapper using PyQT. I finally got > to a point where I don't receive any compile or runtime error messages, > but I also do not see the final slot function fire off. Here is a > snippet of the code: > > self.signalMapper = QtCore.QSignalMapper(window) > # Use qsignalmapper to use of one slot function for multiple > # widgets. The map() function sends the slot an extra param > # that identifies the sender. > for idx in range(1, maxIngredients+1): > wName = 'chkProductIngredientsDelete_'+str(idx) > w = self.__dict__[wName] > self.app.connect(w, QtCore.SIGNAL("stateChanged(int)"), > self.signalMapper, > QtCore.SLOT("self.signalMapper.map")) You need to pass the C++ signature to the SLOT() function. I believe you want the form that does not accept any arguments: self.app.connect(w, QtCore.SIGNAL("stateChanged(int)"), self.signalMapper, QtCore.SLOT("map()")) Alternatively, you can pass the slot directly to the function: self.app.connect(w, QtCore.SIGNAL("stateChanged(int)"), self.signalMapper.map) PyQt accepts Python methods as slots, without requiring that they be wrapped in calls to SLOT(). David -- http://mail.python.org/mailman/listinfo/python-list
Re: 2.3-2.5 what improved?
[EMAIL PROTECTED] wrote: > Robin> I sort of remember claims being made about 2.5 being 10% faster > Robin> than 2.4/2.3 etc etc. Can anyone say where the speedups were? > > What's New might be enlightening: > > http://www.google.com/search?q=what%27s+new+site%3Apython.org > > Skip thanks -- Robin Becker -- http://mail.python.org/mailman/listinfo/python-list
Re: 2.3-2.5 what improved?
[EMAIL PROTECTED] wrote: > Robin Becker a écrit : > > > AFAIK, most of the speedup comes from optimization of the builtin dict > type, which is the central > data structure in Python. But anyway, as Robert pointed out, using CGI > means lauching > a new Python process for each and every HTTP request. > >> Presumably we have a lot of old >> cruft that could be improved in some way eg moving loops into comprehensions, >> using iterator methods etc. Are those sort of things what we should look at? > > Consider profiling your code before doing anything else - unless you're > planning on wasting your time. our major show stoppers(stuff like stringWidth) are already in C; the remainder are rather complex methods to do things like paragraph splitting. We're already considering fcgi to eliminate the startup time. A trial with psyco indicates another 15% could be obtained there, but I don't think we can use that on the target platform (which I think is sparc). -- Robin Becker -- http://mail.python.org/mailman/listinfo/python-list
question about module resolution
Dear Experts, I often find myself wanting to have a child module get some parameters defined in a parent module. For example, imagine I have the following directory structure and want something in baz.py to look at a value in config.py. I end up putting in things like import sys; sys.path.append('../..'). Is there a better way? foo/ __init__.py config.py bar/ __init__.py baz.py -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Web Frameworks
Shortash, "S" == Shortash wrote: S> I want to build a Python web app but im not sure which one to go for. I S> prefer something like asp.Net , which would allow me to fully seperate S> the presentation layer from the logic. Please advise? Django? http://www.djangoproject.com -- Andrey V Khavryuchenko Software Development Company http://www.kds.com.ua/ -- http://mail.python.org/mailman/listinfo/python-list
Re: question about module resolution
Emin wrote: > I often find myself wanting to have a child module get some parameters > defined in a parent module. For example, imagine I have the following > directory structure and want something in baz.py to look at a value in > config.py. I end up putting in things like import sys; > sys.path.append('../..'). Is there a better way? > > foo/ > __init__.py > config.py > bar/ > __init__.py > baz.py from __future__ import absolute_import from .. import config Peter -- http://mail.python.org/mailman/listinfo/python-list
how to write unicode to a txt file?
I want to change an srt file to unicode format so mpalyer can display Chinese subtitles properly. I did it like this: txt=open('dmd-guardian-cd1.srt').read() txt=unicode(txt,'gb18030') open('dmd-guardian-cd1.srt','w').write(txt) But it seems that python can't directly write unicode to a file, I got and error at the 3rd line: UnicodeEncodeError: 'ascii' codec can't encode characters in position 85-96: ordinal not in range(128) How to save the unicode string to the file, please? Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: Globbing files by their creation date
Thanks a mill - os.path.getctime(f) is what I needed. Unfortunately, my attempts to turn the integer it returns into a date have failed. >>> os.path.getctime(fn)#fn was created today, 1/17/2007 1168955503 I tried to convert this to a date object by typing >>>datetime.date.fromordinal(1168955503) Traceback (most recent call last): File "", line 1, in -toplevel- datetime.date.fromordinal(1168955503) ValueError: year is out of range How can I do the conversion? I'm trying to identify all files that were created after /MM/DD. For a quick sanity check, I ran >>> datetime.date.today().toordinal() 732693 which is orders of magnitude smaller than the number returned by os.path.getctime(fn). Thanks in advance for your help Thomas Philips -- http://mail.python.org/mailman/listinfo/python-list
cannot import libxml2 python module on windoze using activePerl or Python IDLE
guys, I have been using libxml2 with python with no problems for just over a week but now I come to see if my script will work in someone else's environment and the libxml2 import fails. I am using the python that comes with cygwin. When I try using ActivePython (2.3) or Python IDLE (2.5) there does not seem to be a libxml2 module there. I thought libxml2 was a std python module. But it would seem not. I need help tracking it down please. I am using windoze XP (not my choice). I am not sure how python packages get installed on windoze. I can't find a file libxml2.py for activePython etc so I cannot even begin an install. I presume python's libxml builds on the C libs libxml2.dll and iconv.dll so I have installed those into the python DLL directory. I think this will be needed at some point. Please can anyone help? Regards, Andrew Marlow -- There is an emerald here the size of a plover's egg! Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html Plain text mails only, please http://www.expita.com/nomime.html -- http://mail.python.org/mailman/listinfo/python-list
Re: how to write unicode to a txt file?
Frank Potter wrote: > I want to change an srt file to unicode format so mpalyer can display > Chinese subtitles properly. > I did it like this: > > txt=open('dmd-guardian-cd1.srt').read() > txt=unicode(txt,'gb18030') > open('dmd-guardian-cd1.srt','w').write(txt) > > But it seems that python can't directly write unicode to a file, > I got and error at the 3rd line: > UnicodeEncodeError: 'ascii' codec can't encode characters in position > 85-96: ordinal not in range(128) > > How to save the unicode string to the file, please? > Thanks! You have to tell Python what encoding to use (i. e how to translate the codepoints into bytes): >>> txt = u"ähnlicher als gewöhnlich üblich" >>> import codecs >>> codecs.open("tmp.txt", "w", "utf8").write(txt) >>> codecs.open("tmp.txt", "r", "utf8").read() u'\xe4hnlicher als gew\xf6hnlich \xfcblich' You would perhaps use 'gb18030' instead of 'utf8'. Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Web Frameworks
Shortash a écrit : > Hi Gurus, > > I want to build a Python web app but im not sure which one to go for. I > prefer something like asp.Net , which would allow me to fully seperate > the presentation layer from the logic. Please advise? Django, Turbogears, Pylons(HQ), web.py, etc, etc, etc... Welcome to Python, the language with more web frameworks than keywords !-) -- http://mail.python.org/mailman/listinfo/python-list
Re: how to write unicode to a txt file?
On 17 Jan 2007 08:28:14 -0800, Frank Potter <[EMAIL PROTECTED]> wrote: >I want to change an srt file to unicode format so mpalyer can display >Chinese subtitles properly. >I did it like this: > >txt=open('dmd-guardian-cd1.srt').read() >txt=unicode(txt,'gb18030') >open('dmd-guardian-cd1.srt','w').write(txt) > >But it seems that python can't directly write unicode to a file, >I got and error at the 3rd line: >UnicodeEncodeError: 'ascii' codec can't encode characters in position >85-96: ordinal not in range(128) > >How to save the unicode string to the file, please? You cannot save unicode to a file. Files can only contain bytes. You can encode the unicode into a str and then write the str to the file. f = open('...', 'w') f.write(txt.encode(encoding)) f.close() The encoding you select must be able to represent each code point in the unicode object you encode with it. The "ascii" encoding cannot encode all of your code points, so when Python implicitly uses it, you get the exception above. If you use an encoding like "utf-8" which can represent every code point, you won't see this exception. You could also use the same encoding which you used to decode the str originally, "gb18030", which will be able to represent every code point, since it produced them in the first place. Of course, if you do this, you may as well not even bother to do the decoding in the first place, unless you have some code in between the input and output steps which manipulates the unicode in some way. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list
Re: Globbing files by their creation date
On 17 Jan 2007 08:31:07 -0800, [EMAIL PROTECTED] wrote: > >Thanks a mill - os.path.getctime(f) is what I needed. Unfortunately, my >attempts to turn the integer it returns into a date have failed. > os.path.getctime(fn)#fn was created today, 1/17/2007 >1168955503 > >I tried to convert this to a date object by typing datetime.date.fromordinal(1168955503) > >Traceback (most recent call last): > File "", line 1, in -toplevel- >datetime.date.fromordinal(1168955503) >ValueError: year is out of range > >How can I do the conversion? I'm trying to identify all files that were >created after /MM/DD. > >For a quick sanity check, I ran datetime.date.today().toordinal() >732693 > >which is orders of magnitude smaller than the number returned by >os.path.getctime(fn). > >Thanks in advance for your help Ordinals are unrelated to the values given back by getctime. Try something like this instead: [EMAIL PROTECTED]:~$ python Python 2.4.3 (#2, Oct 6 2006, 07:52:30) [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> import datetime >>> datetime.date.fromtimestamp(os.path.getctime('.')) datetime.date(2007, 1, 17) >>> [EMAIL PROTECTED]:~$ ls -ld . drwxr-xr-x 93 exarkun exarkun 8192 2007-01-17 10:34 . [EMAIL PROTECTED]:~$ Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list
Re: 2.3-2.5 what improved?
billie a écrit : > robert wrote > >> Robin Becker wrote: >>> A large cgi based web Python-2.3 application needs to be speed improved. >>> experiments show the following under reasonable testing (these are 2 >>> second reportlab pdf productions) >>> >>> 1) 2.3 --> 2.5 improvement small 1-2% >>> 2) cgi --> fcgi improvement medium 10-12% >>> >>> I sort of remember claims being made about 2.5 being 10% faster than >>> 2.4/2.3 etc etc. Can anyone say where the speedups were? Presumably we >>> have a lot of old cruft that could be improved in some way eg moving >>> loops into comprehensions, using iterator methods etc. Are those sort of >>> things what we should look at? >> Python 2.5 became quite fat. For bare CGI the Python load/init >> time eats all improvements. Smaller scripts even loose lot of speed. >> I still like Python 2.3 for many other reasons for many >> applications - especially for CGI's, on Windows, for deployable >> apps, GUI's etc. because the fat coming with Python 2.4 is not >> balanced by necessary goods - mostly just fancy things. > > What do you mean? Fat of libraries or fat itself? > I tought that 2.5 was faster than precedent versions! :-\ > It is. But it takes a bit more time to launch the interpreter. Which is barely noticiable in most cases, but can be start to be a problem with CGI. -- http://mail.python.org/mailman/listinfo/python-list
Re: urrlib2 multithreading error
[EMAIL PROTECTED] wrote: > I'm using urllib2 to retrieve some data usign http in a multithreaded > application. > Here's a piece of code: > req = urllib2.Request(url, txdata, txheaders) > opener = urllib2.build_opener() > opener.addheaders = [('User-agent', user_agent)] > request = opener.open(req) > data = request.read(1024) > > I'm trying to read only the first 1024 bytes to retrieve http headers > (if is html then I will retrieve the entire page). Why so much bother? You just can create the Request, open it, and ask for the headers: >>> req = urllib2.Request("http://www.google.com.ar";) >>> u = urllib2.urlopen(req) >>> u.headers["content-type"] 'text/html' >>> Take into account that you can add the headers where you put "txheaders", it's not necessary to use "addheaders". And see that I'm not reading the page at all, urllib2.urlopen just retrieves the headers... Regards, -- . Facundo . Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/ -- http://mail.python.org/mailman/listinfo/python-list
Re: how to write unicode to a txt file?
Frank Potter wrote: > But it seems that python can't directly write unicode to a file, You need to use the method open from module codecs: >>> import codecs >>> a = codecs.open("pru_uni.txt", "w", "utf-8") >>> txt = unicode("campeón\n", "utf-8") >>> a.write(txt) >>> a.close() >>> So, then, from command line: [EMAIL PROTECTED]:~$ file pru_uni.txt pru_uni.txt: UTF-8 Unicode text :) Regards, -- . Facundo . Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/ -- http://mail.python.org/mailman/listinfo/python-list
predefined empty base class ??
Hi, is there an predefined empty base class which I can instanziate to have an container i can copy attributes in? -- http://mail.python.org/mailman/listinfo/python-list
Re: predefined empty base class ??
> is there an predefined empty base class > which I can instanziate to have an > container i can copy attributes in? No, but you can always do class Foo(object): pass foo = Foo() foo.attribute = value Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie: Capture traceback message to string?
On 17 Jan 2007 15:31:03 GMT, Thomas Guettler <[EMAIL PROTECTED]> wrote: > Sean Schertell wrote: > > > Hello! > > > > I'm new to Python and this is my first post to the list. > > > > I'm trying to simply capture exception text to a few strings which > > can be passed to a PSP page to display a pretty error message. The > > problem is that I just can't seem to figure out how to get the basic > > components of the traceback message into strings. Here's what I want > > to do: > > > > > # http://www.thomas-guettler.de/vortraege/python/beispiele.py.txt > def foo(): > raise("Das ist eine Exception") > try: > foo() > except: > import traceback > import cStringIO > (exc_type, exc_value, tb) = sys.exc_info() > exc_file = cStringIO.StringIO() > traceback.print_exception(exc_type, exc_value, tb, file=exc_file) > exc_string=exc_file.getvalue() > print exc_string > This is a lot of extra work. traceback.format_exc is much simpler. -- http://mail.python.org/mailman/listinfo/python-list
XLM prolgoue
How do I go about creating the XML prologue like I want it to be? Specifically, I am trying to add encoding and some namespace stuff. -- http://mail.python.org/mailman/listinfo/python-list
Re: predefined empty base class ??
iwl wrote: > Hi, > > is there an predefined empty base class > which I can instanziate to have an > container i can copy attributes in? > you are not the only one missing such class http://groups.google.com/group/comp.lang.python/msg/3ff946e7da13dba9 RFE SF #1637926 Robert -- http://mail.python.org/mailman/listinfo/python-list
Re: Distributed computation of jobs
Paul Boddie wrote: > A.T.Hofkamp skrev: >> Let me add a few cents to the discussion with this announcement: > > [Notes about exec_proxy, batchlib and rthread] > > I've added entries for these modules, along with py.execnet, to the > parallel processing solutions page on the python.org Wiki: > > http://wiki.python.org/moin/ParallelProcessing > > Thanks for describing your work to us! > > Paul > as many libs are restriced to certain OS'es, and/or need/rely on extension modules, few tags would probably improve: OS'es, pure-python, dependeniess Robert -- http://mail.python.org/mailman/listinfo/python-list
Re: *POLL* How many sheeple believe in the 911 fairy tale and willing to accept an Orwellian doublespeak and enslavement world ?
> ... buildings collapse all the time when you design to the cold-formed > strength rather than the hot-formed strength of a material, then heat > the material removing its tempered strength (which for steel occurs at > much lower than usual flame temeratures). Actually, modern steel frame buildings have never collapsed from kerosine fire. Besides there are SERIOUS anomalies indicative of thermate and explosives. Yellow hot molten metal were seen trickling down less than hour after the fires. Red hot molten metal pools were seen in the rubble weeks after the collapse. The building and their contents pulverized to dust from the brisance of very well planted and hidden explosives. I was not aware that Alqaeda has invisible man technology past the security cameras. > And what did this rant have to do with any of the sci.* or programming > newsgroups you posted it to? Your ignoramus is the exact reason why this has to be posted there. > David A. Smith And why did bldg 7 commit suicide. How was the boeing767 maneouvered so close to the ground into pentagon? Where is the DNA to confirm the identities of 19 in the fairy tale? Do you work for the story writing agency ? -- http://mail.python.org/mailman/listinfo/python-list
Re: *POLL* How many sheeple believe in the 911 fairy tale and willing to accept an Orwellian doublespeak and enslavement world ?
Please, none of the real facts points to anything else except what actually happened. Two planes hit two towers and they came down. -- http://mail.python.org/mailman/listinfo/python-list
Re: predefined empty base class ??
robert wrote: > iwl wrote: >> Hi, >> >> is there an predefined empty base class >> which I can instanziate to have an container i can copy attributes in? >> > > you are not the only one missing such class > > http://groups.google.com/group/comp.lang.python/msg/3ff946e7da13dba9 > > RFE SF #1637926 > ( and x=Exception();x.a=1 will do it preliminary ) Robert -- http://mail.python.org/mailman/listinfo/python-list
Re: *POLL* How many sheeple believe in the 911 fairy tale and willing to accept an Orwellian doublespeak and enslavement world ?
In article <[EMAIL PROTECTED]>, "Robert Hicks" <[EMAIL PROTECTED]> wrote: >Please, none of the real facts points to anything else except what >actually happened. Two planes hit two towers and they came down. > You're talking to the wind. This is a conspiracy precisely because people deny the crackpots. Denial of their "evidence" proves that there is a coverup. Logic is not involved, only belief that doesn't respond to dissenting evidence. -- http://mail.python.org/mailman/listinfo/python-list
RE: *POLL* How many sheeple believe in the 911 fairy tale and willingto accept an Orwellian doublespeak and enslavement world ?
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 17, 2007 10:23 AM > To: python-list@python.org > Subject: Re: *POLL* How many sheeple believe in the 911 fairy tale and > willingto accept an Orwellian doublespeak and enslavement world ? > > > > ... buildings collapse all the time when you design to the cold-formed > > strength rather than the hot-formed strength of a material, then heat > > the material removing its tempered strength (which for steel occurs at > > much lower than usual flame temeratures). > > Actually, modern steel frame buildings have never collapsed from > kerosine fire. > Besides there are SERIOUS anomalies indicative of thermate and > explosives. > Yellow hot molten metal were seen trickling down less than hour after > the fires. > Red hot molten metal pools were seen in the rubble weeks after the > collapse. > The building and their contents pulverized to dust from the brisance of > very well > planted and hidden explosives. I was not aware that Alqaeda has > invisible man > technology past the security cameras. > > > And what did this rant have to do with any of the sci.* or programming > > newsgroups you posted it to? > > Your ignoramus is the exact reason why this has to be posted there. > > > David A. Smith > > And why did bldg 7 commit suicide. How was the boeing767 maneouvered > so close to the ground into pentagon? > > Where is the DNA to confirm the identities of 19 in the fairy tale? > > Do you work for the story writing agency ? > Ladies and Gentlemen: PLEASE take this discussion to a more appropriate forum. There are many forums where people will be happy to debate this: physics, firefighting, metallurgy, geopolitics, etc. This forum is about the Python programming language. Let's keep it that way. Regards, Barry [EMAIL PROTECTED] 541-302-1107 We who cut mere stones must always be envisioning cathedrals. -Quarry worker's creed -- http://mail.python.org/mailman/listinfo/python-list
RE: *POLL* How many sheeple believe in the 911 fairy tale and willingto accept an Orwellian doublespeak and enslavement world ?
> -Original Message- > From: Robert Hicks [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 17, 2007 10:33 AM > To: python-list@python.org > Subject: Re: *POLL* How many sheeple believe in the 911 fairy tale and > willingto accept an Orwellian doublespeak and enslavement world ? > > Please, none of the real facts points to anything else except what > actually happened. Two planes hit two towers and they came down. > Ladies and Gentlemen: PLEASE take this discussion to a more appropriate forum. There are many forums where people will be happy to debate this: physics, firefighting, metallurgy, geopolitics, etc. This forum is about the Python programming language. Let's keep it that way. Regards, Barry [EMAIL PROTECTED] 541-302-1107 We who cut mere stones must always be envisioning cathedrals. -Quarry worker's creed -- http://mail.python.org/mailman/listinfo/python-list
Re: *POLL* How many sheeple believe in the 911 fairy tale and willingto accept an Orwellian doublespeak and enslavement world ?
> > Regards, > > Barry > [EMAIL PROTECTED] > 541-302-1107 > > We who cut mere stones must always be envisioning cathedrals. > > -Quarry worker's creed Sure, but did you actually post your phone number on USENET? Robert -- http://mail.python.org/mailman/listinfo/python-list
Re: question about module resolution
I put the lines you suggested in baz.py, but got an error: Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import baz Traceback (most recent call last): File "", line 1, in File "baz.py", line 3, in from .. import config ValueError: Attempted relative import in non-package On Jan 17, 11:20 am, Peter Otten <[EMAIL PROTECTED]> wrote: > Emin wrote: > > I often find myself wanting to have a child module get some parameters > > defined in a parent module. For example, imagine I have the following > > directory structure and want something in baz.py to look at a value in > > config.py. I end up putting in things like import sys; > > sys.path.append('../..'). Is there a better way? > > > foo/ > > __init__.py > > config.py > > bar/ > > __init__.py > > baz.pyfrom __future__ import absolute_import > from .. import config > > Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: Check a windows service
Thanks for all 'cause you've really helped me Just one thing in the last line for the specific service, you' ve writted : >print service but I think it is : >print service.Caption Tim Golden a écrit : > awel wrote: > > Sorry, but could you give me an example with a real service 'cause I've > > tried this script but nothings happened, no error, nothings ; even if I > > launch it in cmd prompt. > > Well, as that example said, it was designed to show > automatic services which are not running. If you don't > have any then nothing will show. I assumed you could > use this as a starting point. > > To list all services try this: > > > import wmi > > c = wmi.WMI () > for service in c.Win32_Service (): > print service.Caption > > > > To show a specific service: > > > import wmi > > c = wmi.WMI () > for service in c.Win32_Service (Caption="Task Scheduler"): > print service > > > > TJG -- http://mail.python.org/mailman/listinfo/python-list
Re: *POLL* How many sheeple believe in the 911 fairy tale and willing to accept an Orwellian doublespeak and enslavement world ?
Robert Hicks wrote: > Please, none of the real facts points to anything else except what > actually happened. Two planes hit two towers and they came down. The issue is the causality of the towers coming down. A magician pulls appears to cast a spell and out comes a rabbit out of his hat. There will always be fools who will accept this causality and others who know better the laws of conservation. -- http://mail.python.org/mailman/listinfo/python-list
Re: A note on heapq module
Antoon Pardon wrote: > For me, your class has the same drawback as the heappush, heappop > procedurers: no way to specify a comparision function. Agreed. I'd love to see something like ``Heap(key=my_key_func)``. STeVe -- http://mail.python.org/mailman/listinfo/python-list
Re: Making a simple script standalone
On Wednesday 17 January 2007 03:33, Gabriel Genellina wrote: > At Tuesday 16/1/2007 19:49, Rikishi 42 wrote: > >>What I want to do is to compile/bundle/prepare/whatever_term a simple >>Python script for deployment on a Windows machine. Installing Python >>itself on that machine, is not an option. Ideally I would like to obtain >>a single executable file, but a script+runtime is acceptable. > > distutils + py2exe Tried that, just after asking here. A bit messy (poor docs) and a very bloated result. Thanks for the answer, anyway. -- Research is what I'm doing, when I don't know what I'm doing. (von Braun) -- http://mail.python.org/mailman/listinfo/python-list
Re: Making a simple script standalone
On Wednesday 17 January 2007 00:22, James Stroud wrote: >> There is nothing graphical, nothing fancy about the script. >> The only imports are: os, stat, string and time. >> >> Any suggestions on an - easy and clear - path to follow ? > > > pyinstaller + innosetup. I will look into it, thanks! Hope it's not as heavy as with py2exe... -- Research is what I'm doing, when I don't know what I'm doing. (von Braun) -- http://mail.python.org/mailman/listinfo/python-list
Re: Making a simple script standalone
On Wednesday 17 January 2007 00:48, Larry Bates wrote: >> There is nothing graphical, nothing fancy about the script. >> The only imports are: os, stat, string and time. >> >> Any suggestions on an - easy and clear - path to follow ? > I use py2exe and inno installer. Works great. Thanks, I will look into it. Hope it's not as heavy as py2exe... -- Research is what I'm doing, when I don't know what I'm doing. (von Braun) -- http://mail.python.org/mailman/listinfo/python-list
Re: *POLL* How many sheeple believe in the 911 fairy tale and willing to accept an Orwellian doublespeak and enslavement world ?
David Bostwick wrote: > In article <[EMAIL PROTECTED]>, "Robert Hicks" <[EMAIL PROTECTED]> wrote: > >Please, none of the real facts points to anything else except what > >actually happened. Two planes hit two towers and they came down. > > > > You're talking to the wind. This is a conspiracy precisely because people > deny the crackpots. Denial of their "evidence" proves that there is a > coverup. Quite the contrary. A million dollar reward was posted to come with a consistent explanation of the SERIOUS anomalies involved on that day. Professor Steven Jones research on Thermate is an EYE OPENER. He is a BRILLIANT physicists. > Logic is not involved, only belief that doesn't respond to dissenting > evidence. Indeed, the 19 hijacker theory is a fairy tale based on illogical forensic investigation. As for dissent, Bush is on video record to utter, "Lets not tolerate any conspiracy theories." The video is floating on the internet for you to see if you had the IQ to search for it. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python-list Digest, Vol 40, Issue 215
How is it that when I try to send out a valid response to help someone with their python issue I get flagged, but this guy can send out something totally useless to the python community? -- Forwarded message -- From: [EMAIL PROTECTED] (David Bostwick) To: python-list@python.org Date: Wed, 17 Jan 2007 18:42:35 GMT Subject: Re: *POLL* How many sheeple believe in the 911 fairy tale and willing to accept an Orwellian doublespeak and enslavement world ? In article <[EMAIL PROTECTED]>, "Robert Hicks" <[EMAIL PROTECTED]> wrote: >Please, none of the real facts points to anything else except what >actually happened. Two planes hit two towers and they came down. > You're talking to the wind. This is a conspiracy precisely because people deny the crackpots. Denial of their "evidence" proves that there is a coverup. Logic is not involved, only belief that doesn't respond to dissenting evidence. -- Forwarded message -- From: "Carroll, Barry" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>, Date: Wed, 17 Jan 2007 10:50:20 -0800 Subject: RE: *POLL* How many sheeple believe in the 911 fairy tale and willingto accept an Orwellian doublespeak and enslavement world ? > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 17, 2007 10:23 AM > To: python-list@python.org > Subject: Re: *POLL* How many sheeple believe in the 911 fairy tale and > willingto accept an Orwellian doublespeak and enslavement world ? > > > > ... buildings collapse all the time when you design to the cold-formed > > strength rather than the hot-formed strength of a material, then heat > > the material removing its tempered strength (which for steel occurs at > > much lower than usual flame temeratures). > > Actually, modern steel frame buildings have never collapsed from > kerosine fire. > Besides there are SERIOUS anomalies indicative of thermate and > explosives. > Yellow hot molten metal were seen trickling down less than hour after > the fires. > Red hot molten metal pools were seen in the rubble weeks after the > collapse. > The building and their contents pulverized to dust from the brisance of > very well > planted and hidden explosives. I was not aware that Alqaeda has > invisible man > technology past the security cameras. > > > And what did this rant have to do with any of the sci.* or programming > > newsgroups you posted it to? > > Your ignoramus is the exact reason why this has to be posted there. > > > David A. Smith > > And why did bldg 7 commit suicide. How was the boeing767 maneouvered > so close to the ground into pentagon? > > Where is the DNA to confirm the identities of 19 in the fairy tale? > > Do you work for the story writing agency ? > Ladies and Gentlemen: PLEASE take this discussion to a more appropriate forum. There are many forums where people will be happy to debate this: physics, firefighting, metallurgy, geopolitics, etc. This forum is about the Python programming language. Let's keep it that way. Regards, Barry [EMAIL PROTECTED] 541-302-1107 We who cut mere stones must always be envisioning cathedrals. -Quarry worker's creed -- Forwarded message -- From: "Carroll, Barry" <[EMAIL PROTECTED]> To: "Robert Hicks" <[EMAIL PROTECTED]>, Date: Wed, 17 Jan 2007 10:53:06 -0800 Subject: RE: *POLL* How many sheeple believe in the 911 fairy tale and willingto accept an Orwellian doublespeak and enslavement world ? > -Original Message- > From: Robert Hicks [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 17, 2007 10:33 AM > To: python-list@python.org > Subject: Re: *POLL* How many sheeple believe in the 911 fairy tale and > willingto accept an Orwellian doublespeak and enslavement world ? > > Please, none of the real facts points to anything else except what > actually happened. Two planes hit two towers and they came down. > Ladies and Gentlemen: PLEASE take this discussion to a more appropriate forum. There are many forums where people will be happy to debate this: physics, firefighting, metallurgy, geopolitics, etc. This forum is about the Python programming language. Let's keep it that way. Regards, Barry [EMAIL PROTECTED] 541-302-1107 We who cut mere stones must always be envisioning cathedrals. -Quarry worker's creed -- Forwarded message -- From: "Robert Hicks" <[EMAIL PROTECTED]> To: python-list@python.org Date: 17 Jan 2007 10:54:54 -0800 Subject: Re: *POLL* How many sheeple believe in the 911 fairy tale and willingto accept an Orwellian doublespeak and enslavement world ? > > Regards, > > Barry > [EMAIL PROTECTED] > 541-302-1107 > > We who cut mere stones must always be envisioning cathedrals. > > -Quarry worker's creed Sure, but did you actually post your phone number on USENET? Robert -- Forwarded message -- From: "Emin" <[EMAIL PROTECTED]> To: python-list@pyth
RE: *POLL* How many sheeple believe in the 911 fairy tale and willingto accept an Orwellian doublespeak and enslavement world ?
> -Original Message- > From: David Bostwick [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 17, 2007 10:43 AM > To: python-list@python.org > Subject: Re: *POLL* How many sheeple believe in the 911 fairy tale and > willingto accept an Orwellian doublespeak and enslavement world ? > > In article <[EMAIL PROTECTED]>, "Robert > Hicks" <[EMAIL PROTECTED]> wrote: > >Please, none of the real facts points to anything else except what > >actually happened. Two planes hit two towers and they came down. > > > > You're talking to the wind. This is a conspiracy precisely because people > deny the crackpots. Denial of their "evidence" proves that there is a > coverup. Logic is not involved, only belief that doesn't respond to > dissenting evidence. Ladies and Gentlemen: PLEASE take this discussion to a more appropriate forum. There are many forums where people will be happy to debate this: physics, firefighting, metallurgy, geopolitics, etc. This forum is about the Python programming language. Let's keep it that way. Regards, Barry [EMAIL PROTECTED] 541-302-1107 We who cut mere stones must always be envisioning cathedrals. -Quarry worker's creed -- http://mail.python.org/mailman/listinfo/python-list
Re: *POLL* How many sheeple believe in the 911 fairy tale and willing to accept an Orwellian doublespeak and enslavement world ?
Robert Hicks wrote: > [EMAIL PROTECTED] wrote: > > Robert Hicks wrote: > > > Please, none of the real facts points to anything else except what > > > actually happened. Two planes hit two towers and they came down. > > > > The issue is the causality of the towers coming down. > > > > A magician pulls appears to cast a spell > > and out comes a rabbit out of his hat. There will always be fools who > > will accept this causality and others who know better the laws of > > conservation. > > This seems to debunk just about everything. > > http://www.popularmechanics.com/technology/military_law/1227842.html?page=1 > > However, your feeble mind is just not going to believe the facts. Actually, you are living in ancient times. Last year, there was a radio debate where the popular mechanics was in FULL retreat. THEY WROTE a fairy tale article for those devoid of critical thinking. Here is JUST ONE link for the sheeple to hear it with her own ear drum : http://digg.com/political_opinion/Popular_Mechanics_in_full_retreat_on_radio_talk_show_on_9_11_Conspiracy If the sheeple cares to google, she will find a lot more info. -- http://mail.python.org/mailman/listinfo/python-list
Re: XLM prolgoue
fscked wrote: > How do I go about creating the XML prologue like I want it to be? > Specifically, I am trying to add encoding and some namespace stuff. The XML declaration and the DTD that may appear in the prolog are optional. [22]prolog ::= XMLDecl? Misc* (doctypedecl Misc*)? [23]XMLDecl ::= '' If your encoding is UTF-8 (or ASCII ...) you don't need an XML declaration. Otherwise everything depends on the XML lib you use. For ElementTree, `tostring(elt, "ISO-8859-1")` for example will automatically include the right declaration at the beginning of your xml string ... There is no namespace information inside the prolog. Such "stuff" may appear inside the root element. Again, RTFM of your specific XML lib :) For ElementTree, see http://effbot.org/zone/element.htm#xml-namespaces Cheers, SB -- http://mail.python.org/mailman/listinfo/python-list
RE: *POLL* How many sheeple believe in the 911 fairy tale and willingto accept an Orwellian doublespeak and enslavement world ?
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 17, 2007 11:05 AM > To: python-list@python.org > Subject: Re: *POLL* How many sheeple believe in the 911 fairy tale and > willingto accept an Orwellian doublespeak and enslavement world ? > > > Robert Hicks wrote: > > Please, none of the real facts points to anything else except what > > actually happened. Two planes hit two towers and they came down. > > The issue is the causality of the towers coming down. > > A magician pulls appears to cast a spell > and out comes a rabbit out of his hat. There will always be fools who > will accept this causality and others who know better the laws of > conservation. > Ladies and Gentlemen: PLEASE take this discussion to a more appropriate forum. There are many forums where people will be happy to debate this: physics, firefighting, metallurgy, geopolitics, etc. This forum is about the Python programming language. Let's keep it that way. Regards, Barry [EMAIL PROTECTED] 541-302-1107 We who cut mere stones must always be envisioning cathedrals. -Quarry worker's creed -- http://mail.python.org/mailman/listinfo/python-list
RE: *POLL* How many sheeple believe in the 911 fairy tale and willingto accept an Orwellian doublespeak and enslavement world ?
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 17, 2007 11:12 AM > To: python-list@python.org > Subject: Re: *POLL* How many sheeple believe in the 911 fairy tale and > willingto accept an Orwellian doublespeak and enslavement world ? > > > David Bostwick wrote: > > In article <[EMAIL PROTECTED]>, > "Robert Hicks" <[EMAIL PROTECTED]> wrote: > > >Please, none of the real facts points to anything else except what > > >actually happened. Two planes hit two towers and they came down. > > > > > > > You're talking to the wind. This is a conspiracy precisely because > people > > deny the crackpots. Denial of their "evidence" proves that there is a > > coverup. > > Quite the contrary. A million dollar reward was posted to come with a > consistent > explanation of the SERIOUS anomalies involved on that day. Professor > Steven > Jones research on Thermate is an EYE OPENER. He is a BRILLIANT > physicists. > > > Logic is not involved, only belief that doesn't respond to dissenting > evidence. > > Indeed, the 19 hijacker theory is a fairy tale based on illogical > forensic investigation. > As for dissent, Bush is on video record to utter, "Lets not tolerate > any conspiracy theories." > The video is floating on the internet for you to see if you had the IQ > to search for it. > Ladies and Gentlemen: PLEASE take this discussion to a more appropriate forum. There are many forums where people will be happy to debate this: physics, firefighting, metallurgy, geopolitics, etc. This forum is about the Python programming language. Let's keep it that way. Regards, Barry [EMAIL PROTECTED] 541-302-1107 We who cut mere stones must always be envisioning cathedrals. -Quarry worker's creed -- http://mail.python.org/mailman/listinfo/python-list
Re: *POLL* How many sheeple believe in the 911 fairy tale and willing to accept an Orwellian doublespeak and enslavement world ?
Hix, look at links on this link/page for pop mech: http://mail.python.org/pipermail/python-list/2006-September/403442.html it has v v goood links [EMAIL PROTECTED] wrote: > Robert Hicks wrote: > > [EMAIL PROTECTED] wrote: > > > Robert Hicks wrote: > > > > Please, none of the real facts points to anything else except what > > > > actually happened. Two planes hit two towers and they came down. > > > > > > The issue is the causality of the towers coming down. > > > > > > A magician pulls appears to cast a spell > > > and out comes a rabbit out of his hat. There will always be fools who > > > will accept this causality and others who know better the laws of > > > conservation. > > > > This seems to debunk just about everything. > > > > http://www.popularmechanics.com/technology/military_law/1227842.html?page=1 > > > > However, your feeble mind is just not going to believe the facts. > > Actually, you are living in ancient times. Last year, there was a radio > debate where the popular mechanics was in FULL retreat. THEY WROTE a > fairy tale article for those devoid of critical thinking. > > Here is JUST ONE link for the sheeple to hear it with her own ear drum > : > > http://digg.com/political_opinion/Popular_Mechanics_in_full_retreat_on_radio_talk_show_on_9_11_Conspiracy > > If the sheeple cares to google, she will find a lot more info. -- http://mail.python.org/mailman/listinfo/python-list
Re: *POLL* How many sheeple believe in the 911 fairy tale and willing to accept an Orwellian doublespeak and enslavement world ?
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > >David Bostwick wrote: [...] >Indeed, the 19 hijacker theory is a fairy tale based on illogical >forensic investigation. >As for dissent, Bush is on video record to utter, "Lets not tolerate >any conspiracy theories." >The video is floating on the internet for you to see if you had the IQ >to search for it. > No, I think I'm smart enough to find it. I just don't care to waste time on crackpot theories. Good ad hominem, though - "You disagree with me, so you must be an idiot." Judging from where you posted this, you're the clueless one. -- http://mail.python.org/mailman/listinfo/python-list
Re: *POLL* How many sheeple believe in the 911 fairy tale and willing to accept an Orwellian doublespeak and enslavement world ?
David Bostwick wrote: > In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > > > >David Bostwick wrote: > > [...] > > >Indeed, the 19 hijacker theory is a fairy tale based on illogical > >forensic investigation. > >As for dissent, Bush is on video record to utter, "Lets not tolerate > >any conspiracy theories." > >The video is floating on the internet for you to see if you had the IQ > >to search for it. > > > > No, I think I'm smart enough to find it. I just don't care to waste time on > crackpot theories. Good ad hominem, though - "You disagree with me, so you > must be an idiot." Judging from where you posted this, you're the clueless > one. You dont have to waste any time. google seach is very fast. I already posted links for you. These are even videos so if you are challenged to read english prose, that wont be a handicap. -- http://mail.python.org/mailman/listinfo/python-list
Re: Conflicting needs for __init__ method
Chuck Rhode <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > > I recommend, instead, separate factory functions for separate > > input types. > > Uh, how 'bout separate subclasses for separate input types? The resulting object in each case would be the same type ('Rational'), with the same behaviour. Subclassing would make sense only if the resulting objects needed to have different behaviour in each case. -- \ "The power of accurate observation is frequently called | `\ cynicism by those who don't have it." -- George Bernard Shaw | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: XLM prolgoue
fscked schrieb: > How do I go about creating the XML prologue like I want it to be? print " % (version, encoding) Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I create a linked list in Python?
sturlamolden a écrit : > Bruno Desthuilliers wrote: > > >>Implementing linked lists in Python is not a great deal - it just >>doesn't make much sens. > > > It does make sence, Oh Yec ?-) sorry... > as there are memory constraints related to it. > Python lists are arrays under the hood. This is deliberately. Dynamic > arrays grows faster than lists for the common "short list" case, and > because indexing an array is O(1) instead of O(N) as it is for linked > lists. You can easily break the performance of Python lists by adding > objects in the middle of a list or appending objects to the end of long > lists. At some point the list can not grow larger by a simple realloc, > as it would crash with other objects on the heap, and the whole list > must be replaced by a brand new memory segment. That's certainly true - from a technical POV -, but I never had such a problem in now 7 years of Python programming. > Also linked lists are an interesting theoretical concept in computer > science. Understanding how dynamic datastructures work and their > limitations are a key to understanding algorithms and how computers > work in general. Indeed. Did I say otherwise ? > The simplest way of implementing a linked list in Python is nesting > Python lists. Have you considered using tuples ? If you go the FP way, why not use an immutable type ? (snip) > Those who know Lisp should be familiar with the concept of creating > dynamic data structures form nesting lists; it may be more unfamiliar > to C and Pascal programmers, as these languages do not support such > constructs. But how are Lisp lists implemented then ?-) I do totally agree that Lispish lists are something one should learn, but starting with a low-level procedural language with 'manual' memory management is certainly a Good Thing(tm). Well, IMHO at least (FWIW, having first learned to implement linked lists in C and Pascal, I had no problem understanding Lisp's list). > In Python one may also use a more explicit solution > involving classes for expressing linked lists, which would be more > familiar to C and Pascal programmers. In any case, making linked lists > are trivial in Python. > Yes again. Hence my remark... -- http://mail.python.org/mailman/listinfo/python-list
OT: Apology
Greetings: I've been trying to get the contributors to this thread to move their discussion to a more appropriate forum, but the unintended result has been more spam on this forum. My apologies to the regular readers of this newsgroup. This will be my last public post on this subject. I just hope the other posters will follow suit. Regards, Barry [EMAIL PROTECTED] 541-302-1107 We who cut mere stones must always be envisioning cathedrals. -Quarry worker's creed > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 17, 2007 12:24 PM > To: python-list@python.org > Subject: Re: *POLL* How many sheeple believe in the 911 fairy tale and > willingto accept an Orwellian doublespeak and enslavement world ? > > > David Bostwick wrote: > > In article <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] wrote: > > > > > >David Bostwick wrote: > > > > [...] > > > > >Indeed, the 19 hijacker theory is a fairy tale based on illogical > > >forensic investigation. > > >As for dissent, Bush is on video record to utter, "Lets not tolerate > > >any conspiracy theories." > > >The video is floating on the internet for you to see if you had the IQ > > >to search for it. > > > > > > > No, I think I'm smart enough to find it. I just don't care to waste > time on > > crackpot theories. Good ad hominem, though - "You disagree with me, so > you > > must be an idiot." Judging from where you posted this, you're the > clueless > > one. > > You dont have to waste any time. google seach is very fast. I already > posted links for you. These are even videos so if you are challenged > to read english prose, that wont be a handicap. > -- http://mail.python.org/mailman/listinfo/python-list
Re: *POLL* How many sheeple believe in the 911 fairy tale and willing to accept an Orwellian doublespeak and enslavement world ?
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] ... Please explain what 911 conspiracy theories have to do with the Python computer language? If this is to be taken seriously, why is it being cross-posted to sci.math, sci.physics, sci.chem, sci.optics, and comp.lang.python? Such blatant disregard for newsgroup etiquette will surely reflect poorly on the poster's credibility. I can only draw the conclusion that he is either a troll or very ignorant of what is acceptable. Carl G. -- http://mail.python.org/mailman/listinfo/python-list