Re: Where is the function of 'apply' always used?

2008-04-12 Thread Terry Reedy
"???" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | I'am a beginner of Python.In the course of reading the Python book,I | found the function:apply;But | I don't understand its use.Help! Apply has been deprecated. It has been replaced by the use of *args in function calls. It i

Re: str(bytes) in Python 3.0

2008-04-12 Thread Terry Reedy
"John Roth" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | On Apr 12, 8:52 am, [EMAIL PROTECTED] (John J. Lee) wrote: | > Christian Heimes <[EMAIL PROTECTED]> writes: | > > Gabriel Genellina schrieb: | > >> On the last line, str(x), I would expect 'abc' - same as str(x, 'ascii') |

Re: class level properties

2008-04-12 Thread Arnaud Delobelle
On Apr 13, 12:33 am, Charles D Hixson <[EMAIL PROTECTED]> wrote: > Arnaud Delobelle wrote: > class MetaX(type): > > > ...     @property > > ...     def spam(self): return 'eggs' > > ... > > class X(object): > > > ...      __metaclass__ = MetaX > > ... > > X.spam > > > 'eggs' > > > HT

Re: Tremendous slowdown due to garbage collection

2008-04-12 Thread Martin v. Löwis
> I still don't see what is so good about defaults that lead to O(N*N) > computation for a O(N) problem, and I like Amaury's suggestion a lot, > so I would like to see comments on its disadvantages. Please don't > tell me that O(N*N) is good enough. For N>1E7 it isn't. Please understand that chang

Re: Confused about Boost.Python & bjam

2008-04-12 Thread Till Kranz
Hi, On Sat, 12 Apr 2008, 7stud wrote: On Apr 12, 4:53 am, Till Kranz <[EMAIL PROTECTED] goettingen.de> wrote: I tried to get started with Boost.Python. I am using a Gentoo system, so there is no boost directory. A few months ago, I spent a whole day trying to install boost python. I fai

Controlling copying and pickling of objects written in C

2008-04-12 Thread Adam Bregenzer
I am writing an extension and have "hidden" data included in the object's C structure that is not visible to python. I am unsure what would happen to that data if the python object were copied or pickled and would prefer to raise an exception whenever code tries to copy/deep copy/pickle or mar

Re: Looking for a way to include Pyhtho scripting INSIDE a python program

2008-04-12 Thread Bryon
On Apr 12, 10:16 pm, John Antypas <[EMAIL PROTECTED]> wrote: > Hello all, > > I'm writing in tool in Python that manipulates various data objects read > from various streams. I wanted to give the user a chance to do advanced > work that could not easily be done from a GUI. > > At first, I tried pu

Re: C to python conversion

2008-04-12 Thread Gabriel Genellina
En Sat, 12 Apr 2008 07:58:47 -0300, Michele Petrazzo <[EMAIL PROTECTED]> escribió: > Hi all, > I'm trying to translate a simple C code into a python + ctypes (where > need), but I have some problems on char conversion. The code have > to work on Linux and talk with the serial port. I think that

Looking for a way to include Pyhtho scripting INSIDE a python program

2008-04-12 Thread John Antypas
Hello all, I'm writing in tool in Python that manipulates various data objects read from various streams. I wanted to give the user a chance to do advanced work that could not easily be done from a GUI. At first, I tried putting in a lightweight scripting language, and then I thought, why not

Re: String Literal to Blob

2008-04-12 Thread Gabriel Genellina
En Sat, 12 Apr 2008 16:11:20 -0300, Victor Subervi <[EMAIL PROTECTED]> escribió: On Fri, Apr 11, 2008 at 2:05 PM, Steve Holden <[EMAIL PROTECTED]> wrote: Then browse to the URL this program serves and you will see the image (assuming you are still sending the image/jpeg content type). Well

Re: Advice on tools/technologies/books, etc.

2008-04-12 Thread Nathan Duran
On Apr 12, 2008, at 6:55 PM, [EMAIL PROTECTED] wrote: > Will it be possible for me to put together an async site > with only python? Nope. Not until some browser embeds a Python interpreter in it anyway. Your primary choices are JavaScript and Flash. -- http://mail.python.org/mailman/listi

Re: String Literal to Blob

2008-04-12 Thread Gabriel Genellina
En Sat, 12 Apr 2008 22:14:31 -0300, Jason Scheirer <[EMAIL PROTECTED]> escribió: > On Apr 12, 2:44 pm, Steve Holden <[EMAIL PROTECTED]> wrote: >> Victor Subervi wrote: >> > Well, as I mentioned before, I am sending text/html because the page, >> > like almost all web pages, has a whole lot more

Where is the function of 'apply' always used?

2008-04-12 Thread 张春越
I'am a beginner of Python.In the course of reading the Python book,I found the function:apply;But I don't understand its use.Help! -- http://mail.python.org/mailman/listinfo/python-list

Re: Advice on tools/technologies/books, etc.

2008-04-12 Thread Brian
I would definitely recommend Django as a framework - though the choice of framework wouldn't really affect your use of AJAX. And using AJAX actually doesn't require learning a whole lot of javascript stuff - using something like the Prototype JS library (prototypejs.org) takes care of all the deta

Re: PythonWin Print Problem.. Build 210

2008-04-12 Thread Roger Upole
"Hutch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > PythonWin has been a very good ide from early version thru 2.4. > > All work ok on THREE of my computers with THREE different HP printers. > > Now comes 2.5. > Every thing seems to work the same except when I want to print out a

Advice on tools/technologies/books, etc.

2008-04-12 Thread Matt
I would like to create a web-based tool for risk management. The tool actually currently exists, but it was programmed in about 1998 using old VB, etc, and we are updating it & moving it to the web. Basically, as a first step, i'd like to create a basic web site that takes user input, gets data fro

Re: Confused about Boost.Python & bjam

2008-04-12 Thread 7stud
On Apr 12, 4:53 am, Till Kranz <[EMAIL PROTECTED] goettingen.de> wrote: > Hi, > > I tried to get started with Boost.Python. unfortunately I never used the > bjam build system before. As it is explained in the documentation I tried > to adapt the the files form the examples directory. I copied 'Jamr

Re: str(bytes) in Python 3.0

2008-04-12 Thread Gabriel Genellina
En Sat, 12 Apr 2008 11:25:59 -0300, Martin v. Löwis <[EMAIL PROTECTED]> escribió: >> And making an utf-8 encoding default is not possible without writing a >> new function? > > There is no default encoding anymore in Python 3. This is by design, > learning from the problems in Python 2.x. So sy

Re: String Literal to Blob

2008-04-12 Thread Jason Scheirer
On Apr 12, 2:44 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Victor Subervi wrote: > > in line... > > > On Fri, Apr 11, 2008 at 2:05 PM, Steve Holden <[EMAIL PROTECTED] > > > wrote: > > > Victor Subervi wrote: > > > I have worked on this many hours a day for two

Re: SQLite OperationalError near "?"

2008-04-12 Thread John Machin
On Apr 13, 8:45 am, Hexade <[EMAIL PROTECTED]> wrote: > Hello > > I would like to use the safe "?" placeholder in my SQLite requests but > I got the following error: > > Traceback (most recent call last): > (...) > cursor.execute("SELECT ? FROM ? WHERE name = ? ", (key, self.table, > self.name)

Re: Tremendous slowdown due to garbage collection

2008-04-12 Thread Steve Holden
Paul Rubin wrote: > Steve Holden <[EMAIL PROTECTED]> writes: >> I believe you are making surmises outside your range of competence >> there. While your faith in the developers is touching, the garbage >> collection scheme is something that has received a lot of attention >> with respect to performa

Re: Tremendous slowdown due to garbage collection

2008-04-12 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > I believe you are making surmises outside your range of competence > there. While your faith in the developers is touching, the garbage > collection scheme is something that has received a lot of attention > with respect to performance under typical worklo

Re: Windows - window status (Running vs Not Responding)

2008-04-12 Thread rdahlstrom
On Apr 11, 11:18 pm, Ross Ridge <[EMAIL PROTECTED]> wrote: > rdahlstrom <[EMAIL PROTECTED]> wrote: > >Basically, I'm looking for something similar to the Process.Responding > >property in System.Diagnostics... > > You probably want to use IsHungAppWindow(): > > IsHungAppWindow Function > >

Re: class level properties

2008-04-12 Thread Charles D Hixson
Arnaud Delobelle wrote: > On Apr 12, 8:36 pm, Charles D Hixson <[EMAIL PROTECTED]> > wrote: > >> I'm trying to construct read-only variables at the class level. I've >> been unsuccessful. Any suggestions? >> >> Mixing @classmethod and @property doesn't appear to produce workable >> code. Ditt

PyGTK GUI update without signals from GUI

2008-04-12 Thread Andrew Lapidas
Hi All: I am currently having a problem updating a GUI. I am using PyGTK and Glade to design an interface for a project. This interface contains no buttons, just images, labels, and a progress bar. The code for the project is small, and it basically does some things independent of the GUI in an

SQLite OperationalError near "?"

2008-04-12 Thread Hexade
Hello I would like to use the safe "?" placeholder in my SQLite requests but I got the following error: Traceback (most recent call last): (...) cursor.execute("SELECT ? FROM ? WHERE name = ? ", (key, self.table, self.name)) OperationalError: near "?": syntax error key, self.table and self.n

Re: sqlite3 - adding tables and rows via parameters

2008-04-12 Thread Vlastimil Brom
2008/4/13, Steve Holden <[EMAIL PROTECTED]>: > > Vlastimil Brom wrote: > > > ... are there any (security > > ...) risks of using string interpolation for table and column names in > the SQL commands? Or > > are the values, where parametrization (with ? in sqlite3) is supported, > > the only vulnera

Re: Multiple independent Python interpreters in a C/C++ program?

2008-04-12 Thread Graham Dumpleton
On Apr 13, 3:05 am, sturlamolden <[EMAIL PROTECTED]> wrote: > On Apr 11, 6:24 pm, [EMAIL PROTECTED] wrote: > > > Do I wind up with two completely independent interpreters, one per thread? > > I'm thinking this doesn't work (there are bits which aren't thread-safe and > > are only protected by the G

Re: basic python question about for loop

2008-04-12 Thread Steve Holden
jmDesktop wrote: [...] > So what is n and x in the first iteration? Sorry. I'm trying. Somewhat feebly, if you don't mind my saying so, but don't worry. The usual way to proceed in the face of such ignorance is to insert some form of output that will tell you the answer to your question. So:

Re: sqlite3 - adding tables and rows via parameters

2008-04-12 Thread Steve Holden
Vlastimil Brom wrote: > > 2008/4/12, Steve Holden <[EMAIL PROTECTED] >: > > Vlastimil Brom wrote: > > Hi all, > > I would like to ask about the usage of sqlite3 in python, more > > specifically about a way to pass table > > or column names to a SQ

Re: Tremendous slowdown due to garbage collection

2008-04-12 Thread Steve Holden
[EMAIL PROTECTED] wrote: >> Martin said that the default settings for the cyclic gc works for most >> people. > > I agree. > >> Your test case has found a pathologic corner case which is *not* >> typical for common application but typical for an artificial benchmark. > > I agree that my "corner"

Re: str(bytes) in Python 3.0

2008-04-12 Thread Steve Holden
Dan Bishop wrote: > On Apr 12, 9:29 am, Carl Banks <[EMAIL PROTECTED]> wrote: >> On Apr 12, 10:06 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: >> >>> On 12 Apr., 14:44, Christian Heimes <[EMAIL PROTECTED]> wrote: Gabriel Genellina schrieb: > On the last line, str(x), I would expect 'abc' -

Re: String Literal to Blob

2008-04-12 Thread Steve Holden
One last thing: I am sorry that despite my efforts I was unable to teach you what you need to learn. I can only hope someone else manages to get the point across. regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- h

Re: String Literal to Blob

2008-04-12 Thread Steve Holden
Victor Subervi wrote: > in line... > > On Fri, Apr 11, 2008 at 2:05 PM, Steve Holden <[EMAIL PROTECTED] > > wrote: > > Victor Subervi wrote: > > I have worked on this many hours a day for two weeks. If there is an > > easier way to do it, just take a minut

Re: pty.spawn directs stderr to stdout

2008-04-12 Thread Wilbert Berendsen
Op zaterdag 12 april 2008, schreef Wilbert Berendsen: > I'm currently trying to combine subprocess.Popen with pty.openpty ... which succeeded :-) http://code.google.com/p/lilykde/source/browse/trunk/runpty.py?r=314 it seems to work :-) thanks, Wilbert Berendsen -- http://www.wilbertberendsen.nl/

Re: override the interpreter's parser?

2008-04-12 Thread Sean McIlroy
never mind. i found it. -- http://mail.python.org/mailman/listinfo/python-list

Re: basic python question about for loop

2008-04-12 Thread Jason Stokes
"jmDesktop" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > So what is n and x in the first iteration? Sorry. I'm trying. Remember how Python's range operator works. range(n, x) constructs a list that consists of all elements starting with n and up to, but /not including/, x.

toplevel, get latest entry?

2008-04-12 Thread skanemupp
windows vista and python 2.5, is there a way to get the latest command entered? would be very useful. if not by default, anything i could download or write myself? -- http://mail.python.org/mailman/listinfo/python-list

PythonWin Print Problem.. Build 210

2008-04-12 Thread Hutch
PythonWin has been a very good ide from early version thru 2.4. All work ok on THREE of my computers with THREE different HP printers. Now comes 2.5. Every thing seems to work the same except when I want to print out a copy of the source code of my project (about 38 pages) Version 2.5 acts like

Re: class level properties

2008-04-12 Thread Arnaud Delobelle
On Apr 12, 8:36 pm, Charles D Hixson <[EMAIL PROTECTED]> wrote: > I'm trying to construct read-only variables at the class level.  I've > been unsuccessful.  Any suggestions? > > Mixing @classmethod and @property doesn't appear to produce workable > code.  Ditto for mixing @classmethod and __getatt

[help] how to install pygtk

2008-04-12 Thread He Jibo
Hi, Everyone, Could someone help me how to install pygtk? I get some problems with it. Here is the error I get while install pygtk: https://netfiles.uiuc.edu/jibohe2/error.GIF?uniq=-k6678k I use python 2.4, I first installed glade-2.0.1-win32_with_gtk, and then pycairo-1.0.2-1.win32-py2.4, pygob

C API design flaw (was: Re: Multiple independent Python interpreters in a C/C++ program?)

2008-04-12 Thread sturlamolden
On Apr 12, 7:05 pm, sturlamolden <[EMAIL PROTECTED]> wrote: > In theory, a GIL private to each (sub)interpreter would make Python > more scalable. The current GIL behaves like the BKL in earlier Linux > kernels. However, some third-party software, notably Apache's > mod_python, is claimed to depen

Re: Tremendous slowdown due to garbage collection

2008-04-12 Thread andreas . eisele
> Martin said that the default settings for the cyclic gc works for most > people. I agree. > Your test case has found a pathologic corner case which is *not* > typical for common application but typical for an artificial benchmark. I agree that my "corner" is not typical, but I strongly disagr

override the interpreter's parser?

2008-04-12 Thread Sean McIlroy
hi all i'd like to write a module that, when run in the interpreter, would cause the interpreter to read certain strings that would normally be rejected as syntax errors (strings beginning with the @ symbol, say) and pass them on to an object defined in the aforementioned module. where should i lo

Re: pty.spawn directs stderr to stdout

2008-04-12 Thread Wilbert Berendsen
Op vrijdag 11 april 2008, schreef Donn Cave: > More likely, you want the spawned process' error output to go wherever > the parent's error output was going.  This is a little trickier. I ended up writing a small script that basically reimplements fork() from the pty module, where then STDERR is n

class level properties

2008-04-12 Thread Charles D Hixson
I'm trying to construct read-only variables at the class level. I've been unsuccessful. Any suggestions? Mixing @classmethod and @property doesn't appear to produce workable code. Ditto for mixing @classmethod and __getattr__. (The property approach compiles, but execution says that you can

Re: Recommended "from __future__ import" options for Python 2.5.2?

2008-04-12 Thread Dan Bishop
On Apr 12, 1:41 pm, "Malcolm Greene" <[EMAIL PROTECTED]> wrote: > Is there any consensus on what "from __future__ import" options > developers should be using in their Python 2.5.2 applications? > > Is there a consolidated list of "from __future__ import" options to > choose from? Just look inside

Re: String Literal to Blob

2008-04-12 Thread Victor Subervi
in line... On Fri, Apr 11, 2008 at 2:05 PM, Steve Holden <[EMAIL PROTECTED]> wrote: > Victor Subervi wrote: > > I have worked on this many hours a day for two weeks. If there is an > > easier way to do it, just take a minute or two and point it out. Have > > you heard of the Law of Diminishing Re

Re: How is GUI programming in Python?

2008-04-12 Thread Torsten Bronger
Hallöchen! Michel Bouwmans writes: > Gabriel Genellina wrote: > >> Michel Bouwmans <[EMAIL PROTECTED]> escribió: >> >>> Gabriel Genellina wrote: >>> Another annoying thing with the Qt license is that you have to choose it at the very start of the project. You cannot develop somethi

Re: Recommended "from __future__ import" options for Python 2.5.2?

2008-04-12 Thread Tim Golden
Malcolm Greene wrote: > Is there a consolidated list of "from __future__ import" options to > choose from? Well, that bit's easy: import __future__ print __future__.all_feature_names TJG -- http://mail.python.org/mailman/listinfo/python-list

Recommended "from __future__ import" options for Python 2.5.2?

2008-04-12 Thread Malcolm Greene
Is there any consensus on what "from __future__ import" options developers should be using in their Python 2.5.2 applications? Is there a consolidated list of "from __future__ import" options to choose from? Thank you, Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Re: How is GUI programming in Python?

2008-04-12 Thread Michel Bouwmans
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gabriel Genellina wrote: > En Fri, 11 Apr 2008 11:31:42 -0300, Michel Bouwmans > <[EMAIL PROTECTED]> escribió: >> Gabriel Genellina wrote: > >>> Another annoying thing with the Qt license is that you have to choose it >>> at the very start of the pro

Re: sqlite3 - adding tables and rows via parameters

2008-04-12 Thread Vlastimil Brom
2008/4/12, Steve Holden <[EMAIL PROTECTED]>: > > Vlastimil Brom wrote: > > Hi all, > > I would like to ask about the usage of sqlite3 in python, more > > specifically about a way to pass table > > or column names to a SQL commands using parameters. > > > The thing that will stop you from using a ta

Re: str(bytes) in Python 3.0

2008-04-12 Thread Dan Bishop
On Apr 12, 9:29 am, Carl Banks <[EMAIL PROTECTED]> wrote: > On Apr 12, 10:06 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > On 12 Apr., 14:44, Christian Heimes <[EMAIL PROTECTED]> wrote: > > > > Gabriel Genellina schrieb: > > > > > On the last line, str(x), I would expect 'abc' - same as str(x,

Re: str(bytes) in Python 3.0

2008-04-12 Thread John Roth
On Apr 12, 8:52 am, [EMAIL PROTECTED] (John J. Lee) wrote: > Christian Heimes <[EMAIL PROTECTED]> writes: > > Gabriel Genellina schrieb: > >> On the last line, str(x), I would expect 'abc' - same as str(x, 'ascii') > >> above. But I get the same as repr(x) - is this on purpose? > > > Yes, it's on p

Re: Multiple independent Python interpreters in a C/C++ program?

2008-04-12 Thread sturlamolden
On Apr 11, 6:24 pm, [EMAIL PROTECTED] wrote: > Do I wind up with two completely independent interpreters, one per thread? > I'm thinking this doesn't work (there are bits which aren't thread-safe and > are only protected by the GIL), but wanted to double-check to be sure. You can create a new sub

Re: Multiple independent Python interpreters in a C/C++ program?

2008-04-12 Thread sturlamolden
On Apr 11, 6:24 pm, [EMAIL PROTECTED] wrote: > Do I wind up with two completely independent interpreters, one per thread? > I'm thinking this doesn't work (there are bits which aren't thread-safe and > are only protected by the GIL), but wanted to double-check to be sure. You can create a new int

Re: Tremendous slowdown due to garbage collection

2008-04-12 Thread andreas . eisele
Sorry, I have to correct my last posting again: > > Disabling the gc may not be a good idea in a real application; I suggest > > you to play with the gc.set_threshold function and set larger values, at > > least while building the dictionary. (700, 1000, 10) seems to yield good > > results. > > py

Re: unittest: which directory structure?

2008-04-12 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Torsten Bronger <[EMAIL PROTECTED]> wrote: > Hallöchen! > > I try to port my doctests to unittest. I've found good turorials > about *writing* unit tests but not about organising the files. > > What's the best way to arrange the test source files? I made a > di

Re: Tremendous slowdown due to garbage collection

2008-04-12 Thread Christian Heimes
[EMAIL PROTECTED] schrieb: > which made me suggest to use these as defaults, but then > Martin v. Löwis wrote that > >> No, the defaults are correct for typical applications. > > At that point I felt lost and as the general wish in that thread was > to move > discussion to comp.lang.python, I bro

Re: str(bytes) in Python 3.0

2008-04-12 Thread Lorenzo Gatti
On Apr 12, 5:51 pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On 12 Apr., 16:29, Carl Banks <[EMAIL PROTECTED]> wrote: > > > > And making an utf-8 encoding default is not possible without writing a > > > new function? > > > I believe the Zen in effect here is, "In the face of ambiguity, refuse > >

Re: Tremendous slowdown due to garbage collection

2008-04-12 Thread John Nagle
[EMAIL PROTECTED] wrote: > In an application dealing with very large text files, I need to create > dictionaries indexed by tuples of words (bi-, tri-, n-grams) or nested > dictionaries. The number of different data structures in memory grows > into orders beyond 1E7. > > It turns out that the def

Re: sqlite3 - adding tables and rows via parameters

2008-04-12 Thread Steve Holden
Vlastimil Brom wrote: > Hi all, > I would like to ask about the usage of sqlite3 in python, more > specifically about a way to pass table > or column names to a SQL commands using parameters. > All examples I could find use > the parameter substitution with "?" for values; is it possible the spe

Re: Tremendous slowdown due to garbage collection

2008-04-12 Thread andreas . eisele
I should have been more specific about possible fixes. > > python2.5 -m timeit 'gc.disable();l=[(i,) for i in range(200)]' > > 10 loops, best of 3: 662 msec per loop > > > python2.5 -m timeit 'gc.enable();l=[(i,) for i in range(200)]' > > 10 loops, best of 3: 15.2 sec per loop > > In the l

Re: Multiple independent Python interpreters in a C/C++ program?

2008-04-12 Thread Rhamphoryncus
On Apr 11, 10:24 am, [EMAIL PROTECTED] wrote: > This question was posed to me today. Given a C/C++ program we can clearly > embed a Python interpreter in it. Is it possible to fire up multiple > interpreters in multiple threads? For example: > > C++ main > thread 1 > Py_I

Re: tkinter, editing an entry, int-value of insert?

2008-04-12 Thread skanemupp
solved this: def Backspace(): st = e.index(INSERT) e.delete(st-1,st) -- http://mail.python.org/mailman/listinfo/python-list

Re: str(bytes) in Python 3.0

2008-04-12 Thread Kay Schluehr
On 12 Apr., 16:29, Carl Banks <[EMAIL PROTECTED]> wrote: > > And making an utf-8 encoding default is not possible without writing a > > new function? > > I believe the Zen in effect here is, "In the face of ambiguity, refuse > the temptation to guess." How do you know if the bytes are utf-8 > enc

sqlite3 - adding tables and rows via parameters

2008-04-12 Thread Vlastimil Brom
Hi all, I would like to ask about the usage of sqlite3 in python, more specifically about a way to pass table or column names to a SQL commands using parameters. All examples I could find use the parameter substitution with "?" for values; is it possible the specify table and column names this way?

Re: accessing individual characters in unicode strings

2008-04-12 Thread hdante
On Apr 12, 9:48 am, Christian Heimes <[EMAIL PROTECTED]> wrote: > Peter Robinson schrieb: > > > Dear list > > I am at my wits end on what seemed a very simple task: > > I have some greek text, nicely encoded in utf8, going in and out of a > > xml database, being passed over and beautifully displaye

unittest: which directory structure?

2008-04-12 Thread Torsten Bronger
Hallöchen! I try to port my doctests to unittest. I've found good turorials about *writing* unit tests but not about organising the files. What's the best way to arrange the test source files? I made a directory called "tests" on the same level as my package, with (roughly) one test module per

Re: [ANN]: Python-by-Example updates

2008-04-12 Thread AK
Max Erickson wrote: > AK <[EMAIL PROTECTED]> wrote: > >> Python-by-Example is a guide to LibRef, aiming to give examples >> for all functions, classes, modules, etc. Right now examples >> for functions in some of the most important modules are >> included. >> >> http://pbe.lightbird.net/ >> >> tha

Re: str(bytes) in Python 3.0

2008-04-12 Thread Christian Heimes
John J. Lee schrieb: > Why hasn't the one-argument str(bytes_obj) been designed to raise an > exception in Python 3? See for yourself: $ ./python Python 3.0a4+ (py3k:0, Apr 11 2008, 15:31:31) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 Type "help", "copyright", "credits"

Re: str(bytes) in Python 3.0

2008-04-12 Thread Christian Heimes
Carl Banks schrieb: > I believe the Zen in effect here is, "In the face of ambiguity, refuse > the temptation to guess." How do you know if the bytes are utf-8 > encoded? Indeed > I'm not sure if str() returning the repr() of a bytes object (when not > passed an encoding) is the right thing, but

Re: str(bytes) in Python 3.0

2008-04-12 Thread John J. Lee
Christian Heimes <[EMAIL PROTECTED]> writes: > Gabriel Genellina schrieb: >> On the last line, str(x), I would expect 'abc' - same as str(x, 'ascii') >> above. But I get the same as repr(x) - is this on purpose? > > Yes, it's on purpose but it's a bug in your application to call str() on > a byt

Re: from __future__ import print

2008-04-12 Thread [EMAIL PROTECTED]
On Apr 10, 3:06 pm, "Andrii V. Mishkovskyi" <[EMAIL PROTECTED]> wrote: > 2008/4/10, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > > Am I the only one that thinks this would be useful? :) > > > I'd really like to be able to use python 3.0'sprintstatement in > > 2.x. Is this at least being considere

Wrapping C++ class with SWIG, Mac OS X

2008-04-12 Thread Paul Anton Letnes
> > Thanks a lot for the comments. So, I post the code, which should let > you recreate the circumstances. I'm on 10.5.2, python2.5 (from > Fink), and got SIP from FINK recently - should be the latest version. > > I know C++ to some extent - the linking is the hardest part for me > to grasp.

Re: str(bytes) in Python 3.0

2008-04-12 Thread Carl Banks
On Apr 12, 10:06 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On 12 Apr., 14:44, Christian Heimes <[EMAIL PROTECTED]> wrote: > > > Gabriel Genellina schrieb: > > > > On the last line, str(x), I would expect 'abc' - same as str(x, 'ascii') > > > above. But I get the same as repr(x) - is this on pur

Re: str(bytes) in Python 3.0

2008-04-12 Thread Martin v. Löwis
> And making an utf-8 encoding default is not possible without writing a > new function? There is no default encoding anymore in Python 3. This is by design, learning from the problems in Python 2.x. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Tremendous slowdown due to garbage collection

2008-04-12 Thread Carl Banks
On Apr 12, 7:02 am, [EMAIL PROTECTED] wrote: > I would suggest to configure the default behaviour of the garbage > collector in such a way that this squared complexity is avoided > without requiring specific knowledge and intervention by the user. Not > being an expert in these details I would like

Re: str(bytes) in Python 3.0

2008-04-12 Thread Kay Schluehr
On 12 Apr., 14:44, Christian Heimes <[EMAIL PROTECTED]> wrote: > Gabriel Genellina schrieb: > > > On the last line, str(x), I would expect 'abc' - same as str(x, 'ascii') > > above. But I get the same as repr(x) - is this on purpose? > > Yes, it's on purpose but it's a bug in your application to ca

Re: segmentation fault when executing PyImport_ImportModule("sys")

2008-04-12 Thread Dietrich Bollmann
Hi, I found the reason for the segmentation fault and hope that my solution might be helpful for somebody else some day :) On Tue, 2008-04-08 at 19:31 +0900, Dietrich Bollmann wrote: Program received signal SIGSEGV, Segmentation fault. > [Switching to Thread 0xb046ab90 (LWP 9854)] > threadstate

Re: Wrapping C++ class with SWIG, Mac OS X

2008-04-12 Thread Diez B. Roggisch
Paul Anton Letnes schrieb: > Okay, installed SIP. Looks promising, following the tutorial on > http://www.riverbankcomputing.com/static/Docs/sip4/sipref.html#using-sip > It should be noted that I am working on a Mac - I know there are some > differences, but it's still UNIX and should work somehow

Re: Tremendous slowdown due to garbage collection

2008-04-12 Thread Steve Holden
[...] > I would suggest to configure the default behaviour of the garbage > collector in such a way that this squared complexity is avoided > without requiring specific knowledge and intervention by the user. Not > being an expert in these details I would like to ask the gurus how > this could be d

Re: accessing individual characters in unicode strings

2008-04-12 Thread Christian Heimes
Peter Robinson schrieb: > Dear list > I am at my wits end on what seemed a very simple task: > I have some greek text, nicely encoded in utf8, going in and out of a > xml database, being passed over and beautifully displayed on the web. > For example: the most common greek word of all 'kai' (o

Re: Wrapping C++ class with SWIG, Mac OS X

2008-04-12 Thread Paul Anton Letnes
Okay, installed SIP. Looks promising, following the tutorial on http://www.riverbankcomputing.com/static/Docs/sip4/sipref.html#using-sip It should be noted that I am working on a Mac - I know there are some differences, but it's still UNIX and should work somehow. Anyway, I copy-paste and create

Re: str(bytes) in Python 3.0

2008-04-12 Thread Christian Heimes
Gabriel Genellina schrieb: > On the last line, str(x), I would expect 'abc' - same as str(x, 'ascii') > above. But I get the same as repr(x) - is this on purpose? Yes, it's on purpose but it's a bug in your application to call str() on a bytes object or to compare bytes and unicode directly. Sev

Re: Multiple independent Python interpreters in a C/C++ program?

2008-04-12 Thread Christian Heimes
Diez B. Roggisch schrieb: > AFAIK there was a thread a few month ago that stated that this is > actually possible - but mostly 3rd-party-c-extension aren't capable of > supporting that. Martin von Loewis had a word in that, maybe googling > with that in mind reveals the discussion. > > And of c

Re: [ANN]: Python-by-Example updates

2008-04-12 Thread Max Erickson
AK <[EMAIL PROTECTED]> wrote: > Python-by-Example is a guide to LibRef, aiming to give examples > for all functions, classes, modules, etc. Right now examples > for functions in some of the most important modules are > included. > > http://pbe.lightbird.net/ > > thanks, > The second set of exa

Re: About __init__ and default arguments

2008-04-12 Thread Scott David Daniels
Nathan Duran wrote: > > On Apr 11, 2008, at 11:35 AM, [EMAIL PROTECTED] wrote: >> I'd like to assign the value of an attribute in __init__ as the default >> value of an argument in a method. See below: > Why not just do > > def franklin(self, keyword): > if not keyword: keyword = self.defaul

Re: C to python conversion

2008-04-12 Thread Paul McGuire
On Apr 12, 5:58 am, Michele Petrazzo <[EMAIL PROTECTED]> wrote: > Hi all, > I'm trying to translate a simple C code into a python + ctypes (where > need), but I have some problems on char conversion. The code have > to work on Linux and talk with the serial port. I think that the problem > is that

tkinter, editing an entry, int-value of insert?

2008-04-12 Thread skanemupp
in this program when using the "c"-button it deletes the last token entered. i want to delete the token after the mousecursor. lets say the string is: 12*(81**.5+12) and i put the cursor between the * and * because i want times .5 not root. now if i press "c" it deletes ")" which is not what i wan

Tremendous slowdown due to garbage collection

2008-04-12 Thread andreas . eisele
In an application dealing with very large text files, I need to create dictionaries indexed by tuples of words (bi-, tri-, n-grams) or nested dictionaries. The number of different data structures in memory grows into orders beyond 1E7. It turns out that the default behaviour of Python is not very

C to python conversion

2008-04-12 Thread Michele Petrazzo
Hi all, I'm trying to translate a simple C code into a python + ctypes (where need), but I have some problems on char conversion. The code have to work on Linux and talk with the serial port. I think that the problem is that I don't translate correctly the strings. C code: #define START 0x33 #defi

Confused about Boost.Python & bjam

2008-04-12 Thread Till Kranz
Hi, I tried to get started with Boost.Python. unfortunately I never used the bjam build system before. As it is explained in the documentation I tried to adapt the the files form the examples directory. I copied 'Jamroot', 'boost_build.jam' and 'extending.cpp' to '~/test/'. But I am lost as to

Re: accessing individual characters in unicode strings

2008-04-12 Thread John Machin
On Apr 12, 3:45 pm, Peter Robinson <[EMAIL PROTECTED]> wrote: > Dear list > I am at my wits end on what seemed a very simple task: > I have some greek text, nicely encoded in utf8, going in and out of a > xml database, being passed over and beautifully displayed on the web. > For example: the most

Re: [ANN]: Python-by-Example updates

2008-04-12 Thread AK
Méta-MCI (MVP) wrote: > Hi! > Good! Thanks. > I found a bad link, for "traceback module" > @-salutations > > Michel Claveau > You're right! I forgot to upload that file, it's fixed now - thanks for noticing! -- -ak Tobu | http://tobu.lightbird.net/ | Freeform DB / Tagger / PIM Python-by-

Re: [ANN]: Python-by-Example updates

2008-04-12 Thread M�ta-MCI (MVP)
Hi! Good! Thanks. I found a bad link, for "traceback module" @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list