Re: Daemon and logging - the best approach?

2008-11-07 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Lech Karol Pawłaszek wrote: > And now I want to read logging config file before daemonize the program > because the file might not be accessible after daemonization. Why might it be inaccessible just because you've daemonized? -- http://mail.python.org/mailman/list

Re: @contextlib question

2008-11-07 Thread Peter Otten
Neal Becker wrote: > http://www.python.org/doc/2.5.2/lib/module-contextlib.html has this > example: from contextlib import contextmanager > > @contextmanager > def tag(name): > print "<%s>" % name > yield > print "" % name > > contexlib.contextmanager doc string (2.5.1) says: > T

Re: is it a bug in Module copy or i am wrong??

2008-11-07 Thread Terry Reedy
yoma wrote: python version 2.5 in module copy we all know that copy have two method: copy() and deepcopy(). and the explain is - A shallow copy constructs a new compound object and then (to the extent possible) inserts *the same objects* into it that the original contains. - A deep copy con

Re: .pyc keeps running and never stops

2008-11-07 Thread Terry Reedy
Shao wrote: Dear All, I am using Python 2.5 and used py_compile to produce a .pyc file. The script runs well. However, the .pyc keeps running and never stops. Advices will be deeply appreciated. You have either an infinite loop or a computation that runs longer than your patience. If I cou

Re: Finding the instance reference of an object [long and probably boring]

2008-11-07 Thread Joe Strout
On Nov 7, 2008, at 12:13 PM, Terry Reedy wrote: Python has two types of names. Some complex objects -- modules, classes, and functions, and wrappers and subclasses thereof, have 'definition names' that are used instead of a 'value' to print a representation. Otherwise, names are identifie

Re: More __init__ methods

2008-11-07 Thread Terry Reedy
Duncan Booth wrote: Mr.SpOOn <[EMAIL PROTECTED]> wrote: Now I must pass a and b to the main constructor and calculate them in the classmethods. class foo: def __init__(self, a, b): self.a = a self.b = b @classmethod def from_string(self, ..): ...

Re: Finding the instance reference of an object [long and probably boring]

2008-11-07 Thread Joe Strout
On Nov 7, 2008, at 12:35 PM, Terry Reedy wrote: http://en.wikipedia.org/wiki/Call_by_something#Call_by_sharing Call by sharing Also known as "call by object" or "call by object-sharing" is an evaluation strategy first named by Barbara Liskov et al for the language CLU in 1974[1]. It is use

Re: Calling Python from Python and .pyc problem

2008-11-07 Thread Terry Reedy
David Shi wrote: Hello, there. I am using Python 2.5. I used py_compile and made a .pyc file. No need usually. However, it runs but never stops. What is the best way to compile a .py file. When you run a .py file, it automatically compiles and write a .pyc file if there is no .pyc fi

Re: More __init__ methods

2008-11-07 Thread Mr . SpOOn
On Fri, Nov 7, 2008 at 7:02 PM, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> What if I need the parse method to be called in other parts of the >> program? > > I don't understand!? Then you call it from those other parts. Yes, you're right. Don't know why, but I was thinking to use @cl

Re: Finding the instance reference of an object [long and probably boring]

2008-11-07 Thread Arnaud Delobelle
Joe Strout <[EMAIL PROTECTED]> writes: > So. How about this for a summary? > > "Python uses call-by-sharing. That's a special case of call-by-value > where the variables are references to objects; it is these references > that are copied to the parameters, not the objects themselves. For > user

Re: Calling Python from Python and .pyc problem

2008-11-07 Thread Steve Holden
Terry Reedy wrote: > David Shi wrote: >> Hello, there. >> >> I am using Python 2.5. I used py_compile and made a .pyc file. > > No need usually. > >> However, it runs but never stops. What is the best way to >> >> compile a .py file. > > When you run a .py file, it automatically compiles and

Re: Finding the instance reference of an object [long and probably boring]

2008-11-07 Thread Steve Holden
Joe Strout wrote: > On Nov 7, 2008, at 12:13 PM, Terry Reedy wrote: [...] >>> I wonder if that could be tested systematically. Perhaps we could >>> round up 20 newbies, divide them into two groups of 10, give each one >>> a 1-page explanation either based on passing object references >>> by-value,

Re: Does Python have Multiple Inheritance ?

2008-11-07 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Michele Simionato wrote: > On Nov 7, 4:38 pm, Tim Golden <[EMAIL PROTECTED]> wrote: > >> Seriously, though, although Python does indeed support multiple >> inheritance, I have the impression from comments over the years that it's >> used a lot less than in other lan

Re: (Windows) "Dropping" stuff onto a Python script

2008-11-07 Thread Aaron Brady
On Nov 6, 2:56 am, [EMAIL PROTECTED] wrote: > Hello people, > > I'd like to have the functionality known from "real" executables that > if I drag-drop a file icon on top of the app, the app starts and has > the file's path as command-line argument. > > However, this doesn't seem to work with Python

Re: Weird behavior with lexical scope

2008-11-07 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Terry Reedy wrote: > [EMAIL PROTECTED] wrote: > >> class Outer: >>def __init__(self): >> class Inner: >> def __init__(self): pass >> a = Inner() > > This create a duplicate Inner class object for every instance of Outer, > which is almost c

Re: Finding the instance reference of an object [long and probably boring]

2008-11-07 Thread Aaron Brady
On Nov 7, 3:03 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > Joe Strout <[EMAIL PROTECTED]> writes: > > So.  How about this for a summary? > > > "Python uses call-by-sharing.  That's a special case of call-by-value > > where the variables are references to objects; it is these references > > th

Re: Finding the instance reference of an object [long and probably boring]

2008-11-07 Thread Arnaud Delobelle
Aaron Brady <[EMAIL PROTECTED]> writes: > Furthermore, some class models variables like this: > > a.b= 'abc' > a.c= 'def' > a.d= 'ghi' > > It also allows index access: a[0], a[1], a[2], respectively. 'abc' > has two names: 'a.b', and 'a[0]'. Correct? You know very well that a.b and a[0] aren't

Re: Daemon and logging - the best approach?

2008-11-07 Thread Lech Karol Pawłaszek
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Lech Karol Pawłaszek wrote: > >> And now I want to read logging config file before daemonize the program >> because the file might not be accessible after daemonization. > > Why might it be inaccessible just because you've daemonized?

Re: Python25\Tools\checkversions.py

2008-11-07 Thread Colin J. Williams
Martin v. Löwis wrote: I suggest that consideration be given to dropping it and and versionchecker from the distribution. I see that it still appears in versions 2.6 and 3.0. Please submit a bug report to bugs.python.org to this effect. Regards, Martin Done: components: Tests files: pyvers

What exactly is an "Implementation of Python" ?

2008-11-07 Thread webtourist
Warning: New learner here Not sure what the term means "implementation of Python". So what exactly does it mean *"implementation of Python"* like cpython, Jython, IronPython ? In terms of IronPython --- does it mean a Python programmer can write .Net app in Python ? Thanks examples and ANA

Re: What exactly is an "Implementation of Python" ?

2008-11-07 Thread Fiedzia
webtourist wrote: > Warning: New learner here > > Not sure what the term means "implementation of Python". > So what exactly does it mean *"implementation of Python"* like > cpython, Jython, IronPython ? Python is a programming language. Python implementation means Python interpreter or com

using exec() to instantiate a new object.

2008-11-07 Thread RyanN
Hello, I'm trying to teach myself OOP to do a data project involving hierarchical data structures. I've come up with an analogy for testing involving objects for continents, countries, and states where each object contains some attributes one of which is a list of objects. E.g. a country will con

Re: etymology of "list comprehension"?

2008-11-07 Thread mh
"Martin v. Lowis" <[EMAIL PROTECTED]> wrote: > The definition in logic, in turn, matches my understanding of the > English word "to comprehend": If I know all attributes, marks, > etc of an object, I understand it fully, i.e. I comprehend it. I think also that as was pointed out, "comprehension" m

Re: Snippets management

2008-11-07 Thread Ricardo Aráoz
Edwin B. wrote: > Robert Lehmann <[EMAIL PROTECTED]> writes: > >> I don't think there is a one-size-fits-all solution. > > I definetly agree. > >> Setting up a 'snippets' repository sounds good if you just want to be >> able to look back at what you've done and/or have a place to stash away >>

Re: Does Python have Multiple Inheritance ?

2008-11-07 Thread Steve Holden
Lawrence D'Oliveiro wrote: > In message > <[EMAIL PROTECTED]>, > Michele Simionato wrote: > >> On Nov 7, 4:38 pm, Tim Golden <[EMAIL PROTECTED]> wrote: >> >>> Seriously, though, although Python does indeed support multiple >>> inheritance, I have the impression from comments over the years that it

Re: Snippets management

2008-11-07 Thread Stef Mientki
expora wrote: On Nov 6, 12:38 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: Edwin wrote: Hi there, I've been looking for a snippet manager and found PySnippet but it requires PyGTK. Do you know any other option that doesn't need much? I'm sort of new to python and user inte

Re: Snippets management

2008-11-07 Thread Edwin
On Nov 7, 6:36 pm, Ricardo Aráoz <[EMAIL PROTECTED]> wrote: > > Since you are in Linux you should definitely check "Basket". Go to it's > website and you'll be hooked, just what you need. Actually I use Mac OS and Free BSD but I'll check it out mate. Thanks for the tip!! -- http://mail.python.org/

Re: Snippets management

2008-11-07 Thread Edwin
On Nov 7, 5:38 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: > I've to extract the right libs from the larger program, > as I'm in an import crisis right now, > it may take a couple of days. > If it's not here by the end of next week, > mail be directly, because I forget a lot :-) > > cheers, > Stef

Re: creating a block file for file-like object

2008-11-07 Thread Iain
On Nov 7, 4:42 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: > In message > <[EMAIL PROTECTED]>, Iain > wrote: > > > Can someone give me some pointers as to how I might create some sort > > of blocking device file or named pipe ... > >     mkfifo /path/to/named/pipe Th

Re: using exec() to instantiate a new object.

2008-11-07 Thread Patrick Mullen
On Fri, Nov 7, 2008 at 2:23 PM, RyanN <[EMAIL PROTECTED]> wrote: > > to do this I tried: > >def addCountry(self,country_name): ># create an instance of country >exec(country_name + "= country('" + country_name + "')") ># Add this new instance of a country to a list >

Re: Finding the instance reference of an object

2008-11-07 Thread Douglas Alan
Joe Strout <[EMAIL PROTECTED]> writes: > As for where I get my definitions from, I draw from several sources: > > 1. Dead-tree textbooks You've been reading the wrong textbooks. Read Liskov -- she's called CLU (and hence Python's) calling strategy "call-by-sharing" since the 70s. > 2. Wikipedia

best way to accelerate xmlrpc?

2008-11-07 Thread mh
I've got some python xmlrpc servers and clients. What's the best way to accelerate them? xmlrpclib.py attempts to import these modules: import _xmlrpclib import sgmlop from xml.parsers import expat and falls back to defining the SlowParser class. So, which of these modules is the pr

Re: best way to accelerate xmlrpc?

2008-11-07 Thread skip
Mark> I've got some python xmlrpc servers and clients. What's the best Mark> way to accelerate them? Mark> xmlrpclib.py attempts to import these modules: Mark> import _xmlrpclib Mark> import sgmlop Mark> from xml.parsers import expat sgmlop always worked wel

Re: Extending Logger

2008-11-07 Thread polettog
On Nov 7, 8:23 pm, Matimus <[EMAIL PROTECTED]> wrote: > > Yes but in the other hand > > :http://docs.python.org/library/logging.html#logger-objects > > "Note that Loggers are never instantiated directly, but always through > > the module-level function logging.getLogger(name)." > > That is part of

Re: Finding the instance reference of an object

2008-11-07 Thread Douglas Alan
Joe Strout <[EMAIL PROTECTED]> writes: > Yes, OK, that's great. But there are several standard pass-by- > somethings that are defined by the CS community, and which are simple > and clear and apply to a wide variety of languages. "Pass by object" > isn't one of them. "Call-by-sharing" *is* one

marshal locks program even in thread

2008-11-07 Thread Zac Burns
Greetings, It seems that marshal.load will lock the problem if the file object (in this case a pipe) is not ready to be read from - even if it's done in a thread. The use case here is in writing a scripting interface for perforce using the -G option (http://www.perforce.com/perforce/doc.072/manua

Re: Finding the instance reference of an object [long and probably boring]

2008-11-07 Thread Aaron Brady
On Nov 7, 3:39 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > Aaron Brady <[EMAIL PROTECTED]> writes: > >  Furthermore, some class models variables like this: > > > a.b= 'abc' > > a.c= 'def' > > a.d= 'ghi' > > > It also allows index access: a[0], a[1], a[2], respectively.  'abc' > > has two name

Are .pyc files portable?

2008-11-07 Thread Roy Smith
I'm using Python as part of a test fixture for a large (mostly C++) software project. We build on a lot of different platforms, but Solaris is a special case -- we build on Solaris 8, and then run our test suite on Solaris 8, 9, and 10. The way the build system is set up (driven by Build Forge),

Re: Are .pyc files portable?

2008-11-07 Thread Wubbulous
Python compiles to bytecode, which means that pyc files can be interpreted by any Python executable regardless of platform. As for manual compilation to directories, the py_compile module is the one you want. Here's an example program to plug in. #test_compile.py# import py_compile print "hello

Is there a way to step debug the multiprocessing python program?

2008-11-07 Thread davy zhang
I mean every process attach like thread in wingide like thread or tasklet in wingide :) maybe I asked t much:D -- http://mail.python.org/mailman/listinfo/python-list

Re: using exec() to instantiate a new object.

2008-11-07 Thread Aaron Brady
On Nov 7, 4:23 pm, RyanN <[EMAIL PROTECTED]> wrote: > Hello, > > I'm trying to teach myself OOP to do a data project involving > hierarchical data structures. > > I've come up with an analogy for testing involving objects for > continents, countries, and states where each object contains some > att

Re: Is there a way to step debug the multiprocessing python program?

2008-11-07 Thread Aaron Brady
On Nov 7, 9:15 pm, "davy zhang" <[EMAIL PROTECTED]> wrote: > I mean every process attach like thread in wingide > > like thread or tasklet in wingide > > :) > > maybe I asked t much:D Here is where 'multiprocessing' assembles the command line to spawn the subprocess (Windows version):

Re: Does Python have Multiple Inheritance ?

2008-11-07 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steve Holden wrote: > Lawrence D'Oliveiro wrote: > >> In message >> <[EMAIL PROTECTED]>, >> Michele Simionato wrote: >> >>> On Nov 7, 4:38 pm, Tim Golden <[EMAIL PROTECTED]> wrote: >>> Seriously, though, although Python does indeed support multiple inheri

Python COM: Automatic wrap/unwrap?

2008-11-07 Thread Greg Ewing
I'm creating a COM server in Python that will have one main class, with methods that create and return instances of other classes. I've found that I need to use win32com.server.util.wrap and unwrap on these objects when they pass over a COM connection. This doesn't seem very convenient, especiall

Re: Finding the instance reference of an object

2008-11-07 Thread greg
Steven D'Aprano wrote: Python's behaviour is not the same as what Pascal, or C, calls call-by-value. Python's assignment is not the same as what Pascal or C calls assignment, either. Yet we don't hear anyone claim that the term "assignment" shouldn't be used in Python. The difference between c

Re: Finding the instance reference of an object [long and probably boring]

2008-11-07 Thread Steven D'Aprano
In an attempt to keep this post from hitting the ridiculous length of one of my posts last night, I'm going to skip over a lot of things Joe writes that aren't critical. Just because I've skipped over a comment doesn't mean I agree with it, merely that I don't think it gains much to argue the p

Re: Finding the instance reference of an object [long and probably boring]

2008-11-07 Thread Steven D'Aprano
On Fri, 07 Nov 2008 13:05:16 -0700, Joe Strout wrote: > In Python, AFAICT, there is only one type, the object reference. So, > the type of every variable is 'reference', and each one contains a > reference. This is wrong. If we take "variable" to mean "name", then Python names do not have types

Re: Finding the instance reference of an object

2008-11-07 Thread Steven D'Aprano
On Sat, 08 Nov 2008 17:12:00 +1300, greg wrote: > Steven D'Aprano wrote: >> Python's behaviour is not the same as what Pascal, or C, calls >> call-by-value. > > Python's assignment is not the same as what Pascal or C calls > assignment, either. Yet we don't hear anyone claim that the term > "assi

Re: Are .pyc files portable?

2008-11-07 Thread Steven D'Aprano
On Fri, 07 Nov 2008 19:01:31 -0800, Wubbulous wrote: > Python compiles to bytecode, which means that pyc files can be > interpreted by any Python executable regardless of platform. No, bytecode isn't compatible from one version number to another. -- Steven -- http://mail.python.org/mailman/li

Very simple - please help

2008-11-07 Thread pineapple
I am not a python programmer, but am being forced to port one of my (smalltalk) applications to python for pragmatic reasons (python is embedded with a graphics package I am switching over to, so to use the graphics package I am essentially forced to use python). Okay, enough background. At any r

Re: Very simple - please help

2008-11-07 Thread Chris Rebert
On Fri, Nov 7, 2008 at 8:52 PM, pineapple <[EMAIL PROTECTED]> wrote: > I am not a python programmer, but am being forced to port one of my > (smalltalk) applications to python for pragmatic reasons (python is > embedded with a graphics package I am switching over to, so to use the > graphics packag

Re: Finding the instance reference of an object

2008-11-07 Thread greg
Marc 'BlackJack' Rintsch wrote: You have said the value that is copied is a pointer to the object. This assumes that "call by value" means "call by copying the value". That assumption is WRONG. It doesn't mean that. It means "call by ASSIGNING the value." So, you can think of the value of a

Re: Very simple - please help

2008-11-07 Thread Mark Tolonen
"Chris Rebert" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Fri, Nov 7, 2008 at 8:52 PM, pineapple <[EMAIL PROTECTED]> wrote: I am not a python programmer, but am being forced to port one of my (smalltalk) applications to python for pragmatic reasons (python is embedded with

Re: Finding the instance reference of an object

2008-11-07 Thread greg
Arnaud Delobelle wrote: 'Pass by value' is not relevant to Python as variables do not contain anything. Where abouts in the phrase "pass by value" does the word "contain" appear? You don't need a notion of containment in order for "pass by value" to have meaning. All you need is some notion o

Re: Finding the instance reference of an object

2008-11-07 Thread greg
Joe Strout wrote: On Nov 5, 2008, at 2:06 PM, Lie wrote: Another example: pass-by-object. Here's where we depart, I guess. I think there's no such thing (see for example, and the dead-tree references I have on hand agree). Something has

using datetime containers

2008-11-07 Thread indika
Hi, I'm a newbie to python but have some experience in programming. I came across this requirement of using datetime.date objects associated with some another object. eg. a dictionary containing datetime.date => string >> { datetime.date(2001, 12, 3): 'c', datetime.date(2001, 12, 1): 'a', datetime.

Re: Finding the instance reference of an object

2008-11-07 Thread Steven D'Aprano
On Sat, 08 Nov 2008 18:31:47 +1300, greg wrote: > Marc 'BlackJack' Rintsch wrote: > >> You have said the value that is copied is a pointer to the object. > > This assumes that "call by value" means "call by copying the value". > > That assumption is WRONG. Not according to my Comp Sci lecturer

Re: Finding the instance reference of an object

2008-11-07 Thread Steven D'Aprano
On Sat, 08 Nov 2008 19:30:17 +1300, greg wrote: > Something has just occurred to me. If you take the view that the value > of an expression is an object, then the terms "value" and "object" are > synonymous. So far so good. > So if you then insist that Python uses "call by object", you're actual

<    1   2