Re: Why does list have no 'get' method?

2008-02-07 Thread Thomas Bellman
Scheme? If so, then no, in Scheme only #f is false, and the empty list () is considered true. -- Thomas Bellman, Lysator Computer Club, Linköping University, Sweden "When C++ is your hammer, everything ! bellman @ lysator.liu.se looks like a thumb."

psycopg2: connect copy_from and copy_to

2008-02-19 Thread Thomas Guettler
could be done with threading, but I try to avoid threads. Since the script will run only on Unix, I could use pipes. But this would fail, too, since copy_to() would block before I can call copy_from (since buffer is full and no one is reading the data from the pipe). Any suggestions? Thomas

Re: psycopg2: connect copy_from and copy_to

2008-02-19 Thread Thomas Guettler
ipt locks a table, so that psql can't write to it. I don't think calling pg_dump and psql/pg_restore is faster. > prod_cursor.execute('select data from production') > for each_record in cursor.fetchall(): > dev_cursor.execute('insert into testing') I know,

Re: psycopg2: connect copy_from and copy_to

2008-02-20 Thread Thomas Guettler
[EMAIL PROTECTED] schrieb: > On Feb 19, 8:06 am, Thomas Guettler <[EMAIL PROTECTED]> wrote: >> Any suggestions? > > If you don't mind trying out some beta quality software, you can try > my pg_proboscis driver. It has a DBAPI2 interface, but for you to use &

Re: network programming: how does s.accept() work?

2008-02-25 Thread Thomas Bellman
be more or less random, but it will make sure that the four-tuple identifying the TCP connection will be unique. -- Thomas Bellman, Lysator Computer Club, Linköping University, Sweden "There are many causes worth dying for, but ! bellman @ lysator.liu.se none worth killing for.&

Re: Web site for comparing languages syntax

2008-02-26 Thread Thomas Guettler
a, but it's good: http://pleac.sourceforge.net/ The Perl Cookbook gets translated to several other languages. -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list

Re: Why this ref leak?

2008-02-27 Thread Thomas Heller
ys.gettotalrefcount() > > >> 21366 > >> 21387 > >> 21408 > [9779 refs] > > Both Python 2.4 and 2.5 don't clean up properly here. Why is this? > Aren't classes supposed to be garbage-collected? > > -- Gerhard Replace "foo()" with "foo(); gc.collect()" and the refcounts are stable. Tested the python 2.6 from trunk. Thomas -- http://mail.python.org/mailman/listinfo/python-list

ANN: Resolver One 1.0.1

2008-03-04 Thread Giles Thomas
ownload it from our website (free registration required): <http://www.resolversystems.com/get-it/> Regards, Giles Giles Thomas MD & CTO, Resolver Systems Ltd. [EMAIL PROTECTED] +44 (0) 20 7253 6372 Try out Resolver One! <http://www.resolversystems.com/get-it/> (Free registration

Re: Python-list Digest, Vol 54, Issue 199

2008-03-15 Thread Thomas Boland
what the? why can this get through? [EMAIL PROTECTED] wrote: > Send Python-list mailing list submissions to > [email protected] > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/python-list > or, via email, send a message with

Re: app runs fine with interpreter, but not under py2exe

2008-03-16 Thread Thomas Heller
ry so that they include the package name. This prevents name conflicts. I have created installers and uploaded them (for testing!) to the starship: http://starship.python.net/crew/theller/py2exe-0.6.7.win32-py2.3.exe http://starship.python.net/crew/theller/py2exe-0.6.7.win32-py2.4.exe http

Re: comtypes question

2008-03-17 Thread Thomas Heller
uot;", line 1, in File "comtypes\__init__.py", line 308, in __getitem__ result = self.Item(index) _ctypes.COMError: (-2147220992, None, (u'The item at position 0 was not found.', u'bartend', None, 0, None)) >>> msg[1] >>> m = msg[1] >

wxPython graphics query (newbie)

2008-03-17 Thread Thomas G
thing under mouse ('current') to new position ''' newx = event.x newy = event.y canv.coords('current', newx, newy) makeFrame(root) root.mainloop() Many thanks in advance -- Thomas Green -- http://mail.python.org/mailman/listinfo/python-list

Re: py2exe socket.gaierror (10093)

2008-03-26 Thread Thomas Heller
riel. > > I have made sure the script works fine before I exe it. > It is when I compile the program I get this error. > > I don't get how the compile changes server availability. > Could it be a firewall issue? Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: simple web-server

2008-03-28 Thread Thomas Guettler
hat CGIHTTPServer can't do a redirect. (HTTP code 302). I whish that there was a simple and small (not twisted) webserver written in Python which can be used in production. But I think there is none. Thomas BTW, use subprocess and not os.system() if you need to call other executables. >

read a password protected xls file

2009-01-12 Thread thomas . steffen75
Hello, how can I read (and parse) a password protected xls file, perhaps with the package xlrd? Thanks for your hints, Thomas -- http://mail.python.org/mailman/listinfo/python-list

the name of a method

2009-01-15 Thread thomas . steffen75
I print the name of the class with self.__class__.__name__ in __init__. I want to print also in every method of myClass the name of the method. How can I get the name? I would not like to write e.g. "myMethod". Is there a variable like self.__class__.__name__ for this? Thanks for your

Start multiple listening servers in one file

2009-01-16 Thread Thomas W
I`m working on a django-project where I`m using the awsome pyftpdlib for ftpserver-functionality. I also have a simple worker deamon running in the background, but not listening to any port. How can I start all of these processes on one file? Tried using subprocess and popen but that resulted in an

Re: Need help with os.system in linux

2009-01-17 Thread Thomas Bellman
erface for running external commands. For example, you can avoid having to deal with quoting shell metacharacters, and interpreting the return values are easier. -- Thomas Bellman, Lysator Computer Club, Linköping University, Sweden "Life IS pain, highness. Anyone who tells

python for flash drives

2009-01-20 Thread Thomas Lord
try portable python. it's free! http://www.portablepython.com/ -- http://mail.python.org/mailman/listinfo/python-list

Start Python at client side from web app

2009-01-21 Thread Thomas Guettler
refer to use some open source project, if it exists. Thanks in advance, Thomas Güttler -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list

Re: Start Python at client side from web app

2009-01-21 Thread Thomas Guettler
pp. 2. Webserver sends signed python code to the client with own mime type 3. IE sends code to the python application. 4. Signature gets checked, Python code on the client gets executed. 5. Maybe send some data to the server with http. Thomas Server runs Linux with Django and Postgres. Thomas Gue

Re: Start Python at client side from web app

2009-01-22 Thread Thomas Guettler
Bryan Olson schrieb: > Thomas Guettler wrote: >> Sorry, I described my problem not well. Here is more information: > > Actually you did pretty well. > > [...] >> The main application is the intranet web application used with IE (ms >> windows client). > >

Re: Start Python at client side from web app

2009-01-22 Thread Thomas Guettler
guess that's not very easy, since I am not used to windows programming. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list

Re: Start Python at client side from web app

2009-01-22 Thread Thomas Guettler
Paul Rubin schrieb: > Thomas Guettler writes: >> 1. The user pushes a button in the web app. >> 2. Webserver sends signed python code to the client with own mime type >> 3. IE sends code to the python application. >> 4. Signature gets checked, Python code on the client

Re: py2exe + SQLite problem

2009-01-31 Thread Thomas Heller
;bm/b2.gif']), ('config', ['cfg/data.cfg']), ('/etc/init.d', ['init-script'])] ) """ So, it looks like you should use > setup(windows=['dpconf.py'], > data_files=[("", ["proj_db","gsd_db","dachs2.xbm"])] ^ ^ > ) Thomas -- http://mail.python.org/mailman/listinfo/python-list

Resolver One 1.4 beta - with IronPython 2.0 and numpy

2009-02-03 Thread Giles Thomas
<http://www.resolversystems.com/screencasts/numpy/> We're releasing the beta tomorrow: this has a few performance problems but is otherwise functionally complete. If you're interested in trying it out, drop me a line. Best regards, Giles -- Giles Thomas MD & CTO, Resolv

RE: Distributing simple tasks

2009-02-06 Thread Thomas Raef
Hi, Suppose I have an array of functions which I execute in threads (each thread get a slice of the array, iterates over it and executes each function in it's slice one after the other). Now I want to distribute these tasks between two machines, i.e give each machine half of the slices and let

Re: py2exe and distutils

2009-02-07 Thread Thomas Heller
on25\lib\pydoc.py", line 1803, in listmodules ModuleScanner().run(callback) File "c:\python25\lib\pydoc.py", line 1854, in run for importer, modname, ispkg in pkgutil.walk_packages(): File "c:\python25\lib\pkgutil.py", line 125, in walk_packages for item in w

Re: py2exe and distutils

2009-02-07 Thread Thomas Heller
> Maxim Demenko schrieb: >> Hi, >> i have installed Python 2.5.4 on WinXP, setuptools-0.6c9 and py2exe 0.6.9 >> Now i can't list installed modules, here is the stacktrace: [...] >> Any suggestion, how to fix this issue? > Thomas Heller schrieb: > Looks like a

Re: Convert date/time to unix timestamp?

2009-02-10 Thread Thomas Kraus
onverts it to an integer. int(time.mktime(time.localtime())) -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Easier to wrap C or C++ libraries?

2009-02-15 Thread Thomas Heller
: clock_t, time_t, struct tm Do you think that would have helped for writing cross-platform wrappers? Thomas -- http://mail.python.org/mailman/listinfo/python-list

"Maximum recursion depth exceeded"...why?

2009-02-17 Thread Thomas Allen
I must not be understanding something. This is a simple recursive function that prints all HTML files in argv[1] as its scans the directory's contents. Why do I get a RuntimeError for recursion depth exceeded? #!/usr/bin/env python import os, sys def main(): absToRel(sys.argv[1], sys.argv[2]

Re: "Maximum recursion depth exceeded"...why?

2009-02-17 Thread Thomas Allen
On Feb 17, 4:46 pm, Thomas Allen wrote: > I must not be understanding something. This is a simple recursive > function that prints all HTML files in argv[1] as its scans the > directory's contents. Why do I get a RuntimeError for recursion depth > exceeded? > > #!/usr/bin/e

Re: "Maximum recursion depth exceeded"...why?

2009-02-17 Thread Thomas Allen
On Feb 17, 5:31 pm, Peter Otten <[email protected]> wrote: > Thomas Allen wrote: > > I must not be understanding something. This is a simple recursive > > function that prints all HTML files in argv[1] as its scans the > > directory's contents. Why do I get a

Re: "Maximum recursion depth exceeded"...why?

2009-02-17 Thread Thomas Allen
On Feb 17, 6:05 pm, Peter Otten <[email protected]> wrote: > Thomas Allen wrote: > > On Feb 17, 5:31 pm, Peter Otten <[email protected]> wrote: > >> Thomas Allen wrote: > >> > I must not be understanding something. This is a simple recursive > >>

Re: "Maximum recursion depth exceeded"...why?

2009-02-17 Thread Thomas Allen
On Feb 17, 7:05 pm, Christian Heimes wrote: > Thomas Allen wrote: > > I'm referring to the same code, but with a print: > > > for file in os.listdir(dir): > >     if os.path.isdir(file): > >         print "D", file > > > in place of th

Re: "Maximum recursion depth exceeded"...why?

2009-02-17 Thread Thomas Allen
On Feb 17, 9:08 pm, Christian Heimes wrote: > Thomas Allen wrote: > > If you'd read the messages in this thread you'd understand why I'm not > > using os.walk(): I'm not using it because I need my code to be aware > > of the current recursion dept

Re: "Maximum recursion depth exceeded"...why?

2009-02-18 Thread Thomas Allen
On Feb 18, 4:51 am, alex23 wrote: > On Feb 18, 7:34 pm, [email protected] wrote: > > > Yeah, but wget -r -k will do that bit of it, too. > > Wow, nice, I don't know why I never noticed that. Cheers! Hm...doesn't do that over here. I thought it may have been because of absolute links (not to s

Re: "Maximum recursion depth exceeded"...why?

2009-02-19 Thread Thomas Allen
On Feb 18, 10:15 pm, [email protected] wrote: > Thomas Allen wrote: > > On Feb 18, 4:51 am, alex23 wrote: > > > On Feb 18, 7:34 pm, [email protected] wrote: > > > > > Yeah, but wget -r -k will do that bit of it, too. > > > > Wow, nice,

FTP libs for Python?

2009-02-20 Thread Thomas Allen
I'm interested in writing a script to ease deployment of minor changes on some websites here, and it would involve some SFTP transfers. Do you know of good alternatives to ftplib, which is relatively low- level? Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: FTP libs for Python?

2009-02-20 Thread Thomas Allen
ople recommending, as SSH utils are required as well Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Using dictionary to hold regex patterns?

2008-11-23 Thread Thomas Mlynarczyk
John Machin schrieb: General tip: Don't us a data structure that is more complicated than what you need. Is "[ ( name, regex ), ... ]" really "simpler" than "{ name: regex, ... }"? Intuitively, I would consider the dictionary to be the simpler structure.

Re: Security implications of using open() on untrusted strings.

2008-11-24 Thread Thomas Bellman
s one thing to let the user overwrite a file named "foo; rm -rf $HOME", quite another to pass that string unquoted to /bin/sh when the user thought he was just typing a filename.) -- Thomas Bellman, Lysator Computer Club, Linköping University, Sweden "I don't think [tha

ANN: Resolver One 1.3 released

2008-11-24 Thread Giles Thomas
ae with column-level formulae to do interesting stuff: <http://www.resolversystems.com/screencasts/column-formulae/> Resolver One is free for non-commercial use, so if you would like to take a look, you can download it from our website: Best regards, Giles -- Giles Thomas MD & CTO, Resolver

Re: Using dictionary to hold regex patterns?

2008-11-24 Thread Thomas Mlynarczyk
So as soon as I start retrieving a regex by its name, the dict will be the most suitable structure? Greetings, Thomas -- Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison! (Coluche) -- http://mail.python.org/mailman/listinfo/python-list

Re: My first Python program -- a lexer

2008-11-24 Thread Thomas Mlynarczyk
constant time? If you have *both* requirements simultaneously, then *both* list and dict are indicated. So I would have to duplicate my data and store it once in a list, once in a dict? Or should I decide for one way and accept that one type of access will not be optimal? Greetings, Thomas

Re: Using dictionary to hold regex patterns?

2008-11-24 Thread Thomas Mlynarczyk
details of those data structures in Python. (As it was suggested earlier in my lexer thread.) Greetings, Thomas -- Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison! (Coluche) -- http://mail.python.org/mailman/listinfo/python-list

Re: Using dictionary to hold regex patterns?

2008-11-25 Thread Thomas Mlynarczyk
t in your lexer, you weren't using the mapping functionality of a dict at all. In both cases you have perplexed bystanders asking "Why use a plane/dict when a car/list will do the job?". Now the matter is getting clearer in my head. Thanks and greetings, Thomas -- Ce n'e

Re: Checking if an int fits in 32 bits?

2008-12-04 Thread Thomas Heller
ent issues) in the Python code? Or is > there some cleaner way to do this? > You could try something like this: import ctypes def int_fits_in_32bit(value): return ctypes.c_int32(value) == value and similar for signed/unsigned short/int/long. Packing and unpacking with the struct module, however, does basically the same. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes and misaligned doubles

2008-12-11 Thread Thomas Heller
t use padding. > Is there a way to change the alignment of a ctypes type without > recompiling the whole ctypes package? If I can't change it, is there a > way to define my own type based on c_double but with a different > alignment? No. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: New Book: Programming in Python 3

2008-12-19 Thread Thomas Heller
s" ^ "and also teaches Python’s functional programming features" ^ "The book’s approach is wholly practical" ^ Curious, Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: New Book: Programming in Python 3

2008-12-19 Thread Thomas Heller
Steve Holden schrieb: > Thomas Heller wrote: >> Question from a non-native english speaker: is this now valid english? >> >> "One of Python’s great strengths" >> ^ >> "and also teaches Python’s functional programming features&

Threads, forks, multiplexing - oh my

2008-12-21 Thread Thomas Raef
ltiplexing? Please help me clarify and if possible give me some direction for this. Thank you in advance. Thomas J. Raef www.ebasedsecurity.com www.wewatchyourwebsite.com "We Watch Your Website because - you don't" -- http://mail.python.org/mailman/listinfo/python-list

Re: Any equivalent to Ruby's 'hpricot' html/xpath/css selector package?

2008-12-29 Thread Mark Thomas
On Dec 28, 6:22 pm, Kenneth McDonald wrote: > Ruby has a package called 'hpricot' which can perform limited xpath   > queries, and CSS selector queries. However, what makes it really   > useful is that it does a good job of handling the "broken" html that   > is so commonly found on the web. Does

Re: Any equivalent to Ruby's 'hpricot' html/xpath/css selector package?

2008-12-30 Thread Mark Thomas
On Dec 30, 8:20 am, Stefan Behnel wrote: > Mark Thomas wrote: > > The main difference is that lxml doesn't have CSS selector syntax > > Feel free to read the docs: > > http://codespeak.net/lxml/cssselect.html Don't know how I missed that... So lxml is pretty m

Re: Extending Python with C or C++

2009-01-07 Thread Thomas Heller
g the ctypes inbuilt types > > c_int32 > c_uint32 IMO this would be difficult to achive automatically. There are cases wher c_int is the correct type, in other cases c_int32 is correct. > Also I don't think c_char * 0 does anything sensible in ctypes, > c_byte * 0 is what is required plus a bit of casting. This is a > non-standard GNU extension to C though. > > All that said though, it looks like a great time saver. > Thanks, Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: What would you like to see in a book about Matplotlib?

2009-01-07 Thread Thomas Guettler
anted to see grouped up but couldn't find? The API is not good documented. It was very hard for me to understand what was going on the source. > - what would you like to see in a book about matplotlib? How to use the API. Thomas -- Thomas Guettler, http://www.thomas-guettler.de

Re: eval('07') works, eval('08') fails, why?

2009-01-08 Thread Thomas Guettler
Hi, 07 is octal. That's way 08 is invalid. Try this: ===> python >>> print 011 9 >>> print int('011') 11 -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list

Force exception on attribute write access only one object

2009-01-08 Thread Thomas Guettler
now where. -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending Python with C or C++

2009-01-08 Thread Thomas Heller
Nick Craig-Wood schrieb: > Thomas Heller wrote: >> Nick Craig-Wood schrieb: >> > Interesting - I didn't know about h2xml and xml2py before and I've >> > done lots of ctypes wrapping! Something to help with the initial >> > drudge work of c

Re: Force exception on attribute write access only one object

2009-01-09 Thread Thomas Guettler
"/localhome/modw/django/forms/models.py", line 315, in save if self.instance.pk is None: File "/localhome/modw/django/db/models/base.py", line 292, in _get_pk_val return getattr(self, meta.pk.attname) AttributeError: 'MyAction' object has no attribute

Re: subprocess.Popen(..., cwd=...) and Makefile $(PWD) don't play nice

2008-10-07 Thread Thomas Bellman
find the Makefile at /tmp/p if the current > directory were another one... (?) The problem is, he is not printing the name of the current working directory; he is printing the value of the variable $PWD. That is likely set from the environment by the shell he started the Python program from,

Re: how to get the thighest bit position in big integers?

2008-10-07 Thread Thomas Heller
NumBits method. This > would give an O(1) solution. > > Mark Here is ctypes code that works (tested with Python 2.5): from ctypes import * _PyLong_NumBits = pythonapi._PyLong_NumBits _PyLong_NumBits.argtypes = py_object, _PyLong_NumBits.restype = c_int for i in range(64): x = 1 << i print i, _PyLong_NumBits(long(x)) Thomas -- http://mail.python.org/mailman/listinfo/python-list

no unbound methods in py3k

2008-10-08 Thread Thomas Heller
ethod...) Thanks, Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: no unbound methods in py3k

2008-10-09 Thread Thomas Heller
Christian Heimes schrieb: > Thomas Heller wrote: >> but this is very ugly, imo. Is there another way? >> The raw_func instances that I have are not descriptors (they >> do not implement a __get__() method...) > > I've written PyInstanceMethod_Type for this use c

python 3: sorting with a comparison function

2008-10-09 Thread Thomas Heller
Does Python 3 have no way anymore to sort with a comparison function? Both [].sort() and sorted() seem to accept only 'key' and 'reverse' arguments, the 'cmp' argument seems to be gone. Can that be? Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: no unbound methods in py3k

2008-10-09 Thread Thomas Heller
Terry Reedy schrieb: > Thomas Heller wrote: >> Christian Heimes schrieb: >>> I've written PyInstanceMethod_Type for this use case. It's not (yet) >>> available for Python code.>> Oh, wait - there's ctypes: >> >> Python 3.0rc1 (r30rc1

Re: no unbound methods in py3k

2008-10-09 Thread Thomas Heller
Christian Heimes schrieb: > Thomas Heller wrote: >> Ok, so one has to write an extension to access or expose it. >> >> Oh, wait - there's ctypes: > > I wrote the type to help the Pyrex and Cython developers to port their > software to 3.0. I planed t

Re: python 3: sorting with a comparison function

2008-10-10 Thread Thomas Heller
> Thomas Heller wrote: >> Does Python 3 have no way anymore to sort with a comparison function? >> >> Both [].sort() and sorted() seem to accept only 'key' and 'reverse' >> arguments, >> the 'cmp' argument seems to be gone. Can that

Re: python 3: sorting with a comparison function

2008-10-10 Thread Thomas Heller
. But I think that a clear example how to use the 'key=' parameter in the sort() and sorted() method/function is badly needed. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: subprocess.Popen(..., cwd=...) and Makefile $(PWD) don't play nice

2008-10-14 Thread Thomas Bellman
(not all!) shells. It should not be trusted outside those shells, and hardly inside them either. -- Thomas Bellman, Lysator Computer Club, Linköping University, Sweden "Adde parvum parvo magnus acervus erit" ! bellman @ lysator.liu.se (From The Mythic

Re: 2.6, 3.0, and truly independent intepreters

2008-10-22 Thread Thomas Heller
le to potentially cause > no end of pain in a multiple interpreter environment! Yikes! I don't think this is the case (currently). But you could submit patches to Python so that at least the 'official' modules (builtin and extensions) would behave corectly in the case of multiple

Re: Passing a memory address (pointer) to an extension?

2008-10-22 Thread Thomas Heller
id *, but > assuming that a long is big enough to store a void * is a shaky > assumption. I could use a long long (technically still risky, but > practically probably OK) but I'm not sure how widespread long longs are. I suggest "O!" and a converter function calling

Re: Python Imaging Library Question

2008-10-23 Thread Thomas Guettler
ay to overload the Ghostcript function in the > EpsImagePlugin.py file or to overload the plugin or to write a custom > plugin without interfering with the PIL? > The question hopefully seems trivial to a python programmer.. Hi, you can call gs yourself with e.g. the module subprocess. Th

Re: parse a table in HTML page.

2008-10-28 Thread Thomas Guettler
y > > It works fine aside from link in href. > > Example: > > String to parse: > elognormal text > > Output: > [[['elog', 'normal text']]] > > as you can see it misses the info about href... > how can get this information 'vaff

urlencode() doseq and Python 3.0

2008-10-30 Thread Thomas Guettler
t really wants this: >>> urllib.urlencode({'key': ['value1', 'value2']}) 'key=%5B%27value1%27%2C+%27value2%27%5D' I think this is what most people want: >>> urllib.urlencode({'key': ['value1', 'value2']}, doseq

Re: Which PostgreSQL adapter to use?

2008-11-04 Thread Thomas Guettler
Hussein B schrieb: > Hey, > Which Adapter to use with PostgreSQL: > PyPgSQL, psycopg or PyGreSQL? > Thanks. I think psycopg2 is a good choice. Never tried anything else. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler

Can read() be non-blocking?

2008-11-06 Thread Thomas Christensen
in generel to handle this situation? Thanks Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending Logger

2008-11-06 Thread Thomas Christensen
nstantiated by applications which need to use custom logger behavior. Thomas -- http://mail.python.org/mailman/listinfo/python-list

My first Python program -- a lexer

2008-11-08 Thread Thomas Mlynarczyk
:%s]\t[%s]\t'%s'" % ( str( line ), str( match.pos ), name, match.group(0) ) for name, match, line in self.result ] ) # Test Example source = r""" Name: "Thomas", # just a comment Age: 37 """

Re: My first Python program -- a lexer

2008-11-09 Thread Thomas Mlynarczyk
urn "\n".join( [ "[L:%s]\t[O:%s]\t[%s]\t'%s'" % For avoidance of ambiguity, you may like to change that '%s' to %r In which way would there be ambiguity? The first two are integers, the last two strings. Thanks for your feedback. Greetings, Thom

Re: My first Python program -- a lexer

2008-11-09 Thread Thomas Mlynarczyk
f regex matchings would be reduced: Only that which is expected is "tried out". But otherwise, upon reflection, I think you are right and it would indeed be more appropriate to do as you suggest. Thanks for your feedback. Greetings, Thomas -- Ce n'est pas parce qu'ils son

Re: My first Python program -- a lexer

2008-11-10 Thread Thomas Mlynarczyk
his. Thank you for the suggestion. Greetings, Thomas -- Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison! (Coluche) -- http://mail.python.org/mailman/listinfo/python-list

Re: My first Python program -- a lexer

2008-11-10 Thread Thomas Mlynarczyk
paces?), use %r. (Just having modified my code accordingly:) Ah, yes, indeed, that is much better! General advice: What you think you see is often not what you've actually got. repr() is your friend; use it. Lesson learned :-) Greetings, Thomas -- Ce n'est pas parce qu'

Re: My first Python program -- a lexer

2008-11-10 Thread Thomas Mlynarczyk
was thinking of something like this. As long as the line/column are only needed in case of an error (i.e. at most once per script run), I consider this more performant than keeping track of line/column for every token. Greetings, Thomas -- Ce n'est pas parce qu'ils sont nombreux

Re: My first Python program -- a lexer

2008-11-10 Thread Thomas Mlynarczyk
Paul McGuire schrieb: Just be sure to account for tabs when computing the column, which this simple-minded algorithm does not do. Another thing I had not thought of -- thanks for the hint. Greetings, Thomas -- Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont r

Re: My first Python program -- a lexer

2008-11-09 Thread Thomas Mlynarczyk
quot;.join( [ "[L:%s]\t[O:%s]\t[%s]\t'%s'" % The first 3 are %s, the last one is '%s' I only put the single quotes so I could better "see" whitespace in the output. Anyway, this method is just to be able to check if the lexer does what it's

Re: My first Python program -- a lexer

2008-11-10 Thread Thomas Mlynarczyk
is like using a truck for transporting a single sheet of paper? Greetings, Thomas -- Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison! (Coluche) -- http://mail.python.org/mailman/listinfo/python-list

Re: My first Python program -- a lexer

2008-11-11 Thread Thomas Mlynarczyk
do that. But then, as a beginner, I might be underestimating Python. Greetings, Thomas -- Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison! (Coluche) -- http://mail.python.org/mailman/listinfo/python-list

Re: sorting list of complex numbers

2008-11-11 Thread Thomas Bellman
ython-coded function at all. The operator module is your friend: key=operator.attrgetter('real', 'imag') will create the required tuples for sorting. -- Thomas Bellman, Lysator Computer Club, Linköping University, Sweden "God is real, but Jesus is

Re: My first Python program -- a lexer

2008-11-12 Thread Thomas Mlynarczyk
opportunity, because the ordering is determined by the implementation and not by your data structure. True. Still, I should be able to gain even better performance with my above approach using a next() function, as this would completely eliminate all "useless" matching (like trying to

Generators and their next() and send() methods

2008-11-15 Thread Thomas Mlynarczyk
way() function. Any comments and/or suggestions? Greetings, Thomas -- Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison! (Coluche) -- http://mail.python.org/mailman/listinfo/python-list

Re: Generators and their next() and send() methods

2008-11-16 Thread Thomas Mlynarczyk
this is just an exercise -- it doesn't look as if it's worth using @mayway in any "real" code just to be able to write g.next(42) instead of g.send(42). Still, I would like to know why it was decided to introduce a send() method instead of allowing an argument for next(). Thanks

Re: Generators and their next() and send() methods

2008-11-18 Thread Thomas Mlynarczyk
semantics would not have changed, they would only be "extended" and thus remain "compatible", wouldn't they? Greetings, Thomas -- Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison! (Coluche) -- http://mail.python.org/mailman/listinfo/python-list

Re: Generators and their next() and send() methods

2008-11-18 Thread Thomas Mlynarczyk
Aaron Brady schrieb: And, if you don't intend to use 'myway' on 'listiterator's and such, 'send( None )' is equivalent to 'next( )'. I didn't know that. But doesn't that impose a restriction somehow? It makes it impossible to send a No

Re: C extension type gives type error in power operator

2008-11-20 Thread Thomas Heller
uctures). I normally look into the newest python reference manual, even if I'm programming for older versions. But sometimes you have to took into the header files, too. Thomas -- http://mail.python.org/mailman/listinfo/python-list

OT: handling multiple software repositories

2009-02-26 Thread Thomas Guettler
have several repositories and need to handle this somehow. How do you do this? I want a common wiki and a common bug tracker. It should be possible to attach a bug to several repositories. Up to now I don't use Trac, if someone has an alternative, please tell me! Thomas [1]

Re: OT: handling multiple software repositories

2009-02-27 Thread Thomas Guettler
t. But the page looks like it is not ready for public. But it looks promising. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list

RE: Email Program

2009-02-28 Thread Thomas Raef
What a great response. > -Original Message- > From: [email protected] > [mailto:[email protected]] On > Behalf Of MRAB > Sent: Saturday, February 28, 2009 8:00 PM > To: [email protected] > Subject: Re: Email P

RE: Email Program

2009-03-01 Thread Thomas Raef
t; To: [email protected] > Subject: Re: Email Program > > Thomas Raef wrote: > > What a great response. > > It's a correct, straight forward and short answer to the op's question. > > Christian > > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list

<    20   21   22   23   24   25   26   27   28   29   >