The file executing

2007-07-02 Thread Benjamin
How does one get the path to the file currently executing (not the cwd). Thank you -- http://mail.python.org/mailman/listinfo/python-list

Re: The file executing

2007-07-03 Thread Benjamin
On Jul 2, 9:47 pm, Justin Ezequiel <[EMAIL PROTECTED]> wrote: > On Jul 3, 9:40 am, Benjamin <[EMAIL PROTECTED]> wrote: > > > How does one get the path to the file currently executing (not the > > cwd). Thank you > > os.path.dirname(sys.argv[0]) The returns the

Re: The file executing

2007-07-06 Thread Benjamin
On Jul 3, 8:56 am, Sebastian Wiesner <[EMAIL PROTECTED]> wrote: > [ Benjamin <[EMAIL PROTECTED]> ] > > > On Jul 2, 9:47 pm, Justin Ezequiel <[EMAIL PROTECTED]> > > > wrote: > > > On Jul 3, 9:40 am, Benjamin <[EMAIL PROTECTED]> wrote: &

Re: The file executing

2007-07-09 Thread Benjamin
On Jul 9, 6:42 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 06 Jul 2007 17:15:22 -0300, Benjamin <[EMAIL PROTECTED]> > escribió: > > >> > > > How does one get the path to the file currently executing (not the > >&

wxPython, threads, and search engine

2007-07-17 Thread Benjamin
I'm writing a search engine in Python with wxPython as the GUI. I have the actual searching preformed on a different thread from Gui thread. It sends it's results through a Queue to the results ListCtrl which adds a new item. This works fine or small searches, but when the results number in the hun

wxPython and threads

2007-07-17 Thread Benjamin
I'm writing a search engine in Python with wxPython as the GUI. I have the actual searching preformed on a different thread from Gui thread. It sends it's results through a Queue to the results ListCtrl which adds a new item. This works fine or small searches, but when the results number in the hun

wxPython, searching, and threads

2007-07-18 Thread Benjamin
Hello! I am writing a search engine with wxPython as the GUI. As the search thread returns items, it adds them to a Queue which is picked up by the main GUI thread calling itself recursively with wx.CallAfter. These are then added to a ListCtrl. This works fine for small searches, but with larger a

wxPython, searching, and threads

2007-07-18 Thread Benjamin
Hello! I am writing a search engine with wxPython as the GUI. As the search thread returns items, it adds them to a Queue which is picked up by the main GUI thread calling itself recursively with wx.CallAfter. These are then added to a ListCtrl. This works fine for small searches, but with larger a

Re: Start

2007-05-19 Thread Benjamin
On May 19, 10:18 am, Nautilus <[EMAIL PROTECTED]> wrote: > Can anybody halp me start using Python. First you'll need to download Python. You can do that at http://www.python.org. Then download and read the tutorial at http://python.org/doc/. -- http://mail.python.org/mailman/listinfo/python-list

Re: Any python module for Traversing HTML files

2007-07-24 Thread Benjamin
On Jul 24, 12:12 pm, johnny <[EMAIL PROTECTED]> wrote: > Any python module for navigating and selecting, parsing HTML files? htmlparse -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython - How to add sorting to a ListCtrl?

2007-07-24 Thread Benjamin
On Jul 24, 11:21 am, Robert Dailey <[EMAIL PROTECTED]> wrote: > Hi, > > I have 3 columns in my list control, each with a different "type" of > data (for example, one column has names, the other has dates, etc). > Can anyone reference a tutorial for solving this issue? I've done my > share of googli

Re: Learning Jython?

2007-07-26 Thread Benjamin
Paul Rubin wrote: > Matt Bitten <[EMAIL PROTECTED]> writes: > > It looks like Jython is for me. That said, I have two questions: > > (1) Am I thinking straight here? Or is there some other solution that > > a knows-Python-but-not-Java programmer might use? You could convert to the whole world to u

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

2007-07-28 Thread Benjamin
On Jul 27, 4: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

Icons for GUI development

2007-08-13 Thread Benjamin
I'm developing a mail client. Since GUI are usually improved with some icons, I'm looking for some. Because I'm not a very gifted artist I'm searching for a library of GPL or public domain icons. Any suggestions? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python question (PyNoob)

2007-08-19 Thread Benjamin
On Aug 19, 7:33 pm, Anonymous <[EMAIL PROTECTED]> wrote: > I have exp with C/C++ (and a few other langs). I want to use Python to > start doing the ff: > > 1). Data Munging (text processing) - instead of Perl > 2). Automating my build process > 3). (Possibly) some web data retrieval jobs > > Can an

Re: IDE for Python

2007-08-21 Thread Benjamin
On Aug 21, 5:00 am, Joel Andres Granados <[EMAIL PROTECTED]> wrote: > Hello list: > > I have tried various times to use an IDE for python put have always been > disapointed. > I haven't revisited the idea in about a year and was wondering what the > python people > use. > I have also foundhttp://pi

Re: The folder a script is executed in

2007-08-21 Thread Benjamin
On Aug 21, 4:10 am, [EMAIL PROTECTED] wrote: > Hi, > > How do I find out what folder a script is in while it is executing? > > For example, for the file "C:/folder/script.py" contain the following > two lines of code - > > myLocation = GetMyLocation() > print myLocation def GetMyLocation(): run

Re: The folder a script is executed in

2007-08-22 Thread Benjamin
On Aug 21, 10:23 am, Benjamin <[EMAIL PROTECTED]> wrote: > On Aug 21, 4:10 am, [EMAIL PROTECTED] wrote:> Hi, > > > How do I find out what folder a script is in while it is executing? > > > For example, for the file "C:/folder/script.py" con

Re: Spell-checking Python source code

2007-09-09 Thread Benjamin
On Sep 8, 4:04 pm, John Zenger <[EMAIL PROTECTED]> wrote: > To my horror, someone pointed out to me yesterday that a web app I > wrote has been prominently displaying a misspelled word. The word was > buried in my code. > > Is there a utility out there that will help spell-check literal > strings

Re: stopping a while True: with the keyboard

2007-09-25 Thread Benjamin
On Sep 25, 8:19 pm, patrick <[EMAIL PROTECTED]> wrote: > hi all, > > i am looking for a way to break a while True: when pressing "s" on my > keyboard. how can i do this? > > pat Ctrl-C -- http://mail.python.org/mailman/listinfo/python-list

Re: developing an application

2007-09-27 Thread Benjamin
On Sep 27, 5:06 pm, yadin <[EMAIL PROTECTED]> wrote: > hi! > i was buiding an application using python...a program > this was my first one...now that i got it working perfectly > how can i put the bunch of files into one package? > the user of the appliation will not know where to start? that is wh

Re: gui toolkits: the real story? (Tkinter, PyGTK, etc.)

2007-10-01 Thread Benjamin
On Oct 1, 8:04 pm, bramble <[EMAIL PROTECTED]> wrote: > What is the backstory to why Python includes Tk bindings, as opposed > to some other set of bindings? > > I've written a few little Tkinter-based apps, and it's nice and > simple. I like it well enough. That said though, I keep feeling the > g

Jython import coventions

2007-10-09 Thread Benjamin
When importing Java packages in Jython, what is the convention to simplify imports? For example: import java.util as util Is this correct? Or should I use from * import *? -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbi Q: What is a rational for strings not being lists in Python?

2007-10-15 Thread Benjamin
On Oct 15, 3:03 pm, "Matt McCredie" <[EMAIL PROTECTED]> wrote: > On 10/15/07, Dmitri O.Kondratiev <[EMAIL PROTECTED]> wrote: > > > > > To clarify my point: > > reverse() is a lucky one - Python has variants of *this particular* > > function both for lists and strings. Yet what about other list f

SIP won't compile on OSX 10.3

2007-11-05 Thread Benjamin
Hi! I'm trying to install SIP on my Mac with the eventual aim of installing PyQt. The "python configure.py" stage works fine, but when I type make this is what I see: cc -c -pipe -Os -w -I. -o main.o main.c cc -c -pipe -Os -w -I. -o transform.o transform.c cc -c -pipe -Os -w -I. -o gencode.o gencod

Re: Interfaces.

2007-11-16 Thread Benjamin
On Nov 15, 7:55 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > > Does anyone know what the state of progress with interfaces for python > (last I can see ishttp://www.python.org/dev/peps/pep-0245/) > > I would argue that interfaces/(similar feature) are necessary in any > modern languag

Buffer type

2007-11-21 Thread Benjamin
What's the point of the built in buffer type? The documentation (http://docs.python.org/lib/typesseq.html) is not very enlightening. -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter, wxPython, PyGtk, or PyQt...

2007-11-28 Thread Benjamin
John Jameson wrote: > hi carl, > > I'm totally new with graphics for python. I'm using windows, but you > make it sound like I need to know how to program with MFC to use them? > Is this true? Can't you just stay in python? Yes, all of the libraries below let you stay in Python. (They have binary

Bundling Python on Mac

2007-11-28 Thread Benjamin
Hello, I'm writing a Python/PyQt application. For my Mac distribution. I would like to include all the needed libraries in the Mac bundle. How should I go about doing this? -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter, wxPython, PyGtk, or PyQt...

2007-11-29 Thread Benjamin
On Nov 29, 11:53 am, gsal <[EMAIL PROTECTED]> wrote: > is PyQt related to Qt? I presume so. I sure that if it wasn't, Trolltech would be on their back... > > is Qt needed for PyQt? > > is PyQt usable in all platforms Python is available and is it GPLed, > too? > > I read TrollTech webpage on QT and

Re: Bundling Python on Mac

2007-11-29 Thread Benjamin
On Nov 29, 2:34 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Benjamin schrieb: > > > Hello, I'm writing a Python/PyQt application. For my Mac distribution. > > I would like to include all the needed libraries in the Mac bundle. > > How should I

Re: Bundling Python on Mac

2007-11-30 Thread Benjamin
On Nov 30, 6:48 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Benjamin schrieb: > > > On Nov 29, 2:34 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> Benjamin schrieb: > > >>> Hello, I'm writing a Python/PyQt ap

Re: pdf library.

2007-12-29 Thread Benjamin
On Dec 29, 12:54 pm, Shriphani <[EMAIL PROTECTED]> wrote: > Hi, > I am looking for a pdf library that will give me a list of pages where > new chapters start. Can someone point me to such a module ? ReportLab (ReportLab) might help. > Regards, > Shriphani P. -- http://mail.python.org/mailman/list

Re: Mix different C source files into a single one

2007-12-29 Thread Benjamin
On Dec 29, 12:05 pm, Horacius ReX <[EMAIL PROTECTED]> wrote: > Hi, > > I have a C program split into different source files. I am trying a > new compiler and for some reason it only accepts a single source file. > So I need to "mix" all my different C source files into a single one. That sounds lik

Re: What is the best way to do dynamic imports ?

2007-12-30 Thread Benjamin
On Dec 30, 8:24 am, [EMAIL PROTECTED] wrote: > Hi list and python gurus :-) > > I'm playing with some mod_python and web development. And in me code I > need to do som dynamic imports. > Right now I just do a: > > exec 'import '+some_modulename The correct way to do this is use the __import__ funct

Re: reassign to builtin possible !?

2008-01-03 Thread Benjamin
On Jan 3, 7:04 am, Bernhard Merkle <[EMAIL PROTECTED]> wrote: > Hi there, > > I am reading Learning Python 3e from Mark Lutz and just found out that > reassigning to builtins is possible. > What is the reason, why Python allows this ? IMO this is very risky > and can lead to hard to find errors. I

Re: Detecting OS platform in Python

2008-01-10 Thread Benjamin
On Jan 10, 8:37 pm, Devraj <[EMAIL PROTECTED]> wrote: > Hi everyone, > > My Python program needs reliably detect which Operating System its > being run on, infact it even needs to know which distribution of say > Linux its running on. The reason being its a GTK application that > needs to adapt its

Re: "env" parameter to "popen" won't accept Unicode on Windows - minor Unicode bug

2008-01-14 Thread Benjamin
On Jan 14, 6:26 pm, John Nagle <[EMAIL PROTECTED]> wrote: > I passed a dict for the "env" variable to Popen with Unicode strings > for the dictionary values. > > Got: > >File "D:\Python24\lib\subprocess.py", line 706, in _execute_child > TypeError: environment can only contain s

Re: "env" parameter to "popen" won't accept Unicode on Windows - minor Unicode bug

2008-01-14 Thread Benjamin
On Jan 14, 6:26 pm, Bjoern Schliessmann wrote: > John Nagle wrote: > > It turns out that the strings in the "env" parameter have to be > > ASCII, not Unicode, even though Windows fully supports Unicode in > > CreateProcess. > > Are you sure it supports Unicode, not UTF8 or UTF16? Probably using >

Unique thread ID

2008-01-17 Thread Benjamin
Is there a way to obtain a unique ID for the current thread? I have an object that I need to store local thread data in, and I don't want to use threading.local because each thread might have multiple instances of my object. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to create graphs an embed them in GUI?

2008-01-17 Thread Benjamin
On Jan 17, 10:07 am, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > On 2008-01-17, Heiko Niedermeyer <[EMAIL PROTECTED]> wrote: > > > As I'm learning Python from scratch, I don't care wether to use (=learn) > > TKinter or PyQt or whatever, I just need some advice, which suits my > > needs best. > > It

Re: Unique thread ID

2008-01-18 Thread Benjamin
On Jan 18, 2:31 am, Christian Heimes <[EMAIL PROTECTED]> wrote: > Benjamin wrote: > > Is there a way to obtain a unique ID for the current thread? I have an > > object that I need to store local thread data in, and I don't want to > > use threading.local because

Re: Unique thread ID

2008-01-18 Thread Benjamin
On Jan 18, 8:31 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 18 Jan 2008 22:41:47 -0300, Benjamin <[EMAIL PROTECTED]> > escribió: > > > On Jan 18, 2:31 am, Christian Heimes <[EMAIL PROTECTED]> wrote: > >> Benjamin wrote: > &g

Re: read files

2008-01-21 Thread Benjamin
On Jan 21, 9:08 pm, Mel <[EMAIL PROTECTED]> wrote: > J. Peng wrote: > > first I know this is the correct method to read and print a file: > > > fd = open("/etc/sysctl.conf") > > done=0 > > while not done: > > line = fd.readline() > > if line == '': > > done = 1 > > else: > >

Cleanup when a object dies

2008-01-22 Thread Benjamin
I writing writing a class to allow settings (options, preferences) to written file in a cross platform manner. I'm unsure how to go a about syncing the data to disk. Of course, it's horribly inefficient to write the data every time something changes a value, however I don't see how I can do it on d

Re: Cleanup when a object dies

2008-01-23 Thread Benjamin
On Jan 22, 11:29 pm, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > On Jan 22, 7:54 pm, Benjamin <[EMAIL PROTECTED]> wrote: > > > I writing writing a class to allow settings (options, preferences) to > > written file in a cross platform manner. I'm unsure how to

Re: Convert list to file object without creating an actual file.

2008-01-24 Thread Benjamin
On Jan 24, 8:57 pm, Bart Kastermans <[EMAIL PROTECTED]> wrote: > I have written a little program that takes as input a text file, > converts > it to a list with appropriate html coding (making it into a nice > table). > Finally I want to upload this list as a textfile using ftp. > > If homeworkhtm

Re: refcount

2008-01-29 Thread Benjamin
On Jan 29, 5:46 am, Christian Heimes <[EMAIL PROTECTED]> wrote: > Simon Pickles wrote: > > Hi, > > > Is is possible to access the refcount for an object? > > > Ideally, I am looking to see if I have a refcount of 1 before calling del > > Help on built-in function getrefcount in module sys: > > getr

Re: Python GUI toolkit

2008-02-03 Thread Benjamin
On Feb 3, 10:55 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-02-03, Torsten Bronger <[EMAIL PROTECTED]> wrote: > > > Hallöchen! > > > [EMAIL PROTECTED] writes: > > >> [...] > > >> the only remaining are qt4 and wx, i would like to know if one of > >> these or any other toolkit is capable

Re: Edit Python code programmatically

2008-02-09 Thread Benjamin
On Feb 9, 5:47 am, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: > 2008/2/9, Alex <[EMAIL PROTECTED]>: > > > Which library could you recommend to perform simple editing of Python > > code (from Python program)? For example, open *.py file, find specific > > function definition, add another function

Re: Passing a callable object to Thread

2008-02-15 Thread Benjamin
On Feb 15, 6:51 pm, skawaii <[EMAIL PROTECTED]> wrote: > On Feb 15, 7:23 pm, Paul Rubin wrote: > > > t = th.Thread(target=tribalwars.populate_all_tribes, args=("data/w7/",)) > > Thanks, that did it. After playing around in the interpreter a bit, I > realize now that args

Re: Passing a callable object to Thread

2008-02-16 Thread Benjamin
On Feb 15, 9:31 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Fri, 2008-02-15 at 19:21 -0800, Benjamin wrote: > > You could type args=tuple("data/w7/"). > > That will produce an 8-tuple containing single-character strings, not a > 1-tuple containing one st

flattening a dict

2008-02-16 Thread Benjamin
How would I go about "flattening" a dict with many nested dicts within? The dicts might look like this: {"mays" : {"eggs" : "spam"}, "jam" : {"soda" : {"love" : "dump"}}, "lamba" : 23 } I'd like it to put "/" inbetween the dicts to make it a one dimensional dict and look like this: {"mays/eggs" : "

Re: flattening a dict

2008-02-21 Thread Benjamin
On Feb 17, 6:18 am, Terry Jones <[EMAIL PROTECTED]> wrote: > Hi Arnaud & Benjamin > > Here's a version that's a bit more general. It handles keys whose values > are empty dicts (assigning None to the value in the result), and also dict > keys that are not stri

Re: flattening a dict

2008-02-21 Thread Benjamin
On Feb 21, 9:13 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Feb 21, 8:04 pm, Benjamin <[EMAIL PROTECTED]> wrote: > > > > > On Feb 17, 6:18 am, Terry Jones <[EMAIL PROTECTED]> wrote: > > > > Hi Arnaud & Benjamin > > > > Here

Re: Permission to use Mac OS 'rocketship' dock icon?

2008-02-28 Thread Benjamin
On Feb 28, 3:37 pm, "Anand Patil" <[EMAIL PROTECTED]> wrote: > Hi all, > > The image of a rocket with the Python logo that occasionally shows up > in the dock would make part of a nice logo for PyMC, an open-source > Python Bayesian statistics package. Anyone know who we would have to > ask to get

Re: metaclasses

2008-03-03 Thread Benjamin
On Mar 3, 7:12 pm, [EMAIL PROTECTED] wrote: > What are metaclasses? Depends on whether you want to be confused or not. If you do, look at this old but still head bursting essay: http://www.python.org/doc/essays/metaclasses/. Basically, the metaclass of a (new-style) class is responsible for crea

Re: execute

2008-03-09 Thread Benjamin
On Mar 9, 4:22 pm, Gif <[EMAIL PROTECTED]> wrote: > i'm trying to execute a file without replacing the current process, > but after searching the help file, documentations and the web, i can't > a way of doing that. > > os.exec*() will close the current program. Have a look at the subprocess module

Re: wxPython/wxWidgets ok for production use ?

2008-03-10 Thread Benjamin
On Mar 10, 2:11 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Malcolm Greene wrote: > >> My personal experience with wxPython has its ups and downs. Specifically > >> when it comes to crashes, I wouldn't bet my life on it. > > > I'm new to Python and getting ready to build a small client based > >

Re: os.path.isdir question

2008-03-15 Thread Benjamin
On Mar 15, 8:12 pm, lampshade <[EMAIL PROTECTED]> wrote: > Hello, > > I'm having some problems with os.path.isdir I think it is something > simple that I'm overlooking. > > #!/usr/bin/python > import os > > my_path = os.path.expanduser("~/pictures/") > print my_path > results = os.listdir(my_path

Re: 'join' in the wrong word for the method in class Thread.

2008-03-15 Thread Benjamin
On Mar 15, 7:29 pm, [EMAIL PROTECTED] wrote: > 'join' in the wrong word for the method in class Thread. > > The agent-patient semantics of calling functions can get ambiguous. > It is not a problem of native Pythoners alone. Is it due to lazy > programming, an inability of English (do you have it

Re: os.path.isdir question

2008-03-16 Thread Benjamin
On Mar 16, 2:27 pm, MRAB <[EMAIL PROTECTED]> wrote: > On Mar 16, 2:27 am, Benjamin <[EMAIL PROTECTED]> wrote: > > > On Mar 15, 8:12 pm, lampshade <[EMAIL PROTECTED]> wrote:> Hello, > > > > I'm having some problems with os.path.isdir I think

Re: Using threads in python is safe ?

2008-03-16 Thread Benjamin
On Mar 16, 3:40 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sat, 15 Mar 2008 11:57:44 -0200, Deepak Rokade <[EMAIL PROTECTED]> > escribi�: > > > I want to use therads in my application. Going through the docs , I read > > about GIL. > > Now I am confused whether using threads in python

Re: Is IronPython real Python?

2008-03-24 Thread Benjamin
On Mar 24, 12:00 pm, jmDesktop <[EMAIL PROTECTED]> wrote: > I know that IronPython and CPython are different in that one does not > use the .net framework, but are they both really the same Python > language. From my basic understanding, it will depend on what the > programmer's goal is as to whic

Re: "python -3" not working as expected

2009-01-09 Thread Benjamin
On Jan 8, 11:35 pm, John Machin wrote: > On Jan 9, 1:56 pm, Benjamin wrote: > > > On Jan 8, 4:21 pm, Thorsten Kampe wrote: > > > > * Terry Reedy (Thu, 08 Jan 2009 17:04:04 -0500) > > > > Since you are, I believe, at least the second person to report being b

Re: "python -3" not working as expected

2009-01-10 Thread Benjamin
On Jan 9, 10:19 pm, John Machin wrote: > On Jan 10, 2:55 pm, Benjamin wrote: > > > We'll need good documentation. Unfortunately, as you > > note below, this isn't exactly the case yet. > > So is there a plot to remedy this? Where do we sign up? Feel free to

Re: does exec ignore the locals parameter?

2009-01-22 Thread Benjamin
On Jan 22, 6:45 pm, cburns wrote: > In the code below, bar() seems to work, foo() seems broken. > > % python -V > Python 2.6.1 > > % cat exec1.py > > def foo(i) : >         exec "i = i + 1" in locals(), globals() >         print "i=%d" % i > > def bar(j) : >         exec "j = j + 1" >         prin

Re: Dictionary : items()

2009-01-22 Thread Benjamin
On Jan 22, 2:53 am, Paul Rubin wrote: > Steven D'Aprano writes: > > That is better written as: > > l = sorted(abcd.items(), key=lambda x:(x[1].lower(), x[0])) > > In Python 2.x, I prefer the style > >   l = sorted(abcd.iteritems(), key=lambda (k,v): (v.lower(), k)) >

Re: Exhaustive Unit Testing

2008-11-27 Thread Benjamin
On Nov 27, 5:47 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Emanuele D'Arrigo: > >> I can fragment the code of the original method into one public method and > >> a few private support methods.< > > > Python also support nested functions, that you can put into your >

Re: Python 3.0 C API migration tools, or docs?

2008-12-04 Thread Benjamin
On Dec 4, 7:45 pm, illume <[EMAIL PROTECTED]> wrote: > Hi, > > are there migration tools for C API migration to python 3? > > I'm sure there must be some code somewhere to help change stuff over > right? > > I don't see any docs for migrating code from 2.x to 3.x > either:http://docs.python.org/3.

Re: Python 3.0 C API migration tools, or docs?

2008-12-05 Thread Benjamin
On Dec 4, 9:06 pm, illume <[EMAIL PROTECTED]> wrote: > Cool thanks Benjamin! > > Maybe it should be in a wiki as well?  So that as people convert their > modules we can add notes as well. > > I started a wiki with that in mind here:http://wiki.python.org/moin/cporting >

Re: Python for kids?

2008-12-07 Thread Benjamin
On Dec 7, 2:13 pm, "Russ P." <[EMAIL PROTECTED]> wrote: > I have a 12-year-old son who spends too much time playing Xbox live > and watching silly YouTube videos. I would like to try to get him > interested in programming. Is anyone aware of a good book or website > that addresses this concern, pre

Re: Catching Python exceptions in C

2008-12-08 Thread Benjamin
On Dec 8, 12:42 pm, Senthil Kumar <[EMAIL PROTECTED]> wrote: > Hi Pythoneers ! > Can somebody give a quick solution? > I am trying to raise exceptions in python and trying to handle it in > C. > I am able to raise exceptions successfully. However could not catch > those in C. > I am using the follo

Re: Relative imports in Python 3.0

2008-12-17 Thread Benjamin
On Dec 17, 4:01 am, Nicholas wrote: > Imagine a module that looks like > > ModuleDir >      __init__.py >      a.py >      b.py > > In python 2.x I used to have tests at the end of each of my modules, > so that module b.py might look something like > > import a >  .. >  .. > > if _

Re: "return" in def

2008-12-28 Thread Benjamin
On Dec 28, 1:35 pm, Steven D'Aprano wrote: > The second thing I think is that maybe the function is a generator, and > so I look for a yield. You shouldn't, though; Generators can't contain any return statement. -- http://mail.python.org/mailman/listinfo/python-list

Re: When does python 3.1, 3.2 version out?

2009-01-03 Thread Benjamin
On Jan 3, 8:47 pm, 叮叮当当 wrote: > Now, the 3.0 version is out for a time. > > I wonder when the python 3.1 is out, and what change is in python 3.1. There's no schedule yet. Hopefully, one will come into being around PyCon. -- http://mail.python.org/mailman/listinfo/python-list

Re: Interpreter & Thread state & Frame structures.

2009-01-07 Thread Benjamin
On Jan 7, 7:42 am, alessiogiovanni.bar...@gmail.com wrote: > Hi to all, > there are some fields in the PyInterpreterState and PyThreadState > obscures. > PyInterpreterState: >   1) Why there are the fields *next and *tstate_head? When there are multiple interpreters active, they are kept in a link

Re: "python -3" not working as expected

2009-01-08 Thread Benjamin
On Jan 8, 4:21 pm, Thorsten Kampe wrote: > * Terry Reedy (Thu, 08 Jan 2009 17:04:04 -0500) > > Since you are, I believe, at least the second person to report being bit > > by this confusion, please open an issue at bugs.python.org and suggest a > > couple of revised sentences that you think are mo

Re: What AugStore and AugLoad AST nodes are?

2008-10-06 Thread Benjamin
On Oct 6, 7:00 am, franck <[EMAIL PROTECTED]> wrote: > Dear all, > > I'm experimenting with new ast module. > I'd like to have pieces of code that can generate AugLoad and AugStore > AST nodes. > Indeed, I actually do not know what they correspond to. They aren't used by the current implementation

Re: Python pre-release announcements

2008-10-08 Thread Benjamin
On Oct 8, 12:42 am, Ben Finney <[EMAIL PROTECTED]> wrote: > "Martin v. Löwis" <[EMAIL PROTECTED]> writes: > > > > Is there some policy document or release management guide that could > > > be updated for release teams to follow on this without needing to have > > > this discussion every time? > > >

Re: utf-8 read/write file

2008-10-08 Thread Benjamin
On Oct 8, 12:49 pm, Bruno <[EMAIL PROTECTED]> wrote: > Hi! > > I have big .txt file which i want to read, process and write to another .txt > file. > I have done script for that, but im having problem with croatian characters > (Š,Đ,Ž,Č,Ć). Can you show us what you have so far? > How can I read/

Re: What do _ast Load | Store | Del | AugLoad | AugStore | Param mean?

2008-10-11 Thread Benjamin
On Oct 11, 12:57 pm, Eloff <[EMAIL PROTECTED]> wrote: > In the _ast module Attribute, Subscript, Name, List, Tuple all have an > expr_context associated with them which is defined as: > > expr_context = Load | Store | Del | AugLoad | AugStore | Param > > I have no idea what they mean, and what's th

Re: Transformation with ``parser`` ast

2008-10-13 Thread Benjamin
On Oct 13, 2:39 pm, Malthe Borch <[EMAIL PROTECTED]> wrote: > (Note: repost from python-dev) > > The ``compiler.ast`` module makes parsing Python source-code and AST > manipulation relatively painless and it's straight-forward to implement > a transformer class. > > However, I find that the ``compi

Re: ANN: pyparsing 1.5.1 released

2008-10-19 Thread Benjamin
On Oct 17, 11:14 pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > > (Python 3.0 uses syntax for catching exceptions that is incompatible > with Python versions pre 2.6, so there is no way for me to support > both existing Python releases and Python 3.0 with a common source code > base.  For those who

Re: How is the logical processing being done for strings like 'Dog' and 'Cat'

2008-10-20 Thread Benjamin
On Oct 20, 8:41 pm, Sumitava Mukherjee <[EMAIL PROTECTED]> wrote: > Hi all, > I am a novice programmer in Python. > Please could you explain me the results (regarding logical operators). > > I get this: > > >>> print bool('God' and 'Devil') > > True > > [This is ok because (any) string is True, so;

Re: set/dict comp in Py2.6

2008-10-25 Thread Benjamin
On Oct 25, 3:13 am, [EMAIL PROTECTED] wrote: > I'd like to know why Python 2.6 doesn't have the syntax to create sets/ > dicts of Python 3.0, like: Because nobody bothered to backport them. > > {x*x for x in xrange(10)} > {x:x*x for x in xrange(10)} > > Bye, > bearophile -- http://mail.python.org

Re: set/dict comp in Py2.6

2008-10-25 Thread Benjamin
On Oct 25, 3:13 am, [EMAIL PROTECTED] wrote: > I'd like to know why Python 2.6 doesn't have the syntax to create sets/ > dicts of Python 3.0, like: Because nobody bothered to backport them. > > {x*x for x in xrange(10)} > {x:x*x for x in xrange(10)} > > Bye, > bearophile -- http://mail.python.or

Re: set/dict comp in Py2.6

2008-10-26 Thread Benjamin
On Oct 25, 3:13 am, [EMAIL PROTECTED] wrote: > I'd like to know why Python 2.6 doesn't have the syntax to create sets/ > dicts of Python 3.0, like: Because nobody bothered to backport it. > > {x*x for x in xrange(10)} > {x:x*x for x in xrange(10)} > > Bye, > bearophile -- http://mail.python.org/m

Re: set/dict comp in Py2.6

2008-10-26 Thread Benjamin
On Oct 25, 3:13 am, [EMAIL PROTECTED] wrote: > I'd like to know why Python 2.6 doesn't have the syntax to create sets/ > dicts of Python 3.0, like: Because nobody bothered to backport it. > > {x*x for x in xrange(10)} > {x:x*x for x in xrange(10)} > > Bye, > bearophile -- http://mail.python.org/m

Re: print_function and unicode_literals cannot be used at the same time?

2008-10-28 Thread Benjamin
rt unicode_literals > >>  >>> from __future__ import print_function > >>  >>> print(type(""), file=sys.stderr) > >> > > > That's a bug, isn't it? The language reference explicitely allows it: > >http://docs.python.org/r

Re: set/dict comp in Py2.6

2008-10-29 Thread Benjamin
On Oct 27, 3:38 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sat, 25 Oct 2008 23:44:46 -0200, Benjamin <[EMAIL PROTECTED]>   > escribió: > > > On Oct 25, 3:13 am, [EMAIL PROTECTED] wrote: > >> I'd like to know why Python 2.6 doesn

Re: what should we use instead of the 'new' module?

2008-11-12 Thread Benjamin
On Nov 12, 9:54 pm, [EMAIL PROTECTED] wrote: > Robert, > > Appreciate your response. > > However Guido says here that types was never intended to be used like > that: > > http://bugs.python.org/msg58023 > > quote: "The types module was only ever intended for type > checking, not for creating new in

Re: Performance of Python builtins

2008-05-25 Thread Benjamin
On May 25, 6:19 pm, [EMAIL PROTECTED] wrote: > Is there any place outside the actual C source for Python that has > information about the performance of Python's built-in operations? For > example, I'd *expect* list.append to be O(1), and I hope that list[i] > is O(1), but I don't really know that

Re: undocumented functions in pkgutil

2008-05-29 Thread Benjamin
On May 29, 12:34 pm, Michele Simionato <[EMAIL PROTECTED]> wrote: > I see that the pkgutil module has many useful functions which are > however undocumented. > Does anybody know why it is so? In particolar, can I safely use > pkg.walk_packages > without risking a change of interface in the future?

Re: New chairman

2008-05-29 Thread Benjamin
On May 27, 10:48 am, Sverker Nilsson <[EMAIL PROTECTED]> wrote: > Good luck to you to. Its just that it .. well it has never been easy > for me to introduce Python at work. This py3k, if I like it or not, is > not making it easier. > > Praktical, pragmatic, you know --- as I said, its not broken so

Re: python blogs

2008-06-02 Thread Benjamin
On Jun 2, 1:49 pm, [EMAIL PROTECTED] wrote: > Hello! > > It seems like Python blogs are gaining popularity. It seems to me that > they play a crucial role in promoting Python as a language. > Do you agree with that? > > Just a few days ago I've finished setting up a dedicated Python > blogging envi

Re: Register codec dynamically without copying module to lib/python/encodings/

2008-06-05 Thread Benjamin
On Jun 5, 2:57 pm, Michael Ströder <[EMAIL PROTECTED]> wrote: > HI! > > I have a simple codec module for T.61 which principally works. I'd like > to use this codec without having to copy the module to > lib/python/encodings/. Is that possible? Can I can extend the encodings > search path or registe

Re: ABC question: what is the purpose of the register() method?

2008-06-07 Thread Benjamin
On Jun 7, 1:37 pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: > I was reading PEP 3119 (http://www.python.org/dev/peps/pep-3119/) and > have done some experiments using Python 3.0a5. Now I'm somewhat > puzzled about the purpose of the ABCMeta.register() method. > > One can use the register() method to

Re: Context manager for files vs garbage collection

2008-06-16 Thread Benjamin
On Jun 16, 8:24 am, Bruno Desthuilliers wrote: > > IIRC (please someone correct me if I'm wrong), proper release of file > resources as soon as the file object gets out of scope is not garanteed > in the language spec and is implementation dependant. Right. Resources are freed in CPython right af

Re: Python-3.0b1 build fails on Linux : _gestalt

2008-06-19 Thread Benjamin
On Jun 19, 5:07 am, Helmut Jarausch <[EMAIL PROTECTED]> wrote: > Hi, > > trying to build Python-3.0b1 on my Gentoo Linux box fails with > > Failed to find the necessary bits to build these modules: > _gestalt > > Looking at setup.py it seems that module '_gestalt' > is only needed on Darwin but my

  1   2   3   4   5   6   7   8   9   10   >