Re: zip() function troubles

2007-07-27 Thread Terry Reedy
"Istvan Albert" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | On Jul 27, 2:18 pm, Raymond Hettinger <[EMAIL PROTECTED]> wrote: | | >> What was really surprising is that it works | >> with no issues up until 1 million items" | | later editing made the sentence more difficult to rea

Is access to locals() of "parent" namespace possible?

2007-07-27 Thread André
I want to give a user the possibility of "restarting" an interactive session, by removing all the objects defined by her since the beginning. The way I make this possible is by having a "function" that can be called during the interactive session using locals() as an argument, as follows: restart

Re: Is access to locals() of "parent" namespace possible?

2007-07-27 Thread André
On Jul 27, 6:01 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Fri, 2007-07-27 at 20:46 +, André wrote: > > I want to give a user the possibility of "restarting" an interactive > > session, by removing all the objects defined by her since the > > beginning. The way I make this possible is b

Re: Another C API Question

2007-07-27 Thread beginner
On Jul 27, 11:37 am, Farshid Lashkari <[EMAIL PROTECTED]> wrote: > beginner wrote: > > This works with PyFloat only. It does not work with integers. > > Did you try it out? I have used it on ints, bools, and objects that > implement the __float__ method. It does not work on strings though. I did a

Re: C API -- Two questions

2007-07-27 Thread beginner
On Jul 27, 1:23 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Fri, 27 Jul 2007 00:34:22 +, beginner wrote: > > 2) How can I make the arguments less picky without writing a lot of > > type conversion code? My function really needs a tuple as its > > argument. For example, f( (1,2,

Re: Is access to locals() of "parent" namespace possible?

2007-07-27 Thread Carsten Haese
On Fri, 2007-07-27 at 20:46 +, André wrote: > I want to give a user the possibility of "restarting" an interactive > session, by removing all the objects defined by her since the > beginning. The way I make this possible is by having a "function" > that can be called during the interactive ses

Process Control Help

2007-07-27 Thread tylerca
I'm attempting to start some process control using Python. I've have quite a bit of literature on networking, and have made some tinkering servers and clients for different protocols HTTP, FTP, etc... But now it's time for the murky web of industrial protocol. I'm looking to start with IO and s

Tkinter program with a usable interpreter console

2007-07-27 Thread beginner
Hi everyone, I have a question about Tkinter programs. What I want is a GUI window along with an interpreter window, so that I can do things by clicking on the GUI or typing commands in the interpreter console. For example, I wish I can type in the console: >>> modify_my_key_data() >>> update_gui

Tkinter -- Show Data in an Excel like Read-Only Grid

2007-07-27 Thread beginner
Hi All, I am really new to Tk and Tkinter. I googled the web but it was not mentioned how to build a data grid with Tkinter. Basically, I want to show an excel like data grid with fixed column and row headers and sortable columns. But the grids can be read-only. Can anyone give some hint on impl

Re: Problem embedding in small Win32 App

2007-07-27 Thread Brad Johnson
Gabriel Genellina yahoo.com.ar> writes: > > By far, the most common problem extending/embedding Python is to do wrong > reference counts. > Read http://docs.python.org/ext/refcounts.html again (I hope you already > did!) and make sure you don't hold a pointer to an object without > increme

"struct" module problem w/ pyinstaller

2007-07-27 Thread Keith
Hello, I am trying to create exectuables on inux using "pyinstaller". I am using pyinstaller-1.3, RHEL 4.4, Python 2.5. The executables fail to run. The problem returned is pertaining to "struct.py" not being able to find the module "_struct". struct.py is located under /usr/local/lib/python-2.5

Re: Another C API Question

2007-07-27 Thread beginner
On Jul 27, 4:50 pm, Farshid Lashkari <[EMAIL PROTECTED]> wrote: > beginner wrote: > > I did and it did not seem to work. I ended up doing the following. > > Verbose, isn't it? > > If I do d=PyFloat_AsDouble(oDiscount); in the third "if", I get an > > error. Maybe I missed something obvious. > > Tha

Re: Another C API Question

2007-07-27 Thread beginner
On Jul 27, 4:50 pm, Farshid Lashkari <[EMAIL PROTECTED]> wrote: > beginner wrote: > > I did and it did not seem to work. I ended up doing the following. > > Verbose, isn't it? > > If I do d=PyFloat_AsDouble(oDiscount); in the third "if", I get an > > error. Maybe I missed something obvious. > > Tha

problem with change to exceptions

2007-07-27 Thread Neal Becker
import exceptions class nothing (exceptions.Exception): def __init__ (self, args=None): self.args = args if __name__ == "__main__": raise nothing Traceback (most recent call last): File "", line 1, in File "/usr/tmp/python-3143hDH", line 5, in __init__ self.args = args T

Packages

2007-07-27 Thread Kevin T. Ryan
Hi All - I'm having a problem and I hope you can help. I can't seem to import packages from within the package substructure as I think I should be able to. For example, I create a directory structure as follows: testpkg __init__.py [empty] testsub1/ __init__.py [empty] bad.py [impor

Re: Another C API Question

2007-07-27 Thread Farshid Lashkari
beginner wrote: > I did and it did not seem to work. I ended up doing the following. > Verbose, isn't it? > If I do d=PyFloat_AsDouble(oDiscount); in the third "if", I get an > error. Maybe I missed something obvious. That's strange. I just tried the following code: fprintf(stdout,"True = %lf\n",

Re: problem with change to exceptions

2007-07-27 Thread Paul Rubin
Neal Becker <[EMAIL PROTECTED]> writes: > TypeError: 'NoneType' object is not iterable > I'll have to say, I don't understand this error. It's "lame duck typing". The .args attribute on an Exception instance is expected to be a tuple of the arguments passed through the raise statement. It is Non

Re: Relative-importing *

2007-07-27 Thread Ben Finney
[EMAIL PROTECTED] writes: > from . import * > from .sibiling import * > from .. import * > from ..parent_sibling import * > > ...and so on. The same error occurs: > SyntaxError: 'import *' not allowed with 'from .' Interesting. I know that 'from foo import *' is frowned on an

Re: C++ Modules for python: How to?

2007-07-27 Thread Robert Dailey
On Jul 6, 7:39 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Jul 7, 9:26 am,RobertDailey<[EMAIL PROTECTED]> wrote: > > > > > On Jul 6, 3:06 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > > >RobertDaileyschrieb: > > > > > Hi, > > > > > I'm interested in making a C++ library of mine usable t

Re: Packages

2007-07-27 Thread Alex Popescu
"Kevin T. Ryan" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Hi All - > > I'm having a problem and I hope you can help. I can't seem to import > packages from within the package substructure as I think I should be > able to. For example, I create a directory structure as follows: >

Re: Tkinter program with a usable interpreter console

2007-07-27 Thread Ivan Johansen
beginner wrote: > The problem is that the Tkinter program ends with a .mainloop() call > and it is not going to give back control to the command prompt. I feel > it is almost like I need to implement the python shell myself. Is > there any better way of doing this? Take a look at this: http://lfw.

Re: problem with change to exceptions

2007-07-27 Thread Alex Popescu
Neal Becker <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > import exceptions > > class nothing (exceptions.Exception): > def __init__ (self, args=None): > self.args = args > > if __name__ == "__main__": > raise nothing > > Traceback (most recent call last): > File "",

Re: OOP in Python book?

2007-07-27 Thread Dick Moores
At 08:41 AM 7/27/2007, Bill wrote: >Does anyone out there have any information about this book. It's >listed on Amazon to be published in November of this year. A simple >Google search (1st page only) doesn't show anything useful, and I >can't find a reference on the web sites of the authors. Neith

Re: Relative-importing *

2007-07-27 Thread Alex Popescu
Ben Finney <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > [EMAIL PROTECTED] writes: > >> from . import * >> from .sibiling import * >> from .. import * >> from ..parent_sibling import * >> >> ...and so on. The same error occurs: >> SyntaxError: 'import *' not allowed

Re: problem with change to exceptions

2007-07-27 Thread Neal Becker
Alex Popescu wrote: > Neal Becker <[EMAIL PROTECTED]> wrote in > news:[EMAIL PROTECTED]: > >> import exceptions >> >> class nothing (exceptions.Exception): >> def __init__ (self, args=None): >> self.args = args >> >> if __name__ == "__main__": >> raise nothing >> >> Traceback (

Re: C++ Modules for python: How to?

2007-07-27 Thread Robert Dailey
Okay I've actually got it compiling now, however it is saying it can't find "stdio.h" (No such file or directory). This means it doesn't know where the include directories are. How do I specify include directories? -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with change to exceptions

2007-07-27 Thread Paul Rubin
Neal Becker <[EMAIL PROTECTED]> writes: > should set self.args to None. Nothing wrong there, and what has this got to > do with NoneType being iterable? Probably the traceback constructor tried to iterate through the args. You should initialize the args to an empty tuple, not None. Also note th

Re: Comparing Dictionaries

2007-07-27 Thread Steven D'Aprano
On Fri, 27 Jul 2007 14:11:02 -0500, Kenneth Love wrote: > The published recipe (based on ConfigParser) did not handle my INI > files. I have periods in both the section names and the key names. > The INI files contents were developed according to an internally > defined process that other non-Pyt

Re: adding a docstring to an instancemethod

2007-07-27 Thread Steven D'Aprano
On Fri, 27 Jul 2007 06:24:48 -0300, Gabriel Genellina wrote: > En Thu, 26 Jul 2007 14:48:12 -0300, jelle <[EMAIL PROTECTED]> > escribió: > >> Hi Gabriella, >> thanks for pointing me in the right direction: > > Twice in a week... I'll have to revise my own masculinity... You need to spit and f

Re: curses/urwid simple menu

2007-07-27 Thread Lee Harr
> SGVsbG8uIENvdWxkIHlvdSBoZWxwIG1lLi4uSSBuZWVkIHRvIGNyZWF0ZSBhcHBsaWNhdGlvbiB3 > aXRoIHVyd2lkIG9yIGN1cnNlcwpzdXBwb3J0LiBIYXZlIHlvdSBnb3QgYSBwcmV0dHkgc2ltcGxl > IGV4YW1wbGUgd2l0aCBpdD8KCgotLSAKUG96ZHJhd2lhbSBMZXN6ZWsgTWm2Ck5vdGhpbmcgaXMg > c2VjdXJlLCBwYXJhbm9pYSBpcyB5b3VyIGZyaWVuZC4K >>> s = >>>

Re: Factory pattern again

2007-07-27 Thread Steve Holden
[EMAIL PROTECTED] wrote: > first you need find the bottleneck of your script db or function > if the bottleneck is db > 1. which db do you use do you optimize the db from read > 2. the sql you write do not use any index "maybe select code, type > from products where type = 'I' or type = 'S' will he

Re: removing items from a dictionary ?

2007-07-27 Thread Steven D'Aprano
On Thu, 26 Jul 2007 21:38:31 +0200, martyw wrote: > Remoing elements from a dict is done with del, try this; > >>> d = {'a' : 1,'b' : 2} > >>> del d['a'] > >>> print d > {'b': 2} > >>> > > maybe you can post a working snippet to demonstrate your problem Wow. This wins my award for the least

Re: problem with change to exceptions

2007-07-27 Thread Alex Popescu
Neal Becker <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Alex Popescu wrote: > >> Neal Becker <[EMAIL PROTECTED]> wrote in >> news:[EMAIL PROTECTED]: >> > > [snip...] > >>> >> >> You can pass to the exception: >> a) a string (it will become the message) >> b) a tuple of values (can

Re: Packages

2007-07-27 Thread Kevin T. Ryan
On Jul 27, 7:21 pm, Alex Popescu <[EMAIL PROTECTED]> wrote: > "Kevin T. Ryan" <[EMAIL PROTECTED]> wrote innews:[EMAIL PROTECTED]: > > > > > Hi All - > > > I'm having a problem and I hope you can help. I can't seem to import > > packages from within the package substructure as I think I should be >

Re: a simple string question

2007-07-27 Thread Zentrader
On Jul 27, 11:26 am, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > >> If I understand you correctly you want to replace ";" by ";\n" and ":" > >> by ":\n\t\t\t\t\t\t\t". > >> Well guess what? The replace() method does just this. Have a read: > >> http://docs.python.o

pythonic parsing of URL

2007-07-27 Thread GreenH
I get some string as below from a library method (qt3 QDropEvent.data()) I use. file:///C:/Documents%20and%20Settings/Username/My%20Documents/45-61-Abc%20fold-%20den.vru I need file path on my system, for the above example: C:/Documents and Settings/Username/My Documents/45-61-Abc fold- den.vru I

Re: Imported globals?

2007-07-27 Thread anethema
> It seems that in the first case change_value() called in module_b.py > ignores the global statement. Is it so? Why? What happens in the second > case? I really don't get it. The key is that it doesn't ignore the global statement, but that global specifically points to the variable 'value' in mod

Re: Imported globals?

2007-07-27 Thread Valentina Vaneeva
Thank you all, guys. I think, now I understand import behavior more :) Cheers, Valia -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter -- Show Data in an Excel like Read-Only Grid

2007-07-27 Thread Zentrader
On Jul 27, 2:56 pm, beginner <[EMAIL PROTECTED]> wrote: > Hi All, > > I am really new to Tk and Tkinter. I googled the web but it was not > mentioned how to build a data grid with Tkinter. > > Basically, I want to show an excel like data grid with fixed column > and row headers and sortable columns

Re: Removing certain tags from html files

2007-07-27 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: > I'm doing a little script with the help of the BeautifulSoup HTML > parser and uTidyLib (HTML Tidy warper for python). > > Essentially what it does is fetch all the html files in a given > directory (and it's subdirectories) clean the code with Tidy (removes > deprecated

Re: pythonic parsing of URL

2007-07-27 Thread Steven D'Aprano
On Sat, 28 Jul 2007 03:10:32 +, GreenH wrote: > I get some string as below from a library method (qt3 > QDropEvent.data()) I use. > file:///C:/Documents%20and%20Settings/Username/My%20Documents/45-61-Abc%20fold-%20den.vru > > I need file path on my system, for the above example: > C:/Document

Re: a simple string question

2007-07-27 Thread Zentrader
> > [EMAIL PROTECTED] wrote: > > > NEW TEXT : "Hello world;\nHello:\n\t\t\n\n\n\n\n\nHello2" If you are doing all of this to format the output into columns, Python's print() or write() will do this, and is easier as well. Some more info on what you want to do will clear things up. -- http://ma

Re: 128 or 96 bit integer types?

2007-07-27 Thread Tim Roberts
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > >On Jul 27, 1:27 pm, Peter Otten <[EMAIL PROTECTED]> wrote: >> Robert Dailey wrote: >> > Is there build-in or third party support for large integer types, such >> > as 96 or 128 bits in size? I require such large sizes for precision >> > issues (nano

Re: Relative-importing *

2007-07-27 Thread Steven D'Aprano
On Sat, 28 Jul 2007 09:05:51 +1000, Ben Finney wrote: > [EMAIL PROTECTED] writes: > >> from . import * >> from .sibiling import * >> from .. import * >> from ..parent_sibling import * >> >> ...and so on. The same error occurs: >> SyntaxError: 'import *' not allowed with 'from

slow emails

2007-07-27 Thread Gabriel Dragffy
Whenever I post to this list my email invariably takes ages to show up - perhaps two days or so. Often times not at all. Why is this? I am subscribed to Ubuntu mail list which is also high traffic, and my posts show up there within minutes. Thanks. Gabriel Dragffy [EMAIL PROTECTED] --

Re: Reading data from an ISA port

2007-07-27 Thread Gabriel Dragffy
On 23 Jul 2007, at 23:09, Diez B. Roggisch wrote: > Gabriel Dragffy schrieb: >> Dear list members >> >> I must admit I am a new user of Python, but it is a language that I >> enjoy using. >> >> For one of my university projects I need to write a program that can >> read several bytes from an ISA

<    1   2