sftp login without password

2009-10-05 Thread David
I am trying to get a login using rsa_key with python. I have successfully installed paramiko and followed this tutorial: http://commandline.org.uk/python/sftp-python/ If I use the password transport.connect(username = username, password = password) I get a successful login but, I use the SSH ke

Re: 'Once' properties.

2009-10-05 Thread Scott David Daniels
menomnon wrote: 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 chan

Creating class instance from module and class name

2009-10-05 Thread gentlestone
Suppose I've saved the class name and (don't know how) I've also saved the Class's module (package path or I don't know what's the name for XYZ "from X.Y.Z import ...). How can I construct a new class according to saved informations? If I don't know what Class it could be, only I have the saved Cla

Re: 'Once' properties.

2009-10-05 Thread Carl Banks
On Oct 5, 11:07 pm, Carl Banks wrote: > On Oct 5, 7:56 pm, menomnon wrote: > > 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 c

Re: 'Once' properties.

2009-10-05 Thread Carl Banks
On Oct 5, 7:56 pm, menomnon wrote: > 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 stati

Re: Object Relational Mappers are evil (a meditation)

2009-10-05 Thread Carl Banks
On Oct 5, 7:25 am, Aaron Watters wrote: > This is a bit off topic except that many Python > programmers seem to be allergic to typing SQL. > > RESOLVED:  Using ORMs leads lazy programmers > to make bad database designs.  It's better to > carefully design your database with no invisible > means of

Re: Object Relational Mappers are evil (a meditation)

2009-10-05 Thread Simon Forman
On Mon, Oct 5, 2009 at 11:14 PM, Paul Rubin wrote: > Steve Holden writes: >> It seems to me that the biggest sin in databases is a failure to use >> rigorous design techniques. If somebody doesn't understand relational >> theory > > Where does one find out about this

Strange performance issue

2009-10-05 Thread Dan Stromberg
I'm rewriting 3 programs as one program - from Python with Tkinter to Python with pygtk, both on Windows XP. My new version formats an SD card and preallocates some file space in about 3 minutes with "Optimize Performance" selected, and in about 30 minutes with "Optimize for Quick Removal" s

Re: Problem with subprocess module on Windows with open file in append mode

2009-10-05 Thread Gabriel Genellina
En Sat, 03 Oct 2009 21:53:12 -0300, Andrew Savige escribió: When I run this little test program on Linux: import subprocess subprocess.call(["python","-V"], stderr=open("log.tmp","a")) the file log.tmp is appended to each time I run it. When I run it on Windows, however, the file log.tmp ge

Re: How to sort a list of strings on a substring

2009-10-05 Thread n00m
In my early teen, school years "Let It Be" by The Beatles sounded for my ears (incredibly clearly and obviously!) as "Lia Ri Pip". In school I studied French, English only many years later. My inner translation of "Here you are!" is smth like "Catch it!", "Take it!", "Look at this!" etc -- http:/

Re: How to sort a list of strings on a substring

2009-10-05 Thread Steven D'Aprano
On Mon, 05 Oct 2009 21:16:38 -0700, n00m wrote: > English language is not my mother toung, so I can't grasp many subtle > nuances of it. Maybe "here you are" means to me quite a different thing > than to you. It means "here is the thing you were looking for". Anyway, nothing I wrote was meant as

Re: Module inspect Bug

2009-10-05 Thread Gabriel Genellina
En Mon, 05 Oct 2009 11:59:01 -0300, Tomas Zulberti escribió: Hi. I have a class that extends collections.MutableMapping. I am checking if it is abstract, using the module inspect. But isabstract returns a number different from zero insted of True or False. The problem with that is that someti

Re: How to sort a list of strings on a substring

2009-10-05 Thread alex23
Steven D'Aprano wrote: > Oh please. That's a ridiculous excuse. Your post started with "Here you > are" -- the implication is that you thought it *was* a solution, not a > hint. A hint would be something like "Write a key function, perhaps using > lambda, and pass it to the sort() method using the

Re: How to sort a list of strings on a substring

2009-10-05 Thread Scott
On Oct 5, 6:05 pm, MRAB wrote: > Scott wrote: > > I create a list of logs called LogList. Here is a sample: > > > LogList = > > ["inbound tcp office 192.168.0.125 inside 10.1.0.91 88", > > "inbound tcp office 192.168.0.220 inside 10.1.0.31 2967", > > "inbound udp lab 172.24.0.110 inside 10.1.0.6 1

Re: How to sort a list of strings on a substring

2009-10-05 Thread n00m
English language is not my mother toung, so I can't grasp many subtle nuances of it. Maybe "here you are" means to me quite a different thing than to you. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to sort a list of strings on a substring

2009-10-05 Thread Steven D'Aprano
On Mon, 05 Oct 2009 20:33:51 -0700, n00m wrote: >> No, that's incorrect. Try it with this data and you will see it fails: > > Of course, you are right, but I think the topic-starter is smart enough > to understand that I suggested only a hint, a sketch, a sample of how to > use "key=" with "lambd

Re: Q: sort's key and cmp parameters

2009-10-05 Thread Steven D'Aprano
On Mon, 05 Oct 2009 19:34:27 -0700, Paul Rubin wrote: > Raymond Hettinger writes: >> When Guido made the final call, I'm sure he was balancing a number of >> goals including language simplification and one-way-to-do-it. I'm also >> sure that sorting lazily evaluated infinite sequences was not o

Re: How to sort a list of strings on a substring

2009-10-05 Thread n00m
> No, that's incorrect. Try it with this data and you will see it fails: Of course, you are right, but I think the topic-starter is smart enough to understand that I suggested only a hint, a sketch, a sample of how to use "key=" with "lambda", not a ready-to-apply solution. -- http://mail.python.

Re: Object Relational Mappers are evil (a meditation)

2009-10-05 Thread Ben Finney
Paul Rubin writes: > Steve Holden writes: > > It seems to me that the biggest sin in databases is a failure to use > > rigorous design techniques. If somebody doesn't understand relational > > theory > > Where does one find out about this? I've somehow managed to av

Re: SQLite or files?

2009-10-05 Thread Gabriel Genellina
En Mon, 05 Oct 2009 23:08:59 -0300, AggieDan04 escribió: On Sep 17, 9:10 am, J Kenneth King wrote: ici writes: > I likeshelvefor saving small amounts of data, user preferences, > recent files etc. >http://docs.python.org/library/shelve.html I like it too, but I hear the great powers that

Re: Object Relational Mappers are evil (a meditation)

2009-10-05 Thread Paul Rubin
Steve Holden writes: > It seems to me that the biggest sin in databases is a failure to use > rigorous design techniques. If somebody doesn't understand relational > theory Where does one find out about this? I've somehow managed to avoid it for an awfully long time, but it begins to look useful

Re: organizing your scripts, with plenty of re-use

2009-10-05 Thread Steven D'Aprano
On Mon, 05 Oct 2009 16:46:12 -0700, Carl Banks wrote: > Notice the key idea in all of this: ONE script. When you design it that > a file can be used either as a script or as a module, you are asking for > trouble. I agree with everything you said in your post *except* that final comment. The ba

Re: Object Relational Mappers are evil (a meditation)

2009-10-05 Thread Steve Holden
Diez B. Roggisch wrote: > Aaron Watters schrieb: >> This is a bit off topic except that many Python >> programmers seem to be allergic to typing SQL. >> >> RESOLVED: Using ORMs leads lazy programmers >> to make bad database designs. It's better to >> carefully design your database with no invisib

Re: How to refer to class name and function name in a python program?

2009-10-05 Thread Gabriel Genellina
En Mon, 28 Sep 2009 22:54:55 -0300, Peng Yu escribió: On Sun, Sep 20, 2009 at 12:43 PM, Benjamin Kaplan wrote: On Sun, Sep 20, 2009 at 12:43 PM, Peng Yu wrote: On Sun, Sep 20, 2009 at 11:32 AM, Vijayendra Bapte wrote: class A: @echo def __repr__(self): pass What does @ech

Re: 'Once' properties.

2009-10-05 Thread Chris Rebert
On Mon, Oct 5, 2009 at 7:56 PM, menomnon wrote: > Does python have a ‘once’ (per class) feature? In Python, `class` is an executable statement, so you can put whatever code you want in the class body (along with your method definitions) and it will be run exactly once, at the time the class is de

'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

Re: How to sort a list of strings on a substring

2009-10-05 Thread Steven D'Aprano
On Mon, 05 Oct 2009 15:45:58 -0700, n00m wrote: > Here you are: > > LogList = [\ > "inbound tcp office 192.168.0.125 inside 10.1.0.91 88", "inbound tcp > office 192.168.0.220 inside 10.1.0.31 2967", "inbound udp lab > 172.24.0.110 inside 10.1.0.6 161", "inbound udp office 192.168.0.22

Re: Q: sort's key and cmp parameters

2009-10-05 Thread Paul Rubin
Raymond Hettinger writes: > There were two sorts in my post and only one in yours. > That's why you didn't get the same answer. Whoops, missed that. > When Guido made the final call, I'm sure he was balancing > a number of goals including language simplification and > one-way-to-do-it. I'm also

Re: ARP code

2009-10-05 Thread Gabriel Genellina
En Tue, 29 Sep 2009 17:01:14 -0300, Nattapong Limprungpattanakit escribió: I have a problem can not run. Which problem? If you get an exception, copy and paste it including the whole traceback. How to use and detail ? import py_net_libs If your problem is related to a specific library,

Re: ARP code

2009-10-05 Thread Gabriel Genellina
En Tue, 29 Sep 2009 17:01:14 -0300, Nattapong Limprungpattanakit escribió: I have a problem can not run. Which problem? If you get an exception, copy and paste it including the whole traceback. How to use and detail ? import py_net_libs If your problem is related to a specific library,

Re: SQLite or files?

2009-10-05 Thread AggieDan04
On Sep 17, 9:10 am, J Kenneth King wrote: > ici writes: > > I likeshelvefor saving small amounts of data, user preferences, > > recent files etc. > >http://docs.python.org/library/shelve.html > > I like it too, but I hear the great powers that be are going to > deprecate it. If you want the conv

Re: a questions about thread-safety of boolean variables

2009-10-05 Thread Gabriel Genellina
En Wed, 30 Sep 2009 06:14:50 -0300, Charlie Dickens escribió: What about dictionaries? Reading values, adding new ones and the most important: changing an existing value - can it corrupt the state of the dictionary or that it is guaranteed that if I try to read the value of this key, I can o

Re: Conversion of npyscreen module to python 3 -- help!

2009-10-05 Thread Gabriel Genellina
En Mon, 05 Oct 2009 06:54:06 -0300, Nicholas escribió: [...] I am clearly committing some horrible sin that works well in python 2 but which doesn't in python 3. Despite reading the Release notes and PEPs over and over, though, I can't see what is wrong. If anyone could spare the time to ha

Re: conflict between various library to process EXIF data

2009-10-05 Thread Gabriel Genellina
En Mon, 05 Oct 2009 09:27:34 -0300, Bram Mertens escribió: In short: after adding a comment to the EXIF header using the setComment(...) and writeMetadata(...) methods of pyeviv2 (http://tilloy.net/dev/pyexiv2/doc/release-0.1.2/pyexiv2.htm) the EXIF header is altered in such a way that it is no

Re: Q: sort's key and cmp parameters

2009-10-05 Thread Raymond Hettinger
> > >  Say you want to change the numeric comparisons so that > > > even numbers always sort before odd numbers, ie. > > >     -4 < -2 < 0 < 2 < 4 < ... < -999 < ... -1 < 1 < 3 ... > > > This is too easy: > > >     >>> s = [-2, 4, 2, -1, -3, 1, -4, 0, 3] > >     >>> s.sort() > >     >>> s.sort(key=

Re: mktime, how to handle dates before 01-01-1970 ?

2009-10-05 Thread Stephen Hansen
On Mon, Oct 5, 2009 at 4:54 PM, Stef Mientki wrote: > hello, > > I want to handle datetime vars in a general way, so I use the default > time-format, > so I can use the standard cinversion procedures. > Personally, I love mx.DateTime; its the best date/time library around. But, Python's built in

Re: mktime, how to handle dates before 01-01-1970 ?

2009-10-05 Thread Gabriel Genellina
En Mon, 05 Oct 2009 20:54:18 -0300, Stef Mientki escribió: I want to handle datetime vars in a general way, so I use the default time-format, so I can use the standard cinversion procedures. Time format is the time difference since 1-1-1970. So how do I handle dates before 1-1-1970 ? Use

Re: Q: sort's key and cmp parameters

2009-10-05 Thread Paul Rubin
Raymond Hettinger writes: > FWIW, you could also just flatten it to: [(1,3,7,5), (19,23)]. > > The point is that the tree comparisons you presented have a > predetermined order of values to compare, so they either be recast a > flattened list of comparison values or the tree itself can be cast >

mktime, how to handle dates before 01-01-1970 ?

2009-10-05 Thread Stef Mientki
hello, I want to handle datetime vars in a general way, so I use the default time-format, so I can use the standard cinversion procedures. Time format is the time difference since 1-1-1970. So how do I handle dates before 1-1-1970 ? I'ld expect times before 1-1-1970, simply to become negative

Re: organizing your scripts, with plenty of re-use

2009-10-05 Thread Carl Banks
On Oct 5, 1:46 pm, Buck wrote: > Thanks. I think we're getting closer to the core of this. > > To restate my problem more simply: > > My core goal is to have my scripts in some sort of organization better > than a single directory, and still have plenty of re-use between them. > The only way I can

Re: How to sort a list of strings on a substring

2009-10-05 Thread MRAB
Scott wrote: I create a list of logs called LogList. Here is a sample: LogList = ["inbound tcp office 192.168.0.125 inside 10.1.0.91 88", "inbound tcp office 192.168.0.220 inside 10.1.0.31 2967", "inbound udp lab 172.24.0.110 inside 10.1.0.6 161", "inbound udp office 192.168.0.220 inside 10.1.0.

How to sort a list of strings on a substring

2009-10-05 Thread Scott
I create a list of logs called LogList. Here is a sample: LogList = ["inbound tcp office 192.168.0.125 inside 10.1.0.91 88", "inbound tcp office 192.168.0.220 inside 10.1.0.31 2967", "inbound udp lab 172.24.0.110 inside 10.1.0.6 161", "inbound udp office 192.168.0.220 inside 10.1.0.13 53"] I want

Re: Skeletal animation

2009-10-05 Thread Carl Banks
On Oct 5, 9:09 am, Manowar wrote: > On Oct 4, 8:38 pm, Carl Banks wrote: > > > > > > > On Oct 4, 5:16 pm, Manowar wrote: > > > > On Oct 4, 6:38 pm, TerryP wrote: > > > > > On Oct 4, 10:05 pm, Manowar wrote: > > > > > > I am new to pyton and have asked this question several times the > > > > >

Re: numpy f2py question

2009-10-05 Thread George Trojan
sturlamolden wrote: On 2 Okt, 22:41, George Trojan wrote: I have a problem with numpy's vectorize class and f2py wrapped old FORTRAN code. I found that the function _get_nargs() in site-packages/numpy/lib/function_base.py tries to find the number of arguments for a function from an error messag

Tabular data package

2009-10-05 Thread Elaine Angelino
Hi there, We are writing to announce the release of "Tabular", a package of Python modules for working with tabular data. Tabular is a package of Python modules for working with tabular data. Its main object is the tabarray class, a data structure for holding and manipulating tabular data. By put

Re: organizing your scripts, with plenty of re-use

2009-10-05 Thread Robert Kern
On 2009-10-05 15:33 PM, Margie wrote: I think he is looking for a way for users to be able to use scripts/ myscript.py (which imports parrot) without having to change their PYTHON path with something like this: $ export PYTHONPATH=~/LocalToolCheckouts/:$PYTHONPATH I'm guessing that Buck ha

Re: organizing your scripts, with plenty of re-use

2009-10-05 Thread Rami Chowdhury
On Mon, 05 Oct 2009 13:46:09 -0700, Buck wrote: Thanks. I think we're getting closer to the core of this. To restate my problem more simply: My core goal is to have my scripts in some sort of organization better than a single directory, and still have plenty of re-use between them. The only w

Re: organizing your scripts, with plenty of re-use

2009-10-05 Thread Buck
Thanks. I think we're getting closer to the core of this. To restate my problem more simply: My core goal is to have my scripts in some sort of organization better than a single directory, and still have plenty of re-use between them. The only way I can see to implement this is to have 10+ lines

Re: organizing your scripts, with plenty of re-use

2009-10-05 Thread Margie
On Oct 5, 12:34 pm, Robert Kern wrote: > On 2009-10-05 13:48 PM, Buck wrote: > > > > > On Oct 5, 11:29 am, Robert Kern  wrote: > >> On 2009-10-05 12:42 PM, Buck wrote: > > With the package layout, you would just do: > >      from parrot.sleeping import sleeping_in_a_bed >      from

Re: PIL : How to write array to image ???

2009-10-05 Thread Mart.
On Oct 5, 5:14 pm, Martin wrote: > On Oct 4, 10:16 pm, "Mart." wrote: > > > > > > > On Oct 4, 9:47 am, Martin wrote: > > > > On Oct 3, 11:56 pm, Peter Otten <__pete...@web.de> wrote: > > > > > Martin wrote: > > > > > Dear group > > > > > > I'm trying to use PIL to write an array (a NumPy array t

Re: Q: sort's key and cmp parameters

2009-10-05 Thread Raymond Hettinger
> > So, it looks like the relevant comparison values can be stored in > > nested lists: > > >list_of_lists = \ > > [[1, [3, [], []], > > [7, [5, [], []], []]], > > [19, [23, [], []], > > []], > > ] > > Now you've copied all the data out of the original tree,

Re: Object Relational Mappers are evil (a meditation)

2009-10-05 Thread Diez B. Roggisch
Aaron Watters schrieb: This is a bit off topic except that many Python programmers seem to be allergic to typing SQL. RESOLVED: Using ORMs leads lazy programmers to make bad database designs. It's better to carefully design your database with no invisible means of support and there is no reaso

Re: organizing your scripts, with plenty of re-use

2009-10-05 Thread Robert Kern
On 2009-10-05 13:48 PM, Buck wrote: On Oct 5, 11:29 am, Robert Kern wrote: On 2009-10-05 12:42 PM, Buck wrote: With the package layout, you would just do: from parrot.sleeping import sleeping_in_a_bed from parrot.feeding.eating import eat_cracker This is really much more str

Re: epydoc - can I provide multiple dirs to parse

2009-10-05 Thread Medi
On Oct 5, 2:09 am, Jean-Michel Pichavant wrote: > Medi wrote: > > Can I present multiple directories toepydocto process. For example > > >epydoc-option -option -option dir_1 dir_2 dir_3 > > > where dir_i is a directory containing some python src codes ? > > > I am currently running it on two direc

Re: organizing your scripts, with plenty of re-use

2009-10-05 Thread Buck
On Oct 5, 11:29 am, Robert Kern wrote: > On 2009-10-05 12:42 PM, Buck wrote: > > > > >> With the package layout, you would just do: > > >>     from parrot.sleeping import sleeping_in_a_bed > >>     from parrot.feeding.eating import eat_cracker > > >> This is really much more straightforward than y

Re: organizing your scripts, with plenty of re-use

2009-10-05 Thread Robert Kern
On 2009-10-05 12:42 PM, Buck wrote: With the package layout, you would just do: from parrot.sleeping import sleeping_in_a_bed from parrot.feeding.eating import eat_cracker This is really much more straightforward than you are making it out to be. As in the OP, I need things to "Just

Re: epydoc - can I provide multiple dirs to parse

2009-10-05 Thread Montaseri
Thank you It looks like it is possible to feed multiple dirs, Also, can you explain the --inheritance=STYLE for me. What does the author mean by values like "grouped", "listed", "included" I could not find any good document explaining these... Thanks Medi On Mon, Oct 5, 2009 at 2:09 AM, Jean-Mi

Re: Pool module -- does map pre-assign tasks to processes?

2009-10-05 Thread Aahz
In article , Luca wrote: >I would like to use the Pool module, but my tasks take sometimes >unpredictably different time to complete. The simplest way to write >the code would be to put all task descriptions in an array, then call > >p = Pool(8) >p.map(f, a) > >But I don't want to preassign proc

Re: organizing your scripts, with plenty of re-use

2009-10-05 Thread Buck
> > With the package layout, you would just do: > >    from parrot.sleeping import sleeping_in_a_bed >    from parrot.feeding.eating import eat_cracker > > This is really much more straightforward than you are making it out to be. > As in the OP, I need things to "Just Work" without installation r

Re: Why is this slower?

2009-10-05 Thread Stefan Behnel
Joseph Reagle wrote: > I would think the commented code would be faster (fewer loops), but it is > not (because of function calls). You just answered your own question. > inSRC = set([bio.name for bio in bios.values()]) Note that this is actually very inefficient as it first creates a list

Re: Skeletal animation

2009-10-05 Thread Donn
On Monday 05 October 2009 18:09:46 Manowar wrote: > just need to know if i can manipulate the bones in > realtime with python. If you are looking for some kind of "from awesome import Bones", then I really don't know of anything. You should look at the various 3D toolkits (like Panda 3D, python-

Re: Walking an object/reference graph

2009-10-05 Thread Simon Forman
On Mon, Oct 5, 2009 at 3:59 AM, Austin Bingham wrote: > I'm looking for the proper way to "walk" a graph of python objects. My > specific task is to find all objects of a given type that are referred > to (transitively) by some starting object. My approach has been to > loop through the object's a

Re: PIL : How to write array to image ???

2009-10-05 Thread Martin
On Oct 4, 10:16 pm, "Mart." wrote: > On Oct 4, 9:47 am, Martin wrote: > > > > > On Oct 3, 11:56 pm, Peter Otten <__pete...@web.de> wrote: > > > > Martin wrote: > > > > Dear group > > > > > I'm trying to use PIL to write an array (a NumPy array to be exact) to > > > > an image. > > > > Peace of ca

Re: Is there a way to specify a superclass at runtime?

2009-10-05 Thread Jean-Michel Pichavant
Chris Colbert wrote: I dont think so, because that would require logic outside of the controller class to determine which controller to instantiate. My whole purpose for Controller is to encapsulate this logic. So, if the data should be simulated, then i just need to pass -simulate True as a co

Re: Skeletal animation

2009-10-05 Thread Manowar
On Oct 4, 8:38 pm, Carl Banks wrote: > On Oct 4, 5:16 pm, Manowar wrote: > > > > > > > On Oct 4, 6:38 pm, TerryP wrote: > > > > On Oct 4, 10:05 pm, Manowar wrote: > > > > > I am new to pyton and have asked this question several times the > > > > answer is always not sure. > > > > Here is my que

Re: Enormous Input and Output Test

2009-10-05 Thread nn
On Oct 4, 8:41 am, Duncan Booth wrote: > Jon Clements wrote: > > On Oct 4, 12:08 pm, n00m wrote: > >> Duncan Booth, > > >> alas... still TLE: > > >> 2800839 > >> 2009-10-04 13:03:59 > >> Q > >> Enormous Input and Output Test > >> time limit exceeded > >> - > >> 88M > >> PYTH > > > Just to throw

Re: Is there a way to specify a superclass at runtime?

2009-10-05 Thread Chris Colbert
that's a good idea. Thanks! On Mon, Oct 5, 2009 at 4:18 PM, MRAB wrote: > Chris Colbert wrote: >> >> because when i import this module, the classes will already be >> determined by the intitial flag setting. >> >> i.e. >> SIMULATION = False >> >> class SimController(object): >>   def foo(self):

Re: SAX: Short tag's ...

2009-10-05 Thread Diez B. Roggisch
Thomas Lehmann wrote: > Hi! > > Is there a way to recognize short tags in a XML? > I'm implementing a SAX handler... > > Problem: storing the XML code I would need this information > in the startElement ... > > How can I handle this? > > > any text I don't think there is a (standard) way, an

Module inspect Bug

2009-10-05 Thread Tomas Zulberti
Hi. I have a class that extends collections.MutableMapping. I am checking if it is abstract, using the module inspect. But isabstract returns a number different from zero insted of True or False. The problem with that is that sometimes it returns False when the class isn't an abstract. >>> inspect

Re: Object Relational Mappers are evil (a meditation)

2009-10-05 Thread Bruno Desthuilliers
Aaron Watters a écrit : This is a bit off topic except that many Python programmers seem to be allergic to typing SQL. What I am mostly allergic to is manipulating sql queries as strings and resultsets as lists of tuples. I strongly prefer a higher level representation of both the queries and

Object Relational Mappers are evil (a meditation)

2009-10-05 Thread Aaron Watters
This is a bit off topic except that many Python programmers seem to be allergic to typing SQL. RESOLVED: Using ORMs leads lazy programmers to make bad database designs. It's better to carefully design your database with no invisible means of support and there is no reason to not use SQL directly

SAX: Short tag's ...

2009-10-05 Thread Thomas Lehmann
Hi! Is there a way to recognize short tags in a XML? I'm implementing a SAX handler... Problem: storing the XML code I would need this information in the startElement ... How can I handle this? any text -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a way to specify a superclass at runtime?

2009-10-05 Thread MRAB
Chris Colbert wrote: because when i import this module, the classes will already be determined by the intitial flag setting. i.e. SIMULATION = False class SimController(object): def foo(self): print 'bar' class RealController(object): def foo(self): print 'baz' if SIMULATI

Re: Is there a way to specify a superclass at runtime?

2009-10-05 Thread Chris Colbert
I suppose i can just move the SIMULATION flag to another module, and then import it and check it before intstantiation. So, the arg parser will have to set the flag before any other processing begins... On Mon, Oct 5, 2009 at 3:49 PM, Chris Colbert wrote: > I dont think so, because that would re

Re: Is there a way to specify a superclass at runtime?

2009-10-05 Thread Chris Colbert
I dont think so, because that would require logic outside of the controller class to determine which controller to instantiate. My whole purpose for Controller is to encapsulate this logic. So, if the data should be simulated, then i just need to pass -simulate True as a command line argument, an

Re: Is there a way to specify a superclass at runtime?

2009-10-05 Thread Chris Colbert
because when i import this module, the classes will already be determined by the intitial flag setting. i.e. SIMULATION = False class SimController(object): def foo(self): print 'bar' class RealController(object): def foo(self): print 'baz' if SIMULATION: SuperKlass = Sim

Re: Is there a way to specify a superclass at runtime?

2009-10-05 Thread Richard Brodie
"Chris Colbert" wrote in message news:mailman.868.1254748945.2807.python-l...@python.org... > I am trying to abstract this machinery in a single class called > Controller which I want to inherit from either SimController or > RealController based on whether a module level flag SIMULATION is set

Re: Is there a way to specify a superclass at runtime?

2009-10-05 Thread MRAB
Chris Colbert wrote: I have an application that needs to run different depending on whether the input data is being simulated, or provided from instrumentation. I am trying to abstract this machinery in a single class called Controller which I want to inherit from either SimController or RealCon

Is there a way to specify a superclass at runtime?

2009-10-05 Thread Chris Colbert
I have an application that needs to run different depending on whether the input data is being simulated, or provided from instrumentation. I am trying to abstract this machinery in a single class called Controller which I want to inherit from either SimController or RealController based on whethe

Twisted PB vs JMS

2009-10-05 Thread jacopo
I looked at Twisted PB for an architecture with one client distributing some processing to several servers. Now I came across JMS and I have seen that using ActiveMQ with the Stomp protocol there would be a good support for Python. Surprising I couldn’t find any article comparing the two technolog

Re: some site login problem help plz..

2009-10-05 Thread james27
still looking for good solution. anyway..thanks Diez :) Diez B. Roggisch-2 wrote: > > james27 wrote: > >> >> hello.. >> im new to python. >> i have some problem with mechanize. >> before i was used mechanize with no problem. >> but i couldn't success login with some site. >> for several days i

conflict between various library to process EXIF data

2009-10-05 Thread Bram Mertens
Hi, I posted this to [Image-SIG] a while ago but did not got a reply so I assume it may not have been the appropriate list. If this is again not the right list please direct me to the proper list. How to read and write EXIF data from images has been discussed several times on the [Image-SIG] lis

python multiprocessing proxy

2009-10-05 Thread DrFalk3N
I have a 2 processes: the first process is manager.py and starts in backgroung: from multiprocessing.managers import SyncManager, BaseProxy from CompositeDict import * class CompositeDictProxy(BaseProxy): _exposed_ = ('addChild', 'setName') def addChild(self, child):

Re: Q: sort's key and cmp parameters

2009-10-05 Thread Paul Rubin
Raymond Hettinger writes: > So, it looks like the relevant comparison values can be stored in > nested lists: > >list_of_lists = \ > [[1, [3, [], []], > [7, [5, [], []], []]], > [19, [23, [], []], > []], > ] Now you've copied all the data out of the origin

Conversion of npyscreen module to python 3 -- help!

2009-10-05 Thread Nicholas
Dear Pythoners, Like a loyal python coder, I was attempting to convert a library to python 3. I have been stung in various ways by the new import semantics - the tests that used to live happily within the module have now had to be moved elsewhere. So be it. But even though I have removed all the

Re: Delete all list entries of length unknown

2009-10-05 Thread flebber
On Oct 5, 3:05 pm, "Mark Tolonen" wrote: > "Chris Rebert" wrote in message > > news:50697b2c0910042047i1cf2c1a3mc388bc74bab95...@mail.gmail.com... > > > Tuples are immutable (i.e. they cannot be modified after creation) and > > are created using parentheses. > > Slight correction: tuples are crea

Re: Python shared lib

2009-10-05 Thread ryles
On Oct 4, 11:04 am, a...@pythoncraft.com (Aahz) wrote: > I've got a dim memory that there's a reason for this -- you might try > searching the python-dev archives and/or bugs.python.org. Found mention of it in this discussion: http://bugs.python.org/issue771998 "I disagree that --enable-shared s

Re: Compile kinterbasdb with mingw32 and python 2.6 - DLL load failed

2009-10-05 Thread Tonal
I write path for compile kinterbasdb with mingw32 and python 2.6 for rev 1038 See http://sourceforge.net/tracker/?func=detail&aid=2872794&group_id=9913&atid=309913 -- http://mail.python.org/mailman/listinfo/python-list

Re: Need feedback on subprocess-using function

2009-10-05 Thread ryles
On Oct 4, 9:46 pm, Nobody wrote: > On Sat, 03 Oct 2009 13:21:00 +, gb345 wrote: > > I'm relatively new to Python, and I'm trying to get the hang of > > using Python's subprocess module.  As an exercise, I wrote the Tac > > class below, which can prints output to a file "in reverse order", > >

Re: can i use the browser to show the result of python

2009-10-05 Thread catafest
On Sep 25, 12:41 pm, Hacken wrote: > I have write some python script > > i want to use browser(IE or FF) to call it, an show the returns! > > how to? Python script running under web browsers only like: python + website = django . -- http://mail.python.org/mailman/listinfo/python-list

Re: [Image-SIG] Some issue with easy_install and PIL/Imaging

2009-10-05 Thread Chris Withers
Fredrik Lundh wrote: The problem is that too many people arguing for eggs do this by sending nastygrams, which doesn't really provide much motivation for doing anything about it (I don't do asshole-driven development). Indeed, I couldn't agree more, and I'm sorry you've been subjected to this.

Re: Opinions, please, on PEP 8 and local, 3rd party imports

2009-10-05 Thread Jean-Michel Pichavant
Philip Semanchuk wrote: Hi all, Our project uses some libraries that were written by 3rd parties (i.e. not us). These libraries fit into a single Python file and live in our source tree alongside other modules we've written. When our app is distributed, they'll be included in the installation.

Re: epydoc - can I provide multiple dirs to parse

2009-10-05 Thread Jean-Michel Pichavant
Medi wrote: Can I present multiple directories to epydoc to process. For example epydoc -option -option -option dir_1 dir_2 dir_3 where dir_i is a directory containing some python src codes ? I am currently running it on two directories with about 10M + 20 Meg which takes a very long time (mor

Re: regex (?!..) problem

2009-10-05 Thread Wolfgang Rohdewald
On Monday 05 October 2009, MRAB wrote: > "(?!.*?(C1).*?\1)" will succeed only if ".*?(C1).*?\1" has failed, > in which case the group (group 1) will be undefined (no capture). I see. I should have moved the (C1) out of this expression anyway: >>> re.match(r'L(?P..)(?!.*?(?P=tile).*?(?P=tile))(

Re: [Image-SIG] Some issue with easy_install and PIL/Imaging

2009-10-05 Thread Fredrik Lundh
The problem is that too many people arguing for eggs do this by sending nastygrams, which doesn't really provide much motivation for doing anything about it (I don't do asshole-driven development). The public review PIL got a couple a minutes ago matches some of the private mail I've gotten: n

Re: Walking an object/reference graph

2009-10-05 Thread MRAB
Austin Bingham wrote: I'm looking for the proper way to "walk" a graph of python objects. My specific task is to find all objects of a given type that are referred to (transitively) by some starting object. My approach has been to loop through the object's attributes, examining each, and then rec

Re: regex (?!..) problem

2009-10-05 Thread MRAB
Wolfgang Rohdewald wrote: On Monday 05 October 2009, MRAB wrote: You're currently looking for one that's not followed by another; the solution is to check first whether there are two: >>> re.match(r'(?!.*?C1.*?C1)(.*?C1)','C1b1b1b1 b3b3b3b3 C1C2C3').groups() Traceback (most recent call last

Re: some site login problem help plz..

2009-10-05 Thread Diez B. Roggisch
james27 wrote: > > hello.. > im new to python. > i have some problem with mechanize. > before i was used mechanize with no problem. > but i couldn't success login with some site. > for several days i was looked for solution but failed. > my problem is , login is no probelm but can't retrieve html

Path for compile kinterbasdb with mingw32 and python 2.6

2009-10-05 Thread Alexandr N Zamaraev
I write path for compile kinterbasdb with mingw32 and python 2.6 for rev 1038 See http://sourceforge.net/tracker/?func=detail&aid=2872794&group_id=9913&atid=309913 -- http://mail.python.org/mailman/listinfo/python-list

Re: question about the GC implementation

2009-10-05 Thread Francis Moreau
On Oct 3, 11:58 pm, ryles wrote: > >     Only objects with GC_TENTATIVELY_UNREACHABLE still set are > candidates for collection.  If it's decided not to collect such an object > (e.g., it has a __del__ method), its gc_refs is restored to GC_REACHABLE > again. Ok so it happens _only_ w

  1   2   >