Re: Htmllib help

2007-07-09 Thread Gabriel Genellina
y. Look at the HTMLParser module too; depending on your needs, it may be easier to use. > -- Original message ------ > From: "Gabriel Genellina" <[EMAIL PROTECTED]> >> En Thu, 05 Jul 2007 20:23:08 -0300, <[EMAIL PROTECTED]> escribió:

Re: Is there a way to program a robot with python (ex, an electric motor, control it's speed, etc)

2007-07-09 Thread Gabriel Genellina
cordingly. Picasso: a Python-controlled robot for doing paintings http://youtube.com/watch?v=PsbKq5Kysj0 -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Portable general timestamp format, not 2038-limited

2007-07-09 Thread Gabriel Genellina
d by common horse carts at the time. (Some people goes beyond that and say it was the same width as used in the Roman empire but this may be just a practical coincidence, no causality being involved). -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: The file executing

2007-07-09 Thread Gabriel Genellina
program because __file__ may contain a relative path (and will give a wrong result after changing the current directory). -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Broken MUA interactions (was: Restarting a Python Application)

2007-07-09 Thread Gabriel Genellina
list support, thats fine. But > it's hardly incorrect to configure it with the reply-to set to the > list, either. No, it's not correct to modify Reply-To. Some reasons: http://www.unicom.com/pw/reply-to-harmful.html -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: TypeError: can't multiply sequence to non-int

2007-07-09 Thread Gabriel Genellina
quot;abc" * 5 (gives "abcabcabcabcabc") [1,2,3] * 8 (gives a list with 24 numbers) (4,"z") * 2 (gives (4,"z",4,"z")) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: execute script in certain directory

2007-07-09 Thread Gabriel Genellina
.abspath(__file__)) # when opening the file f = open(os.path.join(dat_path, "filename.dat")) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: execute script in certain directory

2007-07-09 Thread Gabriel Genellina
you mean. The short answer is: don't place standalone scripts inside a package; see this thread: http://groups.google.com/group/comp.lang.python/browse_thread/thread/c44c769a72ca69fa/ -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Error when trying to write unicode xml to zipfile

2007-07-09 Thread Gabriel Genellina
estr('content.xml', content.toxml().encode('utf-8')) In general, when working with unicode, it's best to decode bytes into unicode as early as possible (when reading input), process only unicode inside the program, and encode into bytes at the last step (when writing

Re: Portable general timestamp format, not 2038-limited

2007-07-10 Thread Gabriel Genellina
ard but not as wide as the original GWR. Now most of the passenger lines are defunct and cargo lines trend to use narrow gauge = 1000mm so the proportion may be much smaller now. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: path backslash escaping trouble

2007-07-10 Thread Gabriel Genellina
ctly 3 characters, the second being a single backslash. The \ is the escape character; to include an actual \ inside a string, you have to double it. Another way is to use raw string literals (supressing escape processing): r"a\\b" contains four characters. See section 3.1.2 in the P

Re: Transfer folders to ftp

2007-07-10 Thread Gabriel Genellina
ogram, but i want to make this in python. Good luck! -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing Help

2007-07-10 Thread Gabriel Genellina
if value[:2]=="0x": return int(value, 16) else: return int(value) Using lxml <http://codespeak.net/lxml/> you could use XPath notation to simplify the navigation a little. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: serializing datetime object

2007-07-10 Thread Gabriel Genellina
En Tue, 10 Jul 2007 13:13:54 -0300, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribió: > I want to serialize datetime.datetime.now() object . I could convert it > to > string but how do I get a datetime object back from the string? > Any suggestions? Use the pickle mo

Re: SafeConfigParser can set unsafe values

2007-07-10 Thread Gabriel Genellina
really. If all % were escaped automatically, there is no way to write a templatized value. Maybe SafeConfigParser.set should grow an escape argument, controlling whether one wants the value escaped or not. For compatibility reasons should default to False, for usability reasons should default to True. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: storing pickles in sql data base

2007-07-10 Thread Gabriel Genellina
olumns might be converted or reencoded in some way, binary data should never be modified in any way. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: 2**2**2**2**2 wrong? Bug?

2007-07-11 Thread Gabriel Genellina
to the problem "Which is the largest number that can be written with only 3 digits?" Some people stop at 999, others try 99**9 and 9**99, and the winner is 9**9**9, or: | 9 | 9 | 9 Sorry, couldn't resist. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: binascii.unhexlify ... not clear about usage, and output

2007-07-11 Thread Gabriel Genellina
En Wed, 11 Jul 2007 17:34:04 -0300, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribió: > If only there was a built-in base 2 conversion. No builtin, but you can find uncountable versions if you search this group, or the Python cookbook, or the entire web... -- Gabriel Genellina

Re: atexit, sys.exit, sys.exitfunc, reaching end of source code

2007-07-12 Thread Gabriel Genellina
mExit: py> help(sys) Help on built-in module sys: [...] excepthook -- called to handle any uncaught exception other than SystemExit Unfortunately help(sys.excepthook) does not provide the same information, neither the docs for the sys module. (Should be corrected...) -- Gabr

Re: 2**2**2**2**2 wrong? Bug?

2007-07-12 Thread Gabriel Genellina
En Thu, 12 Jul 2007 07:30:05 -0300, Nick Craig-Wood <[EMAIL PROTECTED]> escribió: > Gabriel Genellina <[EMAIL PROTECTED]> wrote: >> En Wed, 11 Jul 2007 16:39:17 -0300, Paul McGuire <[EMAIL PROTECTED]> >> escribió: >> >> > As was >> > po

Re: storing pickles in sql data base

2007-07-12 Thread Gabriel Genellina
s. You have to write and read the "text" >> files in binary mode or they break if taken across platform boundaries >> because of the different line endings in Linux and Windows for instance. >> > > It's fine as long as you use universal line endings mode.

Re: 2**2**2**2**2 wrong? Bug?

2007-07-12 Thread Gabriel Genellina
En Thu, 12 Jul 2007 09:30:34 -0300, Ben Finney <[EMAIL PROTECTED]> escribió: > "Gabriel Genellina" <[EMAIL PROTECTED]> writes: > >> "Which is the largest number that can be written with only 3 >> digits?" Some people stop at 999, others

Re: MaildirMessage

2007-07-12 Thread Gabriel Genellina
to use the sequence protocol, starting at 0; that is, tries to get msg[0]. Message objects support the mapping protocol, and msg[0] tries to find a *header* 0, converting the name 0 to lowercase, and fails miserably. Try with: for msg in mbox: print msg or read the MaildirMessage (and Message) docs to see the ways you can handle it. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: diferent answers with isalpha()

2007-07-12 Thread Gabriel Genellina
ot;LATIN SMALL LETTER A WITH ACUTE"; if not, Python thinks your terminal uses a different encoding than the actual one. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: inspite of proper package structure, no module named xyz error.

2007-07-12 Thread Gabriel Genellina
27;m not convinced this is absolutely the right way to do things, but at least it's less bug prone. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Understanding python functions - Instant Python tutorial

2007-07-12 Thread Gabriel Genellina
ts contents and properties. Modifying an object is not the same as rebinding its name: x = [1,2,3] y = x x[1] = 4 print x # [1, 4, 3] print y # [1, 4, 3] x = [1,2,3] y = x x = [1,4,3] print x # [1, 4, 3] print y # [1, 2, 3] You can test is two names refer to the same object using the is operator: x is y. You will get True in the first case and False in the second case. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Circular import problem

2007-07-12 Thread Gabriel Genellina
have to assume that the error is being generated by some other > modules loading in the grooves.py stuff ... but really have no idea. > > Is there anything I can do to trace though this and get it working > properly? See http://effbot.org/zone/import-confusion.htm Try to move the circular references later in the code (maybe inside a function, when it is required), or much better, refactor it so there is no circularity. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting values out of a CSV

2007-07-12 Thread Gabriel Genellina
ist(csv.reader(open('some.csv', 'rb'))) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Understanding python functions - Instant Python tutorial

2007-07-13 Thread Gabriel Genellina
ntinue learning Python. I think you will like it in the near future. But for someone coming from the microcontroller world, used to think closely in terms of the implementation, this may be a big paradigm shift. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: MaildirMessage

2007-07-13 Thread Gabriel Genellina
message should mean iterating over its headers... Anyway, if you want to iterate over all the message headers, the simplest way is using msg.keys() -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: permission denied in shutil.copyfile

2007-07-13 Thread Gabriel Genellina
7; 3) shutil.copyfile copies ONE FILE at a time. 4) use glob.glob to find the desired set of files to be copied; and perhaps you'll find copy2 more convenient. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting values out of a CSV

2007-07-13 Thread Gabriel Genellina
40.7 msec per loop (Generating less values shows larger differences - anyway they're not terrific) So, as always, one should measure in each specific case if optimization is worth the pain - and if csv files are involved I'd say the critical points are elsewhere, not on how one creates the list of rows. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Function parameter type safety?

2007-07-13 Thread Gabriel Genellina
Directorio de C:\TEMP 14/07/2007 00:13 4 output.bin 1 archivos 4 bytes 0 dirs 18.806.763.520 bytes libres "strings" are "strings of bytes" in Python. (If you are mostly concerned with characters, use unicode objects). -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Circular import problem

2007-07-13 Thread Gabriel Genellina
e is >> no >> circularity. >> >> -- >> Gabriel Genellina > > Yes, thanks. I'd read that page before posting. Helpful. > > But, I still don't understand how python can access a function in a > file I have NOT included. In this case, to get

Re: Can I change one line in a file without rewriting the whole thing?

2007-07-13 Thread Gabriel Genellina
ot;,"w").writelines(lines) This of course reads the whole file in memory, but it's a compact way if you require random line access. If you can serialize the file operations, try using the fileinput module with inplace=1. (Having a true Tie::File implementation for Python would be a

Re: MaildirMessage

2007-07-14 Thread Gabriel Genellina
e application's code clean and unified. I don't see what you mean. You can always enumerate the message headers using msg.keys(), along with has_key(), items(), etc. And what you want to unify the code with? Even if Message becomes iterable, I still don't see why should

Re: defaultdicts pickling

2007-07-14 Thread Gabriel Genellina
o significance) (b) I don't consider a one-line function so much ugly, but ugliness is subjective, so I won't comment further. > Is there another way of achieving the same behaviour, that allow for > pickling? If you insist: Convert the defaultdict into a plain dict before pickling

Re: Circular import problem

2007-07-14 Thread Gabriel Genellina
module is the recommended practice. See http://www.python.org/dev/peps/pep-0008/ I try only to import locally: a) when it is slow and not always needed, and b) when the imported module is unrelated to the main purpose (e.g. import traceback inside some exception handlers). -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Marshalling big objects

2007-07-14 Thread Gabriel Genellina
serializer, use pickle (or cPickle) instead. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Dict Help

2007-07-15 Thread Gabriel Genellina
et) # add a pair key, value d[key].add(value) The existence check and remove method do not change. Dicts, lists and sets are documented here: <http://docs.python.org/lib/types.html> and defaultdict <http://docs.python.org/lib/defaultdict-objects.html> -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Circular import problem

2007-07-15 Thread Gabriel Genellina
ge has an empty __init__.py, or does not import grooves itself) The OP was asking why the second form worked fine for him for a while, but stopped working after reordering some imports. And the answer (according to "Greg") is: some other module imported MMA.grooves, and that put grooves into MMA namespace, available for everyone else. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: How to determine which method was used in an inheritance heirarchy?

2007-07-16 Thread Gabriel Genellina
.f_lineno). Later, obtaining the class name from those is a bit tricky (and not even the inspect module does it right), but perhaps using the tokenizer module, watching for lines that contain "class" is enough. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Access Object From 2 Applications or Fix Scheduler

2007-07-16 Thread Gabriel Genellina
ne is available parse it itself. Is > that > something you've heard of? See this (the first solution works on any platform; others are Windows specific) <http://tgolden.sc.sabren.com/python/win32_how_do_i/watch_directory_for_changes.html> or try Google with those keywords.

Python-URL! - weekly Python news and links (Jul 16)

2007-07-16 Thread Gabriel Genellina
QOTW: "That's a property of open source projects. Features nobody really needs are not implemented." - Gregor Horvath http://groups.google.com/group/comp.lang.python/msg/1fcefd79c7aa4832 "I'm working in a Java shop, with eclipse - one of the most intimate IDE-lanaguage-relationships imaginabl

Re: Re-raising exceptions with modified message

2007-07-16 Thread Gabriel Genellina
; py> try: ... x = u"á".encode("ascii") ... except Exception,e: ... e.args += ("Sorry",) ... raise ... Traceback (most recent call last): File "", line 2, in UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 0: ordinal not in range(128) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Discover instance variables

2007-07-16 Thread Gabriel Genellina
.py") py> get_attributes(f) ['mode', 'name', 'softspace'] The list keeps only the types explicitely enumerated. Other types are excluded, as well as names starting with "_". Another criterion would be `not attr.startswith('_') and not callable(getattr(obj,attr))` -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: The ** operator ambiguous?

2007-07-16 Thread Gabriel Genellina
ed in the documentation but > I couldn't find anything. See this section in the tutorial <http://docs.python.org/tut/node6.html#SECTION00670>. If you want the dirty details: <http://docs.python.org/ref/calls.html> -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: shutil.copyfile problem for GIS data

2007-07-16 Thread Gabriel Genellina
til > import os > > src = "c:\mydata\test\mygeo.mdb" > dst = "v:\updated\data\mygeo.mdb" Here you have another problem: \t inside a string means the TAB character. You have to escape all backslashes or use a raw string: that is, either use "c:\\myd

Re: how to find available classes in a file ?

2007-07-16 Thread Gabriel Genellina
7;t hurt. > I also heard of the inspect module, but I haven't checked it yet. inspect.getmembers(the_module, inspect.isclass) would do. But this requires the module to be importable. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: how to find available classes in a file ?

2007-07-17 Thread Gabriel Genellina
En Tue, 17 Jul 2007 11:05:17 -0300, Alex Popescu <[EMAIL PROTECTED]> escribió: > On Jul 17, 4:41 am, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: >> > On Jul 17, 1:44 am, Stef Mientki <[EMAIL PROTECTED]> >> > wrote: >> >>

Re: Compatibility of python2.5 with pytohn2.3

2007-07-20 Thread Gabriel Genellina
families could go mostly unnoticed, as nothing bad would happen). Regarding Python source files, their encoding declaration is now mandatory when they contains any non ascii string. (Reviewing the "What's new" documents would be a good idea anyway) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: exec and CodeObjects

2007-07-20 Thread Gabriel Genellina
=', str(p) > exec f1.func_code > THIS RESULTS IN: "this is nf1" WHICH IS NICE > exec f2.func_code > THIS RESULTS IN: TypeError: f2() takes exactly 1 argument (0 given) > WHICH IS EXPECTED Instead of using exec, rebuild a new function from the unmarshalled code: i

Re: [2.5] Regex doesn't support MULTILINE?

2007-07-22 Thread Gabriel Genellina
quot;.+" (even the non greedy forms); in this case, I think you want the scan to stop when it reaches the ending or any other tag, so use: [^<]* instead. BTW, better to use a raw string to represent the pattern: pattern = r"...\d+..." -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: simpleJSON pack binary data

2007-07-22 Thread Gabriel Genellina
into an array of numbers. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: pycurl problem

2007-04-18 Thread Gabriel Genellina
ne them as described before pycurl raises the TypeError Python -with its long "batteries included" tradition- comes with two powerful tools for diagnosing problems: print and repr print "c.url", type(c.url), repr(c.url) print "c.proxy", type(c.proxy), repr(c.pro

Re: Installing Python on NT

2007-04-18 Thread Gabriel Genellina
En Wed, 18 Apr 2007 18:09:03 -0300, Schwartz, Hillary <[EMAIL PROTECTED]> escribió: ? -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: converting currency using locals

2007-04-18 Thread Gabriel Genellina
takes the current locale into account. Grouping is applied if the third parameter is true. py> locale.format('%.2f', 1234567.1234, True) '1.234.567,12' -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Feature Request: Explicit variable declarations

2007-04-20 Thread Gabriel Genellina
31...? C/C++ == 1 most of the time (being C of any integer type, of course - for arbitrary instances, see the always missing documentation). -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: comparison with None

2007-04-20 Thread Gabriel Genellina
ve the same type. If both are numbers, they are converted to a common type. Otherwise, objects of different types always compare unequal, and are ordered consistently but arbitrarily." (Apart from the latter not menctioning string types too, looks good to me). -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Do other Python GUI toolkits require this?

2007-04-20 Thread Gabriel Genellina
oms. How much Python can be put in a nutshell? Almost nothing, so for me, the famous book starts diminished from the title. Or, I would not consider "sleepping tight" a good thing, I prefer big and comfortable beds... This is getting close to win the "longest off topic thread" award. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: service for file monitoring

2007-04-20 Thread Gabriel Genellina
file system. For windows you can use the techniques described here: http://tgolden.sc.sabren.com/python/win32_how_do_i/watch_directory_for_changes.html -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-20 Thread Gabriel Genellina
revision And that's before the earliest tagged release I could find on svn, Python 0.98 -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: When to clear a dictionary...

2007-04-20 Thread Gabriel Genellina
call and most of the work is done in C code; the second does the iteration in Python code and is about 4x slower. > python -m timeit -s "b=dict.fromkeys(range(1));a={}" "a.update(b)" 100 loops, best of 3: 10.2 msec per loop > python -m timeit -s "b=dict.fromkeys(range(1));a={}" "for key in b: > a[key]=b[key]" 10 loops, best of 3: 39.6 msec per loop -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: getting from command line options to file

2007-04-20 Thread Gabriel Genellina
ut=outfile) >> -- >> Michael Hoffman > > > but what if i have python which is 2.4?? Omit the with statement: import subprocess outfile = open("test.out", "w") try: subprocess.check_call(["ls", "/etc"], stdout=outfile) finally: outfile.close() -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Significance of "start" parameter to string method "endswith"

2007-04-20 Thread Gabriel Genellina
gt;>> >>> p = 0 >>> while text: >>> p = text.find('parrot', p) >>> do_something_with(buffer, p) >>> >>> which avoids copying text unnecessarily. >> >> ... but increases the care and attention required w

Re: how to transfer integer on socket?

2007-04-20 Thread Gabriel Genellina
nd_integer(socket_s,a) socket_s.send(chr(a)) > and receive like this: > a=receive_integer(socket_s) a = ord(socket_s.recv(1)) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: comparison with None

2007-04-20 Thread Gabriel Genellina
En Fri, 20 Apr 2007 23:48:02 -0300, Alex Martelli <[EMAIL PROTECTED]> escribió: > Gabriel Genellina <[EMAIL PROTECTED]> wrote: > >> Reference Manual, 5.9 Comparisons >> >> "The objects need not have the same type. If both are numbers, they are >> co

Re: lambda generator - curious behavior in 2.5

2007-04-21 Thread Gabriel Genellina
xt() > 777 > >>> x.next() > 888 > >>> x.next() > > Traceback (most recent call last): >File "", line 1, in > x.next() > StopIteration > >>> This time, the ((tuple) and None) is like saying "discard the tuple and return None instead", and that fires the usual StopIteration. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Class Not Auto-Init On Import

2007-04-21 Thread Gabriel Genellina
e? Should i not just be able to access the setIP() > method > by doing LocationService.setIP('192.168.1.1') Without having to create my > own inited reference? Not enough info, without knowing how LocationService is supposed to be used. But as I said, the setIP call looks suspicious. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: how to find the OS name..??

2007-04-21 Thread Gabriel Genellina
En Sat, 21 Apr 2007 08:13:10 -0300, pradeep nair <[EMAIL PROTECTED]> escribió: > How do i determine the type of OS i'm working on using python??(i.e > whether CentOS,Fedora,SLES,...along with the version) os.uname() If you need more detailed information try the platform mo

Re: serializable object references

2007-04-22 Thread Gabriel Genellina
ithout further information, this would be the way. What do you want to achieve? Maybe you are looking for the pickle module. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Vector classes

2007-04-22 Thread Gabriel Genellina
or something. You should try the other suggested classes, but if I had to choose among these two, I'd use the first. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: serializable object references

2007-04-22 Thread Gabriel Genellina
> would want to do. You can have a "persistent" state (stored in a backend database) and "transitory" state (kept in session objects). -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Support for new items in set type

2007-04-23 Thread Gabriel Genellina
AT__, hdr) > return t > > is now taking > 13s when it was taking less than 0.8s before! (same > number of calls, nothing changed except the set implementation) I don't see where your SeaSet class is used. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Select weirdness

2007-04-23 Thread Gabriel Genellina
e predefined server classes). -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionaries and dot notation

2007-04-23 Thread Gabriel Genellina
em. > > I was mistaken to believe that I had to know about attributes at the > time of class creation. But your expample does not require that. Should > have read this more carefully. Welcome to Python and its dynamic nature! -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: serializable object references

2007-04-23 Thread Gabriel Genellina
En Mon, 23 Apr 2007 03:35:42 -0300, Martin Drautzburg <[EMAIL PROTECTED]> escribió: > Gabriel Genellina wrote: > >> En Sun, 22 Apr 2007 12:47:10 -0300, Martin Drautzburg >> <[EMAIL PROTECTED]> escribió: >> >>> I was thinking that it would be nic

Re: Two syntax questions (newbie)

2007-04-23 Thread Gabriel Genellina
t of the program and make > variables local to it? Python does not have block scope; use a function instead. (It's hard to define block scopes without variable declarations). Anyway that would make any difference if you are using huge structures. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: redirect ouput

2007-04-23 Thread Gabriel Genellina
> file. Using two separate files? out1 = open("output1.txt", "w") out2 = open("output2.txt", "w") ... if some_condition: out1.write(...) else: out2.write(...) ... out1.close() out2.close() (If that's not what you want, I may have misundertstood

Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-23 Thread Gabriel Genellina
time having arrays as their ONLY structured type, so having a built in dictionary is not just an optimization, it's a luxury! :) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Redirection problem

2007-04-23 Thread Gabriel Genellina
. You could do this: logfile = open("", "a+) logfile.write("Command: %s\n" % cmd) pipe = os.popen(cmd) for line in pipe: logfile.write(line) pipe.close() logfile.close() Or try the subprocess module. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: script for seconds in given month?

2007-04-23 Thread Gabriel Genellina
thon. When trying to import calendar in IronPython, I > get: > > SyntaxError: future feature is not defined: with_statement (c: > \Python25\Lib\calendar.py, line 8) You could download and use the calendar.py from the 2.4 installation. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting python script to write to input box on another window

2007-04-24 Thread Gabriel Genellina
uld use pyWinAuto on Windows. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Catching a specific IO error

2007-04-24 Thread Gabriel Genellina
2]"? You can get the 2 as the errno exception attribute. BTW, 2 == errno.ENOENT try: export = open(self.exportFileName , 'w') except IOError, e: if e.errno==errno.ENOENT: # handle the "No such file or di

Re: kwarg references

2007-04-25 Thread Gabriel Genellina
e docs, on a function call like this: def foo(**kwargs): pass d = {'a':1, 'b':2) foo(**d) Python could bind the existing d object to the formal parameter kwargs and still comply with the documented behavior. Some of my own code would break if that happened... :( -- Gab

Re: override settrace

2007-04-25 Thread Gabriel Genellina
cution > of the program and output a simplified "call graph" to standard out. > Please help me in this regard. Maybe you find easier to use one of the existing profiling tools: http://docs.python.org/lib/profile.html -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: random.py

2007-04-26 Thread Gabriel Genellina
ecause there is not a "version 3" (yet). Let's say, in the future, there is a version 3; the code could become: if version == 3: # new code to handle version 3 data elif version == 2: # code to handle version 2 data # this is the current contents else: # error mess

Re: If Dict Contains a particular key

2007-04-26 Thread Gabriel Genellina
tionary for a key like follows. > > It would be useful if there was some direct way to get the value > associated with a key, and None if there's not one. Such wonderful method exists since immemorial ages -at least since Python 1.5- and its magic name is "get":

Re: Access to raw command line?

2007-04-26 Thread Gabriel Genellina
belong to > the "-t" switch and which are arguments (other than using the > extension). I can't verify right now, but I think that using -t "*.gpx" would avoid the shell expansion. (Or perhaps '*.gpx' or \*.gpx or even -t*.gpx) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Dedicated CPU core for Python?

2007-04-26 Thread Gabriel Genellina
ms that have a POSIX thread (a.k.a. ``pthread'') implementation." -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Python CGI and Browser timeout

2007-04-26 Thread Gabriel Genellina
etects that processing is complete, redirect to another page showing the final results. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: what python technology for my app?

2007-04-27 Thread Gabriel Genellina
OP methodology with a whole myriad of frameworks, orm's and > object > factories. For a small in-house application, U$S 6000 per server (Coldfusion MX 7 Enterprise) or even U$S 1300 (Standard Edition) might be too much, depending on the OP budget... -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory addressing

2007-04-27 Thread Gabriel Genellina
On 27 abr, 20:07, [EMAIL PROTECTED] wrote: > That's what we need: a CopyMemory() routine. See the copy and pickle modules. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Cgi File Upload without Form

2007-04-27 Thread Gabriel Genellina
with SOAP/WSDL and I > believe that would be more difficult than necessary. The client > program I have to use does not support FTP. I don't understand your question. Do you control the server, the client, or both? Which one is in Python? -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Dedicated CPU core for Python?

2007-04-28 Thread Gabriel Genellina
Joshua J. Kugler ha escrito: > On Thursday 26 April 2007 14:07, Gabriel Genellina wrote: > > > En Thu, 26 Apr 2007 15:54:38 -0300, Joshua J. Kugler > > <[EMAIL PROTECTED]> escribió: > >> CPython only > >> uses one > >> CPU core right no

Re: python function in pipe

2007-04-28 Thread Gabriel Genellina
ode, adding a FILE parameter (let's call it logfile) and replacing every printf("...", xxx) with fprintf(logfile, "...", xxx); the same for related functions. Yet another way, and perhaps the easiest and less intrusive on the C code, would be to use freopen to repla

Re: How to pass in argument to timeit.Timer

2007-04-28 Thread Gabriel Genellina
n you please tell me how to fix it? i get this error: They go in the "setup" parameter, like this: t1 = timeit.Timer("callFunc(line, i)","from __main__ import callFunc; line=%r; i=%d" % (line, i)) If it gets much longer, try this: setup = ""&q

Re: Beginner Ping program

2007-04-29 Thread Gabriel Genellina
and DOS ping programs have(never >> stop, change size, change timeout). > > IIRC, MS ping has no "never stop", you can only say "repeat 9 > times". ping -t hostname -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: exclusive shelve open

2007-04-29 Thread Gabriel Genellina
odule to lock/unlock the file. Locking just the first byte is enough. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: I can't inherit from "compiled" classes ?

2007-04-29 Thread Gabriel Genellina
quot;" ? Those things inside () are called "base classes"; this is "class" inheritance; you create a new "class" inheriting from existing ones. That is, you cant inherit from select, because select is a function, not a class. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

<    5   6   7   8   9   10   11   12   13   14   >