Re: No matter what I do, IDLE will not work...

2011-11-10 Thread Ned Deily
In article <415ed0ec-65a5-41df-b81e-d74786c74...@s5g2000vbe.googlegroups.com>, CAMERON ALLEY wrote: > IT WORKS I didn't change my activestate, but I downloaded python > 3.2.2 with the 32 bit installer and it works! Perfectally!! > > Sir you're my savior, thank you so much. > > I don't know

Re: property decorator and inheritance

2011-11-10 Thread Chris Rebert
On Thu, Nov 10, 2011 at 9:17 PM, Laurent wrote: > Yes using a separate class variable would transfer the problem to the class > level. But adding 10 class variables if I have 10 properties would be ugly. > Maybe I should reformulate the subject of this thread to "is there some > python magic to

Re: property decorator and inheritance

2011-11-10 Thread OKB (not okblacke)
Laurent wrote: > Yes using a separate class variable would transfer the problem to > the class level. But adding 10 class variables if I have 10 > properties would be ugly. Maybe I should reformulate the subject of > this thread to "is there some python magic to pass parameters to > decorator-decl

Re: all() is slow?

2011-11-10 Thread OKB (not okblacke)
Devin Jeanpierre wrote: >> '--' not being allowed for a name has *nothing* to do with exec, and >> everything to do with `--` not being a valid Python identifier. > > The only reason valid python identifiers come into it at all is > because they get pasted into a string where identifiers would g

Re: property decorator and inheritance

2011-11-10 Thread Laurent
Yes using a separate class variable would transfer the problem to the class level. But adding 10 class variables if I have 10 properties would be ugly. Maybe I should reformulate the subject of this thread to "is there some python magic to pass parameters to decorator-declared properties ?" --

Re: property decorator and inheritance

2011-11-10 Thread alex23
On Nov 11, 2:03 pm, Laurent wrote: > Hi. I couldn't find a way to overwrite a property declared using a decorator > in a parent class. > class Polite: >     @property >     def greeting2(self, suffix=", my dear."): >         return self._greeting + suffix Here you set up greeting2 as a property

Re: No matter what I do, IDLE will not work...

2011-11-10 Thread CAMERON ALLEY
IT WORKS I didn't change my activestate, but I downloaded python 3.2.2 with the 32 bit installer and it works! Perfectally!! Sir you're my savior, thank you so much. I don't know how you did it but you just made my day :) Thanks again -- http://mail.python.org/mailman/listinfo/python-list

Re: all() is slow?

2011-11-10 Thread Devin Jeanpierre
> You will notice both of them keep the field name validation. There are lots of reasons for that to be the case. To me, the most likely one just seems to be that you don't want to remove more than necessary when changing the way something works under the hood -- both for compatibility reasons, an

Re: No matter what I do, IDLE will not work...

2011-11-10 Thread CAMERON ALLEY
On Nov 10, 7:27 pm, Ned Deily wrote: > That's an odd one; I've not seen a crash like that before.  From the > crash dump, it is clear that the crash is happening inside of Tk, not > Python, and, judging from the symbol names, it has something to do with > menu initialization and colors. > > Try ru

property decorator and inheritance

2011-11-10 Thread Laurent
Hi. I couldn't find a way to overwrite a property declared using a decorator in a parent class. I can only do this if I use the "classic" property() method along with a getter function. Here's an example: #!/usr/bin/python3 class Polite: def __init__(self): self._greeting = "He

Re: The python implementation of the "relationships between classes".

2011-11-10 Thread Jerry Zhang
A general description of my issue. To my understand, python's feature such as "name-reference-object" and "garbage collection" system did some of work for you, it makes your life easier, but you still need to add your explicit application in your code. For example, Composition implementation: you

Re: Working with databases (ODBC and ORMs) in Python 3.2

2011-11-10 Thread Jerry Zhang
2011/11/11 tkp...@hotmail.com > We are in the process of trying to decide between Python 2.7 and 3.2 > with a view to making a 5-10 year commitment to the right platform, > and would appreciate some guidance on how best to connect to SQL > databases in 3.2. ceODBC 2.01 provides an ODBC driver for

Re: The python implementation of the "relationships between classes".

2011-11-10 Thread Jerry Zhang
2011/11/11 Chris Angelico > On Fri, Nov 11, 2011 at 10:14 AM, Chris Kaynor > wrote: > > Continuing this OT discussion, would it be a brain transplant, or a > > full body transplant? > > It's just a rebinding. You don't move the body, you just bind your > name to a new body. It's perfectly legal

Re: The python implementation of the "relationships between classes".

2011-11-10 Thread Jerry Zhang
2011/11/11 Terry Reedy > On 11/10/2011 9:31 AM, Jerry Zhang wrote: > > Unfortunately there is a difference between composition and >>aggregation in my real word, and my application really care this >>since it is trying to simulate this real world model, so my system >>should track

Re: The python implementation of the "relationships between classes".

2011-11-10 Thread Jerry Zhang
2011/11/11 Benjamin Kaplan > On Thu, Nov 10, 2011 at 1:06 PM, Jerry Zhang > wrote: > > > > > > I just did an example code to describe what i am looking for. > > > /**/ > > # ... > > > > class Head: >

Solution

2011-11-10 Thread Gagou Final Fantasy
A common problem when you generate executable on Windows 7 and deploy on Windows XP. According with the py2exe tutorial, you need include the MVC DLL. But the tutorial is old and the script given search only in one directory. Before, the directory contained all DLL and the manifest, but nowadays i

Re: No matter what I do, IDLE will not work...

2011-11-10 Thread Ned Deily
In article <3c2688bd-4f87-4eb1-9b40-3cb536a2d...@e3g2000vbs.googlegroups.com>, CAMERON ALLEY wrote: > Lemme preface this post by saying the following - I've taken my > computer to the local IT office on RIT campus, asked a Computer > Science professor specializing in Python, and posted my questi

Re: No matter what I do, IDLE will not work...

2011-11-10 Thread Terry Reedy
On 11/10/2011 5:40 PM, CAMERON ALLEY wrote: Okay, so the problem. I tried to install Python 2.7 about two months ago on both my laptop and iMac. Both are running up-to-date Mac OS X 10.6, with 64-bit processors and around 2.4GHz speed and 2G of RAM. My laptop installed python 2.7 and ran it perf

Re: The python implementation of the "relationships between classes".

2011-11-10 Thread Chris Angelico
On Fri, Nov 11, 2011 at 10:14 AM, Chris Kaynor wrote: > Continuing this OT discussion, would it be a brain transplant, or a > full body transplant? It's just a rebinding. You don't move the body, you just bind your name to a new body. It's perfectly legal to have two names bound to one body (cf D

Re: No matter what I do, IDLE will not work...

2011-11-10 Thread CAMERON ALLEY
On Nov 10, 6:11 pm, John Gordon wrote: > In <3c2688bd-4f87-4eb1-9b40-3cb536a2d...@e3g2000vbs.googlegroups.com> CAMERON > ALLEY writes: > > > Okay, so the problem. I tried to install Python 2.7 about two months > > ago on both my laptop and iMac. Both are running up-to-date Mac OS X > > 10.6, wit

Re: No matter what I do, IDLE will not work...

2011-11-10 Thread John Gordon
In <3c2688bd-4f87-4eb1-9b40-3cb536a2d...@e3g2000vbs.googlegroups.com> CAMERON ALLEY writes: > Okay, so the problem. I tried to install Python 2.7 about two months > ago on both my laptop and iMac. Both are running up-to-date Mac OS X > 10.6, with 64-bit processors and around 2.4GHz speed and 2G

Re: The python implementation of the "relationships between classes".

2011-11-10 Thread Chris Kaynor
On Thu, Nov 10, 2011 at 2:48 PM, Steven D'Aprano wrote: > On Thu, 10 Nov 2011 14:38:58 -0500, Terry Reedy wrote: > >> I will point out that in the real world, dead donor transplants are >> based on the fact the parts of the body do NOT have to die when the >> composition does. I will not be surpri

Re: all() is slow?

2011-11-10 Thread Steven D'Aprano
On Thu, 10 Nov 2011 15:37:05 -0500, Devin Jeanpierre wrote: >> '--' not being allowed for a name has *nothing* to do with exec, and >> everything to do with `--` not being a valid Python identifier. > > The only reason valid python identifiers come into it at all is because > they get pasted into

Re: all() is slow?

2011-11-10 Thread Steven D'Aprano
On Thu, 10 Nov 2011 14:19:18 -0700, Ian Kelly wrote: > On Thu, Nov 10, 2011 at 1:37 PM, Devin Jeanpierre > wrote: >> Of course not. I do, however, think that it's conceivable that I'd want >> to key a namedtuple by an invalid identifier, and to do that, yes, I'd >> need to use getattr(). > > Car

Re: all() is slow?

2011-11-10 Thread Ethan Furman
Devin Jeanpierre wrote: The only reason valid python identifiers come into it at all is because they get pasted into a string where identifiers would go, and that string is passed to exec(). So really, does it have "nothing" to do with exec? Or does your argument eventually boil down to the use

Re: The python implementation of the "relationships between classes".

2011-11-10 Thread Steven D'Aprano
On Thu, 10 Nov 2011 14:38:58 -0500, Terry Reedy wrote: > I will point out that in the real world, dead donor transplants are > based on the fact the parts of the body do NOT have to die when the > composition does. I will not be surprised if we someday see arm > transplants. And Guido's Time Mach

No matter what I do, IDLE will not work...

2011-11-10 Thread CAMERON ALLEY
Lemme preface this post by saying the following - I've taken my computer to the local IT office on RIT campus, asked a Computer Science professor specializing in Python, and posted my question on answers.yahoo.com (I don't know why I expected that to work...). I've also googled my problem multiple

Re: Decorator question: prefer class, but only function works

2011-11-10 Thread Ian Kelly
On Thu, Nov 10, 2011 at 2:52 PM, Russell E. Owen wrote: > I am trying to write a decorator that times an instance method and > writes the results to a class member variable. For example: > > def timeMethod(func): >    def wrapper(self, *args, **keyArgs): >        t1 = time.time() >        res = fu

Decorator question: prefer class, but only function works

2011-11-10 Thread Russell E. Owen
I am trying to write a decorator that times an instance method and writes the results to a class member variable. For example: def timeMethod(func): def wrapper(self, *args, **keyArgs): t1 = time.time() res = func(self, *args, **keyArgs) duration = time.time() - t1

[ANN] pyKook 0.7.1 - task automation tool for Python, similar to Rake or Ant

2011-11-10 Thread Makoto Kuwata
I have released pyKook 0.7.1.http://pypi.python.org/pypi/Kook/http://www.kuwata-lab.com/kook/http://www.kuwata-lab.com/kook/pykook-users-guide.html pyKook is a task automation tool for Python, similar to Rake or Ant. Bugfix in this release-- * Fixed to include 'kook/books/*.py'

Re: all() is slow?

2011-11-10 Thread Ian Kelly
On Thu, Nov 10, 2011 at 1:37 PM, Devin Jeanpierre wrote: > Of course not. I do, however, think that it's conceivable that I'd > want to key a namedtuple by an invalid identifier, and to do that, > yes, I'd need to use getattr(). Care to give a real use case? You could even go a step further and

Re: The python implementation of the "relationships between classes".

2011-11-10 Thread Ethan Furman
Benjamin Kaplan wrote: You're still misunderstanding Python's object model. del does NOT delete an object. It deletes a name. The only way for an object to be deleted is for it to be inaccessible (there are no references to it, or there are no reachable references to it). foo = object() bar = fo

Re: easy_install doesn't install non-package *.py file

2011-11-10 Thread Makoto Kuwata
On Thu, Nov 10, 2011 at 6:08 PM, Jonathan Hartley wrote: > Hey. I don't know the details, but your setup.py needs to use either the > 'package_data' or the 'data_files' entry in the dict you pass to setup. These > can specify files you want included in the sdist which aren't package files. > > T

Re: all() is slow?

2011-11-10 Thread Devin Jeanpierre
> '--' not being allowed for a name has *nothing* to do with exec, and > everything to do with `--` not being a valid Python identifier. The only reason valid python identifiers come into it at all is because they get pasted into a string where identifiers would go, and that string is passed to ex

Re: Working with databases (ODBC and ORMs) in Python 3.2

2011-11-10 Thread Nathan Rice
For now, get started in Python 2.7. Write code with an eye to 3.x portability, and you will be fine. You probably won't see 3.x overtake 2.x for at least 3-4 years, and a decent amount of stuff is still 2.x only. Since it sounds like you are a windows/net shop, go ahead and use Iron Python. SQL

Re: all() is slow?

2011-11-10 Thread OKB (not okblacke)
John Nagle wrote: > On 11/7/2011 1:00 PM, OKB (not okblacke) wrote: >> I noticed this (Python 2.6.5 on Windows XP): > > CPython is slow. It's a naive interpreter. There's > almost no optimization during compilation. Try PyPy > or Shed Skin. PyPy is interesting, but I use

Re: The python implementation of the "relationships between classes".

2011-11-10 Thread Terry Reedy
On 11/10/2011 9:31 AM, Jerry Zhang wrote: Unfortunately there is a difference between composition and aggregation in my real word, and my application really care this since it is trying to simulate this real world model, so my system should track this difference accurately, other

Re: The python implementation of the "relationships between classes".

2011-11-10 Thread Benjamin Kaplan
On Thu, Nov 10, 2011 at 1:06 PM, Jerry Zhang wrote: > > > I just did an example code to describe what i am looking for. > /**/ > # ... > > class Head: >     def __init__(self): >     self.size = 5 >

Re: all() is slow?

2011-11-10 Thread Terry Reedy
On 11/10/2011 3:51 AM, Devin Jeanpierre wrote: Because Python doesn't allow "--" to be an attribute name, and so namedtuple doesn't let you try: t = namedtuple("T", "foo -- bar")(1, 2, 3) print(t.foo) print(t.--) print(t.bar) '--' is a valid attribute name on virtually any object that support

Re: all() is slow?

2011-11-10 Thread Ethan Furman
Devin Jeanpierre wrote: Well. It reads fine in a certain sense, in that I can figure out what's going on (although I have some troubles figuring out why the heck certain things are in the code). The issue is that what's going on is otherworldly: this is not a Python pattern, this is not a normal

Working with databases (ODBC and ORMs) in Python 3.2

2011-11-10 Thread tkp...@hotmail.com
We are in the process of trying to decide between Python 2.7 and 3.2 with a view to making a 5-10 year commitment to the right platform, and would appreciate some guidance on how best to connect to SQL databases in 3.2. ceODBC 2.01 provides an ODBC driver for Python 3.2, does anyone have experience

Re: The python implementation of the "relationships between classes".

2011-11-10 Thread Jerry Zhang
2011/11/11 Christian Heimes > Am 10.11.2011 17:09, schrieb Tim Wintle: > >> Meanwhile, I have a ZODB running, which stores all the living > >> objects. > > > > The ZODB is append only and stores all objects. Deleting references to > > an object (which would causes deletion of standard python obje

Re: The python implementation of the "relationships between classes".

2011-11-10 Thread Jerry Zhang
2011/11/11 Tim Wintle > On Thu, 2011-11-10 at 22:25 +0800, Jerry Zhang wrote: > > > > > > 2011/11/10 Chris Angelico > > On Fri, Nov 11, 2011 at 12:58 AM, Jerry Zhang > > wrote: > > > Cls_a: > > > def __init__(self): > > > self.at1 = 1 > >

Re: simple import hook

2011-11-10 Thread Andrea Crotti
On 11/10/2011 05:02 PM, Eric Snow wrote: Yeah, I'm working on a reference for imports in Python. They're just a little too mysterious relative to the rest of the language. But it's not too helpful yet. In the meantime... Yes it's quite mysterious, and it's actually not as hard as it looks..

Re: Agent-based modeling

2011-11-10 Thread Virgil Stokes
On 10-Nov-2011 16:16, Jerry Zhang wrote: 2011/11/10 Virgil Stokes mailto:v...@it.uu.se>> Python seems like a good language to use for agent-based modeling. However, before starting to work on a Python package for this, I would be very interested in knowing about any existing Python

Re: The python implementation of the "relationships between classes".

2011-11-10 Thread Christian Heimes
Am 10.11.2011 17:09, schrieb Tim Wintle: >> Meanwhile, I have a ZODB running, which stores all the living >> objects. > > The ZODB is append only and stores all objects. Deleting references to > an object (which would causes deletion of standard python objects) won't > delete it from the zodb, it

Re: The python implementation of the "relationships between classes".

2011-11-10 Thread Tim Wintle
On Thu, 2011-11-10 at 22:25 +0800, Jerry Zhang wrote: > > > 2011/11/10 Chris Angelico > On Fri, Nov 11, 2011 at 12:58 AM, Jerry Zhang > wrote: > > Cls_a: > > def __init__(self): > > self.at1 = 1 > > Cls_b: > > def __init__(

simple import hook

2011-11-10 Thread Andrea Crotti
So I would really like to accomplish the following: run a program normally and keep track of all the imports that were actually done. I studied the PEP 302, but I'm still a bit confused about how to do it. I thought that instead of implementing everything I could just record the request and

Re: Agent-based modeling

2011-11-10 Thread Jerry Zhang
2011/11/10 Virgil Stokes > Python seems like a good language to use for agent-based modeling. > However, before starting to work on a Python package for this, I would be > very interested in knowing about any existing Python code for agent-based > modeling. > I am assuming you are talking about

Agent-based modeling

2011-11-10 Thread Virgil Stokes
Python seems like a good language to use for agent-based modeling. However, before starting to work on a Python package for this, I would be very interested in knowing about any existing Python code for agent-based modeling. --V -- http://mail.python.org/mailman/listinfo/python-list

she want a boy friend for dating

2011-11-10 Thread sweet girl
she want a boy friend for dating http://alturl.com/b5ikf http://alturl.com/b5ikf http://alturl.com/b5ikf http://alturl.com/b5ikf -- http://mail.python.org/mailman/listinfo/python-list

Re: The python implementation of the "relationships between classes".

2011-11-10 Thread Jerry Zhang
2011/11/10 Jerry Zhang > > > 2011/11/10 Chris Angelico > >> On Fri, Nov 11, 2011 at 12:58 AM, Jerry Zhang >> wrote: >> > Cls_a: >> > def __init__(self): >> > self.at1 = 1 >> > Cls_b: >> > def __init__(self): >> > self.com1 = Cls_a() >> > def __del__(self): >> >

Re: The python implementation of the "relationships between classes".

2011-11-10 Thread Jerry Zhang
2011/11/10 Chris Angelico > On Fri, Nov 11, 2011 at 12:58 AM, Jerry Zhang > wrote: > > Cls_a: > > def __init__(self): > > self.at1 = 1 > > Cls_b: > > def __init__(self): > > self.com1 = Cls_a() > > def __del__(self): > > del self.com1 > > Is it a right impleme

Re: The python implementation of the "relationships between classes".

2011-11-10 Thread Chris Angelico
On Fri, Nov 11, 2011 at 12:58 AM, Jerry Zhang wrote: > Cls_a: >     def __init__(self): >         self.at1 = 1 > Cls_b: >     def __init__(self): >         self.com1 = Cls_a() >     def __del__(self): >         del self.com1 > Is it a right implementation for composition? Yes, except that you don

Re: The python implementation of the "relationships between classes".

2011-11-10 Thread Jerry Zhang
Hi Chris, Firstly thanks for your quick reply. 1. Your code example gives a point, but i may not reach my question yet, maybe because i did not make myself understood yet. Here is a more detail example question. I have a classes sets described by UML, which could be refered as Cls_A, Cls_B, CLs_

Re: The python implementation of the "relationships between classes".

2011-11-10 Thread Chris Angelico
On Fri, Nov 11, 2011 at 12:15 AM, Jerry Zhang wrote: > For example, in composition model, the container object may be responsible > for the handling of embedded objects' lifecycle. What is the python pattern > of such implementation? Here's an example: class Test(object): def __init__(self):

Re: all() is slow?

2011-11-10 Thread gene heskett
On Thursday, November 10, 2011 08:13:13 AM Devin Jeanpierre did opine: > > I don't expect you to take my word on it (and why should you, I could > > be an idiot or a sock-puppet), but you could always try googling for > > "Raymond Hettinger python" and see what comes up. He is not some > > fly-by

The python implementation of the "relationships between classes".

2011-11-10 Thread Jerry Zhang
Greetings: As you know, there are several kinds of relationships between classes in the UML -- dependency, association, aggregation, composition. Q1. Is there any article or code example on its implementation in python? Q2. For example, in composition model, the container object may be responsible

How to derive from datetime.timezone class?

2011-11-10 Thread Baptiste Lepilleur
Hi, I want to sub-class the datetime.timezone class, but when I derive from datetime.timezone I get an error message "TypeError: type 'datetime.timezone' is not an acceptable base type". Why do I get this error? Is there something specific to do to avoid it? Below is an example of code: Python 3

dao 0.7.4 released

2011-11-10 Thread Simeon Chaos
What's new in dao 0.7.4? *Release date: 2011-11-10 * new in code: * quasiquote, unquote, unquote_slicing is implemented. * directly evaluate sexpression in solver * some builtins for define, set and get global, outer and local var

Re: easy_install doesn't install non-package *.py file

2011-11-10 Thread Jonathan Hartley
Hey. I don't know the details, but your setup.py needs to use either the 'package_data' or the 'data_files' entry in the dict you pass to setup. These can specify files you want included in the sdist which aren't package files. There are many complications with using them though. One of them in

Re: all() is slow?

2011-11-10 Thread Devin Jeanpierre
> I don't expect you to take my word on it (and why should you, I could be > an idiot or a sock-puppet), but you could always try googling for > "Raymond Hettinger python" and see what comes up. He is not some fly-by > Python coder who snuck some dubious n00b code into the standard library > when n