New York City Python Users Group meeting is planned for Dec. 12th @ 6pm - please RSVP!

2006-12-14 Thread John Clark
Greetings!

The next New York City Python Users Group meeting is this Tuesday, Dec.
12th, 6pm at at the Millennium Partners office at 666 Fifth Avenue on the
8th Floor.  We welcome all those in the NYC area who are interested in
Python to attend.  However, we need a list of first and last names to give
to building security to make sure you can gain access to the building.  If
you would please RSVP to clajo04ATmacDOTcom to add your name to the list.  

More information can be found on the yahoo group page:

http://tech.groups.yahoo.com/group/nycpython/

Hope to see you there!

-John


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


NYC Python User Group Meeting

2007-01-04 Thread John Clark
Greetings!

The next New York City Python Users Group meeting is this Tuesday, Jan. 9th,
6:30pm at at the Millennium Partners office at 666 Fifth Avenue (53rd St.
and 5th Ave.) on the 8th Floor. We welcome all those in the NYC area who are
interested in Python to attend. However, we need a list of first and last
names to give to building security to make sure you can gain access to the
building. RSVP to [EMAIL PROTECTED] to add your name to the list. 

More information can be found on the yahoo group page:

http://tech.groups.yahoo.com/group/nycpython/

Hope to see you there!

-John


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


New York City Python Users Group Meeting - Tuesday May 8th

2007-05-03 Thread John Clark
Greetings!

The next New York City Python Users Group meeting is this Tuesday, May 8th,
6:30pm at at the Millennium Partners office at 666 Fifth Avenue (53rd St.
and 5th Ave.) on the 8th Floor. We welcome all those in the NYC area who are
interested in Python to attend. However, we need a list of first and last
names to give to building security to make sure you can gain access to the
building. RSVP to [EMAIL PROTECTED] to add your name to the list. 

More information can be found on the yahoo group page:

 
http://tech.groups.yahoo.com/group/nycpython/

Hope to see you there!

-John

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

RE: calling super()

2007-04-04 Thread John Clark
Yeah!!! One I can actually answer!!!

super() only works on new-style classes - your classes don't have object
anywhere in the inheritance tree so super() isn't going to help..

New-style classes are known as types, old-style classes are known as
classobjs.

Hope this helps,
-jdc


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Wednesday, April 04, 2007 3:23 PM
To: python-list@python.org
Subject: calling super()

Hello, I have been trying to call the super constructor from my derived
class but its not working as expected. See the code:

class HTMLMain:
def __init__(self):
self.text = "";
print(self.text);
def __del__(self):
self.text = "";
print(self.text);

class NewPage(HTMLMain):
def __init__(self):
print 'derive2 init'
super(NewPage, self).__init__();


N = NewPage();
del N


And here's the error message I get:

Traceback (most recent call last):
  File "e:/PyEN/inherit.py", line 16, in 
N = NewPage();
  File "e:/PyEN/inherit.py", line 12, in __init__
super(NewPage, self).__init__();
TypeError: super() argument 1 must be type, not classobj

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

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


RE: calling super()

2007-04-04 Thread John Clark

Please be aware that super() has it's own set of gotchas - it's not as clean
as you would hope.  For more info: http://fuhm.org/super-harmful/

(I'm not the author, I was referred to this article while struggling with
wxPython and super())

-John Clark 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Laszlo
Nagy
Sent: Wednesday, April 04, 2007 4:09 PM
To: Jarek Zgoda; python-list@python.org; [EMAIL PROTECTED]
Subject: Re: calling super()

Jarek Zgoda wrote:
>> Hello, I have been trying to call the super constructor from my 
>> derived class but its not working as expected. See the code:
>>
>> class HTMLMain:
>> def __init__(self):
>> self.text = "";
>> print(self.text);
>> def __del__(self):
>> self.text = "";
>> print(self.text);
>>
>> class NewPage(HTMLMain):
>> def __init__(self):
>> print 'derive2 init'
>> super(NewPage, self).__init__();
>> 
>
> This should read: super(HTMLMain, self).__init__()
>   
Definitely, this is not true. Well, it depends what the OP wanted to do
here, but in 99.9% of the cases, you want to use

class B(A):
def method(self,*args):
   super(B,self).method(*args)

Look at here: http://www.python.org/doc/2.3.5/lib/built-in-funcs.html#l2h-66
It tells that super(type,[self]) will """Return the superclass of type.""".
So super(B) will return the superclass of B, that is A. The built-in
function "super" is very useful when you have diamond-shaped inheritance and
you only want each inherited method to be called only once, IN THE CORRECT
ORDER. If you only have single inheritance class trees, then
super(B,self).method(*args) is identical to A.method(self,*args). You only
need to worry about method calling order when you use multiple inheritance.
However, using super is much nicer than calling the method of the base class
directly, and it is syntactically cleaner, since you will only have a single
reference to the base class, in the class definition header. (E.g. you can
change the base class by replacing one word in the source code...)

Best,

  Laszlo


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

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


RE: grandparent method with super

2007-04-05 Thread John Clark
Pretty sure you can do this:

class A(object):
def m(self):
class B(A):
def m(self):
class C(A):
def m(self):
class D(B,C):
def m(self):
A.m(self)
 
I don't think you want to try to use super() in this case.

-jdc 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Martin
Manns
Sent: Thursday, April 05, 2007 4:20 PM
To: python-list@python.org
Subject: grandparent method with super

Hi,

I have a class structure as follows and I would like to invoke the method
A.m() from D.m

class A(object):
def m(self):
class B(A):
def m(self):
class C(A):
def m(self):
class D(B,C):
def m(self):
# Call A.m with super?

I have read http://www.python.org/download/releases/2.2/descrintro/ but I am
still stuck.

Thanks in advance

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

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


RE: grandparent method with super

2007-04-05 Thread John Clark

>> Pretty sure you can do this:
>> 
>> class A(object):
>>  def m(self):
>> class B(A):
>>  def m(self):
>> class C(A):
>>  def m(self):
>> class D(B,C):
>>  def m(self):
>>  A.m(self)
>>  
>> I don't think you want to try to use super() in this case.
>
>That works, but when I replace A with something else, I do not get the
grandparent anymore 
>without changing all the method calls. Basically, I would like to call the
method m in the first 
>grandparent of D.
>
>Martin

I think the problem you may run into is with the term "first grandparent" -
when you look at the method resolution order of the class D, you will find
that the MRO goes "D, C, B, A"... I think it's going to be difficult to
figure out where the "first grandparent" is in the MRO. 

For example: 

class A(object):
def m(self):
pass
class B(A):
def m(self):
pass
class C(B):
def m(self):
pass
class D(A):
def m(self):
pass
class E(C,D):
def m(self):
firstgrandparent(E,self).m() #Should call B.m
class F(D,C):
def m(self):
firstgrandparent(F,self).m() # Should call F.m


The mro for class E is going to be "E,C,B,D,A" where as the mro for class F
is going to be "F,D,C,B,A".  However, the first grandparent for E should be
B, where as the first grandparent for F should be A.  

Because the MRO isn't just a depth first traversal, the term "first
grandparent" gets tricky to define...

-jdc 


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

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


RE: grandparent method with super

2007-04-05 Thread John Clark

> Not really. The first grandparent would be the first occurrence in the
list from left to right, which satisfies the requirement that its shortest
path to the current class is 2.

> The only problem: How do I get it?

> Martin

I suppose you could do a 

self.__class__.__bases__[0].__bases__[0] 

(With the appropriate error handling buit in..) 

But I am not sure if it's a safe assumption to depend on __bases__ returning
the classes in the order you want...

-jdc 


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

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


New York City Python Users Group Meeting

2007-04-11 Thread John Clark
Greetings!

The next New York City Python Users Group meeting is this Tuesday, April
10th, 6:30pm at at the Millennium Partners office at 666 Fifth Avenue (53rd
St. and 5th Ave.) on the 8th Floor. We welcome all those in the NYC area who
are interested in Python to attend. However, we need a list of first and
last names to give to building security to make sure you can gain access to
the building. RSVP to [EMAIL PROTECTED] to add your name to the list. 

More information can be found on the yahoo group page:

 
http://tech.groups.yahoo.com/group/nycpython/

Hope to see you there!

-John

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

ANN: Next NYC Python User Group meeting, Tues May 8th, 2007, 6:30 pm

2007-04-11 Thread John Clark
My apologies for the comical timing of the below announcement - I actually
sent the announcement on April 4th, but it obviously didn't clear the
moderator's desk in time for the meeting mentioned below.  In an attempt to
avoid this same problem, let me announce next month's meeting now.
 
The next New York City Python Users Group meeting is Tuesday, May 8th from
6:30-8:30pm at the Millenium Partners office at 666 Fifth Avenue (53rd St.
and 5th Ave.) on the 8th Floor.  We welcome all those in the NYC area who
are interested in Python to attend.  However, we need a list of first and
last names to give to building security to make sure you can gain access to
the building.  RSVP to [EMAIL PROTECTED] to add your name to the list.
 
More information can be found on the yahoo group page:
 
http://tech.groups.yahoo.com/group/nycpython
 
Hope to see you there!
 
-John


  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of John
Clark
Sent: Wednesday, April 04, 2007 3:46 PM
To: python-list@python.org; [EMAIL PROTECTED]; tutor@python.org
Subject: New York City Python Users Group Meeting



Greetings!

The next New York City Python Users Group meeting is this Tuesday, April
10th, 6:30pm at at the Millennium Partners office at 666 Fifth Avenue (53rd
St. and 5th Ave.) on the 8th Floor. We welcome all those in the NYC area who
are interested in Python to attend. However, we need a list of first and
last names to give to building security to make sure you can gain access to
the building. RSVP to [EMAIL PROTECTED] to add your name to the list. 

More information can be found on the yahoo group page:

 <http://tech.groups.yahoo.com/group/nycpython/>
http://tech.groups.yahoo.com/group/nycpython/

Hope to see you there!

-John

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

NYC Python User Group Meeting

2007-02-09 Thread John Clark
Greetings!

The next New York City Python Users Group meeting is this Tuesday, Feb.
13th, 6:30pm at at the Millennium Partners office at 666 Fifth Avenue (53rd
St. and 5th Ave.) on the 8th Floor. We welcome all those in the NYC area who
are interested in Python to attend. However, we need a list of first and
last names to give to building security to make sure you can gain access to
the building. RSVP to [EMAIL PROTECTED] to add your name to the list. 

More information can be found on the yahoo group page:

http://tech.groups.yahoo.com/group/nycpython/

Hope to see you there!

-John

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


NYC Python Users Meetup February Meeting Announcement....

2008-02-08 Thread John Clark
Please pardon the PSA: 

The New York City Python Users Meetup Group is planning on having our
February meeting on 
February 12th, from 6:30pm - 8:00pm. For more information, please see: 

http://python.meetup.com/172/calendar/7082384/ 

Anyone in the NYC area interested in using Python, learning more about
Python, or 
teaching others about Python is welcome to attend.

Thanks,
-jdc

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


NYC Python User Group Meeting Announcement....

2008-05-29 Thread John Clark
Greetings!

The next New York City Python Users Group meeting is planned for June 17th, 
6:30pm at Daylife Inc. at 444 Broadway (between Howard St. and Grand St.) on
the 5th Floor. We welcome all those in the NYC area who are interested in 
Python to attend.

More information can be found on the users group wiki page:

http://www.nycpython.org

Hope to see you there!

-John Clark


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