Re: bool constructor is inconsistent?

2010-09-10 Thread Stefan Schwarzer
g: ... to execute some code if the string is not empty. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: How to Convert IO Stream to XML Document

2010-09-10 Thread Stefan Behnel
a look at xml.etree.ElementTree. Depending on what you want to do with the XML result, it'll likely be easier to use and faster than minidom. The function there is called fromstring(), just in case ;) Stefan -- http://mail.python.org/mailman/listinfo/python-list

Design: Module interface vs. library interface

2010-09-11 Thread Stefan Schwarzer
approach would you prefer and why? Or some other approach? Would you use a different approach if the library-internal class was named `_FTPFile` instead of `FTPFile`? [1] http://ftputil.sschwarzer.net [2] http://ftputil.sschwarzer.net/trac/browser/ftp_file.py Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: fast kdtree tree implementation for python 3?

2010-09-11 Thread Stefan Behnel
e standard library. Since you're looking for an implementation, I guess you won't be the one volunteering to maintain such code in the stdlib, would you? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: sequence multiplied by -1

2010-09-25 Thread Stefan Schwarzer
r would be to > raise an exception, though one could argue that there are practical benefits > for the operation to succeed for any integer operand. I agree with raising an exception, probably a ValueError. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: sequence multiplied by -1

2010-09-25 Thread Stefan Schwarzer
tor by -1, you should get a vector > in the reversed direction. But, intuitiveness depends > on who you are, what you do, etc Sure ... in math, multiplying a vector by -1 gives a vector with all its elements negated: -1 * [1, 2, 3] -> [-1, -2, -3] :-) Stefan -- http://mail.

Re: sequence multiplied by -1

2010-09-25 Thread Stefan Schwarzer
ersed(L) Traceback (most recent call last): File "", line 1, in TypeError: unsupported operand type(s) for *: 'int' and 'list_reverseiterator' You can convert the result of `reversed` to a list though: >>> 3 * list(reversed(L)) [3, 2, 1, 3, 2, 1, 3, 2, 1] Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: creating python daemon ?

2010-09-26 Thread Stefan Schwarzer
rective using Pipe i.e if I use CustomLog '|/var//script.py' Are the _four_ ws intentional? > combined, what script reads is just the file name, how and why I am > not able to figure it out. And thats the reason I am here. I hope > you've got what I am trying to do. Do you have a line for the interpreter at the top of your script, like #!/usr/bin/python Is the script executable (e. g. chmod +x script.py)? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: About __class__ of an int literal

2010-09-28 Thread Stefan Schwarzer
> > I searched the python issue tracker but failed to find > relevant reports. I wonder if this is an unreported > issue. It's nothing serious; the Python parser gets a bit confused and probably reads the dot as decimal point. If you use (1).__class__, you get what you expected

Testing for changes on a web page (was: how to find difference in number of characters)

2010-10-09 Thread Stefan Behnel
any structural changes by stripping all tags and normalising the resulting text to ignore whitespace and case differences. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: harmful str(bytes)

2010-10-11 Thread Stefan Behnel
eft and the situation is constantly improving. You can help out if you want. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: harmful str(bytes)

2010-10-11 Thread Stefan Behnel
rous to look at bytes objects in a debugger or interpreter session. I think the current way bytes.__str__ behaves is a good tradeoff between safety and usability, and the output is also very clear and readable. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Standardizing RPython - it's time.

2010-10-12 Thread Stefan Behnel
that doesn't have access to all of the CPython ecosystem. I'm not saying it can't be useful in certain cases, especially when you can be sure in advance that you won't need that ecosystem. But I don't really see the general purpose applicability of RPython to application

Re: Standardizing RPython - it's time.

2010-10-12 Thread Stefan Behnel
Stefan Behnel, 12.10.2010 09:18: If you implemented an RPython to CPython extension compiler, [...] BTW, if anyone wanted to do that, it might be a good idea to start with Cython, adapt its type inference layer and add the few missing Python language features (or pay the core developers to

Re: Performance evaluation of HTTPS library

2010-10-13 Thread Stefan Behnel
ly different machine at a suitable place in the network architecture), and makes your server generally more scalable. You can additionally use the HTTPS proxy machine to distribute the normal HTTP load over multiple server instances. There's even dedicated networking hardware for SSL/TLS pro

Re: socket problem and html problem

2010-10-14 Thread Stefan Behnel
faqs/smart-questions.html Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there any module for automated testing in python?

2010-10-15 Thread Stefan Behnel
changes in test results? There are several tools for Python that support running unit tests in one way or another. If you meant "continuous integration", take a look at the Hudson CI server. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: python/c api

2010-10-16 Thread Stefan Behnel
packages on PyPI that are said to be written in other languages than Python use the C-API in one way or another. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Fastest way to detect a non-ASCII character in a list of strings.

2010-10-17 Thread Stefan Behnel
Also see here: http://behnel.de/cgi-bin/weblog_basic/index.php?p=49 http://docs.cython.org/src/tutorial/strings.html Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Fastest way to detect a non-ASCII character in a list of strings.

2010-10-19 Thread Stefan Behnel
Dun Peal, 20.10.2010 02:07: On Mon, Oct 18, 2010 at 1:41 AM, Stefan Behnel wrote: Or, a bit shorter, using Cython 0.13: def only_allowed_characters(list strings): cdef unicode s return any((c< 31 or c> 127) for s in strings for c in s) Very cool

Re: ANN: Python-on-a-Chip release 09

2010-10-20 Thread Stefan Behnel
cted use cases. I assume it also uses unboxed (plain integer/float) arithmetic, right? Does that make a difference? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: A Unique XML Parsing Problem

2010-10-24 Thread Stefan Behnel
ating the data from the XML format, though. XML parsing is fast and has the clear advantage over CSV files that the data is safely stored in a well defined, expressive format, including character encoding and named data fields. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Tools for turning Python code into XMI?

2010-10-24 Thread Stefan Schwarzer
operations. Do you have any other suggestions for programs I should have a look at? Does someone even has written such a tool and has not published it yet? :) Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: yield all entries of an iterable

2010-10-24 Thread Stefan Schwarzer
StopIteration This works at least with Python's built-in sequences (and dictionaries and sets, but note that these don't have an obvious order). Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: yield all entries of an iterable

2010-10-24 Thread Stefan Schwarzer
Hi Cameron, On 2010-10-25 01:08, Cameron Simpson wrote: > On 24Oct2010 20:58, Stefan Schwarzer wrote: > | On 2010-10-21 00:27, Sebastian wrote: > | > Is there a simpler way to yield all elements of a sequence than this? > | > for x in xs: > | > yield x > | > |

Re: HTMLParser not parsing whole html file

2010-10-24 Thread Stefan Behnel
se issues as I parse them. HTMLparser is not made to deal with non-HTML input. You can take a look at lxml.html or BeautifulSoup (up to 3.0), which handle these problems a lot better. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Has Next in Python Iterators

2010-10-25 Thread Stefan Behnel
ver doing anything else but throwing an exception in my implementation for that. Bad design isn't a good reason for a feature to be copied. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I chain methods?

2010-10-25 Thread Stefan Schwarzer
framework. It's also used in the pstats module: http://docs.python.org/library/profile.html#instant-user-s-manual But I agree with others that it doesn't seem to be a typical Python idiom. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Why "flat is better than nested"?

2010-10-27 Thread Stefan Behnel
Robin Becker, 25.10.2010 15:56: "I know that that that that that boy said is wrong!". What's a "that boy"? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Land Of Lisp is out

2010-10-28 Thread Stefan Hübner
> Would it be right to say that the only Lisp still in common use is the Elisp > built into Emacs? Clojure (http://clojure.org) is a Lisp on the JVM. It's gaining more and more traction. -- http://mail.python.org/mailman/listinfo/python-list

Re: xml : remove a node with dom

2010-10-28 Thread Stefan Behnel
ts, try to make them consistent, or make it clear that (and where) things are missing. Hope that helps, Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: How on Factorial

2010-10-28 Thread Stefan Behnel
x27;t know it, most readers will have a hard time deciphering the above code, so it's best not to do this. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: How on Factorial

2010-10-28 Thread Stefan Behnel
$ python3 -m timeit -s "n=30" "2*~-n" 1000 loops, best of 3: 0.0979 usec per loop $ python3 -m timeit -s "n=30" "2*(n-1)" 1000 loops, best of 3: 0.0841 usec per loop Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python changes

2010-10-28 Thread Stefan Behnel
r Py2 version of the book. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Fastest way to detect a non-ASCII character in a list of strings.

2010-10-29 Thread Stefan Behnel
ent. Maybe it will get there some day :-) :-) I certainly wouldn't object. Funding is something the project can seriously benefit from. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: no line breaks in xml file with elementTree

2010-10-31 Thread Stefan Behnel
with namespace? Yes, it's called "Element", as in el = ET.Element('{http://the.name/space}tag') Reading the docs helps a lot here. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: openmp do loops

2010-11-04 Thread Stefan Behnel
(hkltable(1,i),hkltable(2,i),hkltable(3,i)) end do !$OMP END PARALLEL DO Seeing this makes me seriously happy that I can write my code in Python (or Cython, for that purpose). Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Tools for turning Python code into XMI?

2010-11-05 Thread Stefan Schwarzer
n the existing open source tools, the problem rather seems to be the effort of implementing XMI generation than to get the information out of the Python code in the first place. Stefan -- http://mail.python.org/mailman/listinfo/python-list

[ANN] Lupa 0.17 released - Lua in Python

2010-11-05 Thread Stefan Behnel
Hi all, I am happy to announce the release of Lupa 0.17, Lua in Python. http://pypi.python.org/pypi/lupa/0.17 Have fun, Stefan What is Lupa? -- Lupa integrates the LuaJIT2 runtime [1] into CPython. It is a rewrite of LunaticPython in Cython with several advanced features

Re: Intel C Compiler

2010-11-08 Thread Stefan Krah
the most annoying warnings of the Intel compiler. See: http://software.intel.com/en-us/forums/showthread.php?t=62308 The problem is that the compiler issues this warning even when there is no way that significant bits could be lost. Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: List index out of range, but list has enough elements

2010-11-09 Thread Stefan Behnel
i: print j print i[0] the "print j" statement works, but "print i[0]" returns "IndexError: list index out of range". Am I missing something? Are you sure the output you get from the "print j" is from the same loop ite

Re: List index out of range, but list has enough elements

2010-11-09 Thread Stefan Behnel
[rearranged the responses in the right order] Costin Gamenț, 09.11.2010 11:44: On Tue, Nov 9, 2010 at 3:21 PM, Costin Gamenț wrote: On Tue, Nov 9, 2010 at 11:33 AM, Stefan Behnel wrote: Costin Gamenț, 09.11.2010 10:24: Hi, I am trying to read a string as csv, but I encountered an odd problem

Re: DTD Parsing

2010-11-09 Thread Stefan Behnel
lxml actually have something for parsing DTDs, as opposed parsing XML and validating it against a DTD? What's your interest in parsing a DTD if you're not up to validating XML? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: DTD Parsing

2010-11-09 Thread Stefan Behnel
Asun Friere, 10.11.2010 06:41: On Nov 10, 4:11 pm, Stefan Behnel wrote: What's your interest in parsing a DTD if you're not up to validating XML? Spitting out boilerplate code. [...] A few years back I used a similar technique to write some boiler plate python code whe

Re: DTD Parsing

2010-11-10 Thread Stefan Behnel
other helpful stuff. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Am I The Only One Who Keeps Reading “Numpy” as “Numpty”?

2010-11-12 Thread Stefan Behnel
pie. Num-pie does not work for me. Maybe some linguist could chime in and explain these odd tendencies...? Ah, that's just English. Never mind. http://www.mipmip.org/tidbits/pronunciation.shtml Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Is a 32-bit build faster than a 64-bit build

2010-11-12 Thread Stefan Behnel
due to the better compiler optimisations. There are good reasons for both being able to run faster depending on the specific code, so benchmarking is basically all you can do. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Events in 2017, Need your help.

2017-02-10 Thread Stefan Behnel
Hi! Germany has three major Python events planned this year: - PyCon-Web in München (May 27-28th) - Python-Camp in Köln (April 8-9th) - PyCon-DE in Karlsruhe (October, dates TBA). http://pyconweb.org/ https://python-verband.org/informieren/events/pythoncamp-2017 Stefan Stephane Wirtel via

Re: Progress on the Gilectomy

2017-06-10 Thread Stefan Behnel
he core and the stdlib would just not work correctly in > multithread environment without GIL. And the same applies to external extension modules. The GIL is really handy when it comes to reasoning about safety and correctness of algorithms under the threat of thread concurrency. Especially in

Re: Python 3 removes name binding from outer scope

2017-07-25 Thread Stefan Behnel
out how to release them explicitly if they find out that they hurt and then additionally manage to debug where they are stored. Py2.x did the latter, and guess how many users knew about it? Stefan -- https://mail.python.org/mailman/listinfo/python-list

Re: Getting lazy with decorators

2012-06-24 Thread Stefan H. Holek
On 24.06.2012, at 03:58, Josh English wrote: > I'm creating a cmd.Cmd class, and I have developed a helper method to easily > handle help_xxx methods. When I need custom help processing I tend to simply override do_help(). Stefan http://pypi.python.org/pypi/kmd -- Stefan H

Re: python and Open cv

2012-11-01 Thread Stefan H. Holek
On 01.11.2012, at 09:55, inshu chauhan wrote: > How to load a yml file in python and work with it ?? > Try one of these: http://pypi.python.org/pypi?%3Aaction=search&term=yaml&submit=search -- Stefan H. Holek ste...@epy.co.at -- http://mail.python.org/mailman/listinfo/python-list

Re: lazy properties?

2012-11-02 Thread Stefan H. Holek
gt; is not going to change. > I was trying to generalize it in a @lazy_property but my attempts so far > failed, any help on how I could do that? There is a ready made and well tested lazy decorator at http://pypi.python.org/pypi/lazy Stefan -- Stefan H. Holek ste...@epy.co.at -- http://mail.python.org/mailman/listinfo/python-list

Re: How to improve the usability of nested packages

2012-11-02 Thread Stefan H. Holek
direction as well. [2] (Not trying to plug the ZTK here, it just happens to be a large, namespace-using library I know.) Hope this helps, Stefan [1] http://docs.zope.org/zopetoolkit/ [2] http://pypi.python.org/pypi/zope.deferredimport -- Stefan H. Holek ste...@epy.co.at -- http://mail.python.org

Re: how-to use readline.set_completion_display_matches_hook()?

2012-11-07 Thread Stefan H. Holek
stdlib's readline bindings. There is a more complete implementation of the GNU Readline APIs at http://pypi.python.org/pypi/rl. With rl you can fix the prompt by calling rl.readline.redisplay(force=True) after the hook has returned. Hope this helps, Stefan -- Stefan H. Holek ste...@epy.co.at -- http://mail.python.org/mailman/listinfo/python-list

Re: Lazy Attribute

2012-11-16 Thread Stefan H. Holek
http://lazy.readthedocs.org/en/latest/ Stefan -- Stefan H. Holek ste...@epy.co.at -- http://mail.python.org/mailman/listinfo/python-list

Re: Lazy Attribute

2012-11-16 Thread Stefan H. Holek
bility. Putting it on PyPI alone does not cut it, apparently. Stefan -- Stefan H. Holek ste...@epy.co.at -- http://mail.python.org/mailman/listinfo/python-list

Re: Lazy Attribute

2012-11-16 Thread Stefan H. Holek
t invalidation anyway in order to write tests. I decided to expose the mechanism to keep users from having to invent their own SHOULD the need arise. I was not advocating invalidation in any way with my reply. All I wanted was to confirm the "least bad" solution. ;-) Stefan -- Stefan H. Holek ste...@epy.co.at -- http://mail.python.org/mailman/listinfo/python-list

Re: how to detect the encoding used for a specific text data ?

2012-12-20 Thread Stefan H. Holek
On 20.12.2012, at 12:57, iMath wrote: > how to detect the encoding used for a specific text data ? http://pypi.python.org/pypi?%3Aaction=search&term=detect+encoding -- Stefan H. Holek ste...@epy.co.at -- http://mail.python.org/mailman/listinfo/python-list

newstyle classes and __getattribute__

2005-10-28 Thread Stefan Sonnenberg-Carstens
Hi there, I'm facing some strange things - but maybe only me is strange - anyway... i wrote the following code: +++ class T(object): def __init__(self,name='',port=80): self.name=name self.port=port +++ looks fine - to me. Now I can do: >>> t = T(name

Re: newstyle classes and __getattribute__

2005-10-28 Thread Stefan Sonnenberg-Carstens
Stefan Sonnenberg-Carstens schrieb: > Hi there, > I'm facing some strange things - but maybe only me is strange - anyway... > > i wrote the following code: > > > +++ > class T(object): > def __init__(self,name='',port=80): > self.name=n

Re: newstyle classes and __getattribute__

2005-10-28 Thread Stefan Sonnenberg-Carstens
James Stroud schrieb: > On Friday 28 October 2005 14:26, Stefan Sonnenberg-Carstens wrote: > >>Hi there, > > [..clip..] > >>Now, I do this: >> >>class T(object): >> def __init__(self,name='',port=80): >>

Re: newstyle classes and __getattribute__

2005-10-28 Thread Stefan Sonnenberg-Carstens
Stefan Sonnenberg-Carstens schrieb: > James Stroud schrieb: > >> On Friday 28 October 2005 14:26, Stefan Sonnenberg-Carstens wrote: >> >>> Hi there, >> >> >> [..clip..] >> >>> Now, I do this: >>> >>> class T(o

Re: how to convert a bitmap file to an array ?

2007-06-05 Thread Stefan Sonnenberg-Carstens
stef schrieb: > hello > > I can find all kind of procedures to convert an array to a bitmap > (wxPython, PIL), > but I can't find the reverse, > either >- convert a bitmap to an array > or > - read a bitmap file to an array > > thanks, > Stef Mientki > Take a look at the "struct" module. T

Re: subprocess leaves child living

2007-06-05 Thread Stefan Sonnenberg-Carstens
Thomas Dybdahl Ahle schrieb: > Hi, When I do a small program like > > from subprocess import Popen > popen = Popen(["ping", "google.com"]) > from time import sleep > sleep(100) > > start it and kill it, the ping process lives on. > Is there a way to ensure that the ping process is always killed whe

Re: labeled break/continue

2007-06-19 Thread Stefan Sonnenberg-Carstens
Matt Chisholm schrieb: > On Mon, 18 Jun 2007 05:28, faulkner <[EMAIL PROTECTED]> wrote: > >> On Jun 18, 12:35 am, Matt Chisholm <[EMAIL PROTECTED]> wrote: >> >>> Hi. I was wondering if there had ever been an official decision on >>> the idea of adding labeled break and continue functionali

Re: How can I know the name of "caller"

2007-06-19 Thread Stefan Sonnenberg-Carstens
billiejoex schrieb: > Hi there, > unfortunately, I'm compelled to apply a sort of monkey patching at the > code of an existing libreary that I can't modify directly. > Here's my question > Having such code: > > class test: > > def caller(self): > self.b() > > def called(self): >

Making decimal default datatype for floats during runtime

2007-06-21 Thread Stefan Sonnenberg-Carstens
Hi, I was wondering if there are any tricks around to do some sort of changing types, float in particular. I do many operations like summing etc on lots of floats and always have to do some extra checks where results are heading 0.0, like round(n,10) for example. My idea was to tell python in some

Re: Building a Python app with Mozilla

2007-07-05 Thread Stefan Sonnenberg-Carstens
On Do, 5.07.2007, 03:45, greg wrote: > [EMAIL PROTECTED] wrote: > >> wxWidgets will give you native looking apps on both Linux and Windows > > Well, maybe. There's more to getting a native feel than > just using the right widgets. I once saw a Qt-based app on > MacOSX that had tiny little buttons t

Re: invoke user's standard mail client

2007-05-06 Thread Stefan Sonnenberg-Carstens
Gabriel Genellina schrieb: > En Fri, 04 May 2007 05:07:44 -0300, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> escribió: > > >> the simplest way to launch the user's standard mail client from a >> Python program is by creating a mailto: URL and launching the >> webbrowser: >> But this method is limi

Re: Python Binding

2007-05-06 Thread Stefan Sonnenberg-Carstens
Stefan Behnel schrieb: > Georg Grabler wrote: > >> There's a C library which i'd like to have python bindings for. I havn't >> known anything before about how to write python bindings for a C library. >> >> I succeeded now by using distutils to

Re: Python Binding

2007-05-06 Thread Stefan Sonnenberg-Carstens
Stefan Behnel schrieb: > Georg Grabler wrote: > >> There's a C library which i'd like to have python bindings for. I havn't >> known anything before about how to write python bindings for a C library. >> >> I succeeded now by using distutils to

Re: invoke user's standard mail client

2007-05-06 Thread Stefan Sonnenberg-Carstens
Stefan Sonnenberg-Carstens schrieb: > Gabriel Genellina schrieb: > >> En Fri, 04 May 2007 05:07:44 -0300, [EMAIL PROTECTED] >> <[EMAIL PROTECTED]> escribió: >> >> >> >>> the simplest way to launch the user's standard mail clien

Re: import conflict

2007-05-06 Thread Stefan Sonnenberg-Carstens
surely solve that problem with symlinks, but if they depend on another, perhaps the structure is not optimal. If you use python 2.5 you can try absolute imports (which I personally find not so well): from __future__ import absolute_import See here: http://python.mirrors-r-us.net/dev/peps/pep-0328/ Cheers, Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: import conflict

2007-05-06 Thread Stefan Sonnenberg-Carstens
surely solve that problem with symlinks, but if they depend on another, perhaps the structure is not optimal. If you use python 2.5 you can try absolute imports (which I personally find not so well): from __future__ import absolute_import See here: http://python.mirrors-r-us.net/dev/peps/pep-0328/ Cheers, Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem to Download ftp file

2007-05-06 Thread Stefan Sonnenberg-Carstens
Perhaps a problem with name resolution ? On Mo, 7.05.2007, 07:27, Shakil Ahmed wrote: > hi > Actually i need to know that how can i download a ftp file from ncbi by > using python module ftputil. > please help me. > > Thanks > regards, > Shakil > > import ftputil > > host = ftputil.FTPHost('ftp.nc

Re: problem with quoted strings while inserting into varchar field of database.

2007-05-07 Thread Stefan Sonnenberg-Carstens
On Mo, 7.05.2007, 10:30, Daniele Varrazzo wrote: > On 7 Mag, 08:55, "krishnakant Mane" <[EMAIL PROTECTED]> wrote: >> On 6 May 2007 11:22:52 -0700, Daniele Varrazzo >> <[EMAIL PROTECTED]> >> Every serious database driver has a >> complete and solid SQL escaping >> > mechanism. This mechanism tipical

Re: problem with quoted strings while inserting into varchar field of database.

2007-05-07 Thread Stefan Sonnenberg-Carstens
On Mo, 7.05.2007, 11:32, Daniele Varrazzo wrote: > On 7 Mag, 10:46, "Stefan Sonnenberg-Carstens" > <[EMAIL PROTECTED]> wrote: >> On Mo, 7.05.2007, 10:30, Daniele Varrazzo wrote: >> >> > On 7 Mag, 08:55, "krishnakant Mane" <[EMAIL PROTEC

Re: problem with quoted strings while inserting into varchar field of database.

2007-05-07 Thread Stefan Sonnenberg-Carstens
On Mo, 7.05.2007, 16:26, Daniele Varrazzo wrote: >> >> >> > cur.execute("INSERT INTO datatable (data) VALUES (%s);", >> >> >> > (pickled_data,)) > >> %s is not a placeholder IMHO. > >> What happens when using %s is, that the string given will be inserted >> where >> %s is; that is something pyt

Re: problem with quoted strings while inserting into varchar field of database.

2007-05-07 Thread Stefan Sonnenberg-Carstens
On Mo, 7.05.2007, 16:50, Carsten Haese wrote: > On Mon, 2007-05-07 at 07:26 -0700, Daniele Varrazzo wrote: >> > >> >> > cur.execute("INSERT INTO datatable (data) VALUES (%s);", >> > >> >> > (pickled_data,)) >> >> > %s is not a placeholder IMHO. >> >> > What happens when using %s is, that the st

Re: Using the CSV module

2007-05-09 Thread Stefan Sonnenberg-Carstens
Most of the time I found the CSV module not as useful as it might be - due to the restrictions you describe. Why not write a simple parser class ? On Mi, 9.05.2007, 10:40, Nathan Harmston wrote: > Hi, > > I ve been playing with the CSV module for parsing a few files. A row > in a file looks like

Re: Read binary data from MySQL database

2007-05-10 Thread Stefan Sonnenberg-Carstens
On Do, 10.05.2007, 16:19, Christoph Krammer wrote: > Hello, > > I try to write a python application with wx that shows images from a > MySQL database. I use the following code to connect and get data when > some event was triggered: > > dbconn = MySQLdb.connect(host="localhost", user="...", passwd=

Re: Simple Tkinter Progress Bar

2007-05-11 Thread Stefan Sonnenberg-Carstens
On Fr, 11.05.2007, 08:42, Gurpreet Singh wrote: > Hi > > I am a newbie in Python > > I am creating a simple Tkinter based application. > I have written Tkinter GUI source code and the > programme logic in the same .py file. > > I am searching for a way to implement a simple > Progress bar for my ap

Re: Is wsgi ready for prime time?

2007-05-17 Thread Stefan Sonnenberg-Carstens
Michele Simionato schrieb: > On May 17, 8:09 pm, Ron Garret <[EMAIL PROTECTED]> wrote: > >> The wsgiref module in Python 2.5 seems to be empty: >> >> [EMAIL PROTECTED]:~/Sites/modpy]$ python >> Python 2.5 (r25:51908, Mar 1 2007, 10:09:05) >> [GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darw

Re: Writelines() a bit confusing

2007-05-19 Thread Stefan Sonnenberg-Carstens
aiwarrior schrieb: > If file.WriteLines( seq ) accepts a list and it says it writes lines, > why does it write the whole list in a single line. Be cause of that > the reverse of file.writelines(seq) is not file.readlines(). > Are the assumptions i made correct? If yes why is this so? > > I find a f

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-26 Thread Stefan Sonnenberg-Carstens
Paul McGuire schrieb: > I'm starting a new thread for this topic, so as not to hijack the one > started by Steve Howell's excellent post titled "ten small Python > programs". > > In that thread, there was a suggestion that these examples should > conform to PEP-8's style recommendations, including

Re: Can python create a dictionary from a list comprehension?

2007-05-27 Thread Stefan Sonnenberg-Carstens
erikcw schrieb: > Hi, > > I'm trying to turn o list of objects into a dictionary using a list > comprehension. > > Something like > > entries = {} > [entries[int(d.date.strftime('%m'))] = d.id] for d in links] > > I keep getting errors when I try to do it. Is it possible? Do > dictionary objects

Re: updates in sqlite3 do not work

2007-05-29 Thread Stefan Sonnenberg-Carstens
Did you try a commit() ? SQLite3 works in autocommit mode by default, so it would help to see your code. On Mi, 30.05.2007, 00:30, Chris Fonnesbeck wrote: > I have a script set up to perform UPDATE commands on an sqlite database > using the sqlite3 module. Everything appears to run fine (there a

Re: what's the precision of fractions.Fraction?

2010-11-18 Thread Stefan Sonnenberg-Carstens
Am 18.11.2010 17:27, schrieb Daniel Fetchinson: I do a recursive evaluation of an expression involving fractions and unsurprisingly the numerator and denominator grows pretty quickly. After 10-20 iterations the number of digits in the numerator and denominator (as integers) reaches 80-100. And I'

Re: I have a question about JavaFit

2010-11-18 Thread Stefan Sonnenberg-Carstens
Am 18.11.2010 20:17, schrieb Ben James: On 18/11/2010 10:05, Chris Rebert wrote: "We" are a technical discussion maillinglist. About a computer programming language. Named Python. An unrelated computer programming language which happens to be named "Java" also exists, but is not this mailinglist

Re: Changing the EAX register with Python

2010-11-18 Thread Stefan Sonnenberg-Carstens
Am 18.11.2010 21:20, schrieb dutche: Hi folks, I have a unusual question here. How can I change the value of EAX register under python under Linux?? As paimei does under Windows. My project is to have a python program that loads a C program and sets a breakpoint at some address, and then with t

Re: dpkt

2010-11-18 Thread Stefan Sonnenberg-Carstens
Am 19.11.2010 06:39, schrieb Verde Denim: Hi I'm looking to find some help working with dpkt. As you probably know, there really isn't any documentation, and not being astute at Python as of yet leaves me with a lot of gaps. Is there anyone here that can point me in a direction toward writing

Re: Changing the EAX register with Python

2010-11-19 Thread Stefan Sonnenberg-Carstens
can be controlled from Python?" > > I don't know the answer to that. gdb is quite powerful, and you can > certainly control it by connecting to its stdin and stdout connections. > -- > Tim Roberts, t...@probo.com > Providenza & Boekelheide, Inc. > -- > http

Re: try to use unicode

2010-11-19 Thread Stefan Sonnenberg-Carstens
Am 20.11.2010 06:53, schrieb Mikael B: Hi. I'm learning python. python 2.6.6 on ubuntu 10.10 I'm swedish so I try to use unicode to get swedish characters. I've checked wikipedia. utf-8 is said to be an unicode encoding.. this is the test program: # -*- coding: utf-8 -*- import readline s=

Re: Is it possible to use Google's advanced search options?

2010-11-20 Thread Stefan Sonnenberg-Carstens
Am 20.11.2010 10:37, schrieb Petar Milin: Hello! Can anyone help me with getting number of hits from Google, but with restricton on domain (e.g., .edu) and language (e.g., lang_de)? I have tried with the Pygoogle (from: http://code.google.com/p/pygoogle/

Re: Does Pygoogle allows for advanced search options?

2010-11-21 Thread Stefan Sonnenberg-Carstens
Am 21.11.2010 11:01, schrieb Petar Milin: On 20/11/10 22:34, Chris Rebert wrote: On Thu, Nov 18, 2010 at 3:26 AM, neocortex wrote: The library doesn't seem to have built-in support for filtering by language (and Google lacks a search query-string-based operator for that), but it looks like yo

Re: Does Pygoogle allows for advanced search options?

2010-11-21 Thread Stefan Sonnenberg-Carstens
Am 21.11.2010 20:35, schrieb Petar Milin: Hello ALL! I am playing with the modified version of the Pygoogle (by Stefan). Interesting thing is that get_result_count() gives numbers/results different from those in Google. Has anyone checked this? Does anyone know why? Best, Petar AFAIK

Re: Glob in python which supports the ** wildcard

2010-11-22 Thread Stefan Sonnenberg-Carstens
Am 22.11.2010 22:43, schrieb Martin Lundberg: Hi, I want to be able to let the user enter paths like this: apps/name/**/*.js and then find all the matching files in apps/name and all its subdirectories. However I found out that Python's glob function doesn't support the recursive ** wildcard.

Re: do something every n seconds

2010-11-25 Thread Stefan Sonnenberg-Carstens
Windows or UNIX ? Am Do, 25.11.2010, 13:38 schrieb Santiago Caracol: > Hello, > > how can I do something (e.g. check if new files are in the working > directory) every n seconds in Python? > > Santiago > -- > http://mail.python.org/mailman/listinfo/python-list > >

Re: hashlib in one line

2010-11-29 Thread Stefan Sonnenberg-Carstens
Am 29.11.2010 14:50, schrieb Thomas Guettler: Hi, I think it would be nice if you could use the hashlib in one line: hashlib.sha256().update('abc').hexdigest() Unfortunately update() returns None. Is there a way to convert a string to the hexdigest of sha256 in one line? Thomas Like so

<    17   18   19   20   21   22   23   >