Re: function with list argument defaulting to [] - what's going on here???

2007-04-14 Thread Troy Melhase
On 4/14/07, Mike <[EMAIL PROTECTED]> wrote: > While trying to write a recursive function involving lists, I came > across some (to me) odd behavior which I don't quite understand. Here's > a trivial function showing the problem. from http://docs.python.org/ref/function.html : Default parameter va

Re: Pickle and Instance Methods

2007-03-17 Thread Troy Melhase
> I understand that this cannot be saved by pickle. > My question is, is there another way of setting a callback that would > agree with pickle? > If not is there some way to make pickle ignore the problem attribute? Try adding a __getstate__ method to your class: http://docs.python.org/lib/pickl

Re: Python 2.5 incompatible with Fedora Core 6 - packaging problems again

2007-03-04 Thread Troy Melhase
[snip] > So what's going on? We've run into a conflict between an assumption of Python > and of the Plesk control panel. Plesk doesn't let the user create files > in their own home directory. This installer assumes it can. Oops. > (Plesk sets up a very locked down environment, which is a good

Re: print a ... z, A ... Z, "\n"' in Python

2007-03-03 Thread Troy Melhase
> How do you write Perl's > > print a ... z, A ... Z, "\n"' in Python > > > In Python? you might consider this cheating, but it's packed with zen goodness: >>> import string >>> print string.letters abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -- http://mail.python.org/mailman/listi

Re: Installing java2python (Newbie)

2007-02-28 Thread Troy Melhase
> Did you think I was suggesting that you write a GUI version of > java2python? Please carefully (re)?read the documentation link that I > gave you. The idea is that with a simple variation of your setup.py > build comamnd, you create a Windows installer for your existing > package, and make it ava

Re: Installing java2python (Newbie)

2007-02-28 Thread Troy Melhase
> Hi Troy, Windows users don't really "want" to do that. They'd prefer > to download a Windows installer, and "double-click on it". Hi John, Understood and agreed. I was thinking about Andy's problem, and I realized that many users would benefit from a gui to do side-by-side translation. If I e

Re: Installing java2python (Newbie)

2007-02-27 Thread Troy Melhase
> properly now (error free!! yay) and the j2py script is located under : > C:\Documents and Settings\Ujjal Pathak\Desktop\java2python-0.2\build > \scripts-2.5 that doesn't look right -- it looks like you found what the setup script left behind. what you should look for is j2py in either (a) your

Re: Find the first element that meets the condition

2007-02-25 Thread Troy Melhase
> I have implemented it this way, may be, there should be a built in > hiding somewhere in the standard libraries? the itertools module might have what you're after. something similar to your example: >>> import itertools >>> r = iter(range(100)) >>> n = itertools.dropwhile(lambda x:x<=13, r) >>

Re: Having multiple instances of a single application start a single instance of another one

2007-02-23 Thread Troy Melhase
> Three very simple questions then. > > 1. How do I find out a running applications process ID import os mypid = os.getpid() > 2. How do I check if a process ID is bound to a running application. this is os-specific. i'm sure there's a windows api provided for it. > 3. There won't be any issue

Re: ANN: IbPy 0.7.0-9.00 - Interactive Brokers Python API

2007-02-23 Thread Troy Melhase
On 23 Feb 2007 14:36:24 -0800, vj <[EMAIL PROTECTED]> wrote: > Cool. Why is python 2.5 required, will it not work with python 2.4? Short answer: because java2python produces python 2.5 syntax. Long answer: I wrote java2python specifically to translate the IB reference code. That reference code

Re: Having multiple instances of a single application start a single instance of another one

2007-02-23 Thread Troy Melhase
> The first time A starts, it should open a B process and start > communicating with it. All other times an A instance starts it should > simply talk with the B that already is open. B should write its process id to a location known by both applications. When A starts, it should read that PID fro

Re: Question about idiomatic use of _ and private stuff.

2007-02-23 Thread Troy Melhase
> Why do people sometimes use one leading underscore? Many folks like to use the single leading underscore to emphasize that the attribute isn't part of the normal way to use the class or instance. It's bad style in my opinion, but I'm probably in the minority. -- http://mail.python.org/mailman/

ANN: IbPy 0.7.0-9.00 - Interactive Brokers Python API

2007-02-21 Thread Troy Melhase
n the release for details. I'm very interested in your experience with IbPy. Please drop me an note with any feedback you have. Troy Melhase mailto:[EMAIL PROTECTED] .. _java2python: http://code.google.com/p/java2python/ __ http://www.interactivebrokers.com/en/general/about/about.p

Re: ANN: java2python 0.2

2007-02-19 Thread Troy Melhase
> Hi Troy. What is the rationale for your project? Hi Kay, I maintain a python port of a java library. It finally got too complicated to do by hand, so I wrote java2python to make my life easier. I wrote more extensively about the library and this tool in my blog: http://blog.melhase.net/artic

ANN: java2python 0.2

2007-02-18 Thread Troy Melhase
No license is assumed of (or applied to) translated source. I'm very interested in your experience with java2python. Please drop me an note with any feedback you have. Troy Melhase mailto:[EMAIL PROTECTED] pgp7Fllr80es8.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

ANN: java2python 0.1

2007-02-15 Thread Troy Melhase
edback you have. Troy Melhase mailto:[EMAIL PROTECTED] pgpf4KzxBwnWd.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Method overloading?

2007-02-15 Thread Troy Melhase
On 14 Feb 2007 20:54:31 -0800, placid <[EMAIL PROTECTED]> wrote: > class Test: > def __init__(self): > pass > > def puts(self, str): > print str > > def puts(self, str,str2): > print str,str2 you might look into the overloading module and its decorator. source

Re: Simple question regarding module initialization

2006-06-20 Thread Troy Melhase
$ ipython in [1]: __import__? Type: builtin_function_or_method Base Class: String Form: Namespace: Python builtin Docstring: __import__(name, globals, locals, fromlist) -> module Import a module. The globals are only used to determine the context; they are not