'Once' properties.

2009-10-05 Thread menomnon
Does python have a ‘once’ (per class) feature?

‘Once’, as I’ve know it is in Eiffel.  May be in Java don’t.

The first time you instantiate a given class into an object it
constructs, say, a dictionary containing static information.  In my
case static is information that may change once a week at the most and
there’s no need to be refreshing this data during a single running of
the program (currently maybe 30 minutes).

So you instantiate the same class into a second object, but instead of
going to the databases again and recreating the same dictionary a
second time, you get a pointer or reference to the one already created
in the first object – copies into the second object that is.  And the
dictionary, no matter how many instances of the object you make, is
always the same one from the first object.

So, as we put it, once per class and not object.

Saves on both time and space.
-- 
http://mail.python.org/mailman/listinfo/python-list


Debugging python in emacs isn't working.

2009-11-09 Thread menomnon
Hi,

Emacs 22.3, python 2.6.4

Put the following into my .emacs:

(setq pdb-path 'c:\\python26\\lib\\pdb.py
  gud-pdb-command-name (symbol-name pdb-path))
(defadvice pdb (before gud-query-cmdline activate)
  "Provide a better default command line when called interactively."
  (interactive
   (list (gud-query-cmdline pdb-path
(file-name-nondirectory buffer-file-name)


So when I'm in a python buffer (I've tried both python.el and python-
mode.el) and do M-x pdb I get, say:

c:\python26\lib\pdb.py rpytest.py

hit  and get an empty buffer that says "Comint: no process".  And
the status line says: "Spawning child process: invalid argument".

I've run into "spawning child process: invalid argument" before but
not being an emacs uber-geek I never solved it directly.

Hope someone has an idea of what I'm doing wrong.



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Debugging python in emacs isn't working.

2009-11-09 Thread menomnon
On Nov 8, 6:36 pm, menomnon  wrote:
> Hi,
>
> Emacs 22.3, python 2.6.4
>
> Put the following into my .emacs:
>
> (setq pdb-path 'c:\\python26\\lib\\pdb.py
>       gud-pdb-command-name (symbol-name pdb-path))
> (defadvice pdb (before gud-query-cmdline activate)
>   "Provide a better default command line when called interactively."
>   (interactive
>    (list (gud-query-cmdline pdb-path
>                             (file-name-nondirectory buffer-file-name)
>
> So when I'm in a python buffer (I've tried both python.el and python-
> mode.el) and do M-x pdb I get, say:
>
> c:\python26\lib\pdb.py rpytest.py
>
> hit  and get an empty buffer that says "Comint: no process".  And
> the status line says: "Spawning child process: invalid argument".
>
> I've run into "spawning child process: invalid argument" before but
> not being an emacs uber-geek I never solved it directly.
>
> Hope someone has an idea of what I'm doing wrong.

python -i.  It's the -i part that's important.
-- 
http://mail.python.org/mailman/listinfo/python-list