On 30/06/20 5:14 AM, joseph pareti wrote:
I have piece of code with constructs as follows:
*class* *SentimentNetwork**:*
*def* __init__*(*self*,* reviews*,* labels*,* hidden_nodes *=* 10*,*
learning_rate *=* 0.1*):*
np*.*random*.*seed*(*1*)*
self*.*init_network*(**len**(*s
You are misreading the original example. `init_network` is defined as a
method on the class, and called in its initializer. There is no property
named "init_network".
On Mon, Jun 29, 2020 at 1:18 PM joseph pareti wrote:
> I have piece of code with constructs as follows:
>
> *class* *SentimentNet
I have piece of code with constructs as follows:
*class* *SentimentNetwork**:*
*def* __init__*(*self*,* reviews*,* labels*,* hidden_nodes *=* 10*,*
learning_rate *=* 0.1*):*
np*.*random*.*seed*(*1*)*
self*.*init_network*(**len**(*self*.*review_vocab*),*hidden_nodes*,*
1*,
On 2020-04-01 13:42, Musbur wrote:
Hi guys,
I'm wondering how to create an instance of an extension class I wrote.
There's a minimal self-contained C module at the bottom of this post
which exports two things: 1) a class Series, and 2) a function
make_series() which is supposed to create a Serie
On 01/04/2020 18:24, Musbur wrote:
Am 01.04.2020 15:01 schrieb Rhodri James:
I believe you do it in C as you would in Python: you call the Series
class!
pyseries = PyObject_CallObject((PyObject *)&series_type, NULL);
Well, that dumps core just as everything else I tried.
What does work, ho
Am 01.04.2020 15:01 schrieb Rhodri James:
I believe you do it in C as you would in Python: you call the Series
class!
pyseries = PyObject_CallObject((PyObject *)&series_type, NULL);
Well, that dumps core just as everything else I tried.
What does work, however, is calling PyType_Ready first
On 01/04/2020 13:42, Musbur wrote:
So when created from C, neither the "new" nor the "init" functions are
called on the object, only "finalize". No wonder I get segfaults in the
real life application.
So how is this done right? Here's the C module:
I believe you do it in C as you would in Py
Hi guys,
I'm wondering how to create an instance of an extension class I wrote.
There's a minimal self-contained C module at the bottom of this post
which exports two things: 1) a class Series, and 2) a function
make_series() which is supposed to create a Series object on the C side
and retur
Hi, I need help with coding assignments (python to be exact) in school. I am
willing to pay for your attention by the hour. Please email me at
aifa...@protonmail.com if you’re interested. Please only reach out if you’re
not a beginner. Trying to avoid the blind being led by the blind. Thanks!
--
David Shi via Python-list writes:
> I found a Python class within an Open Source software.
> I would like to use it in my own Python script.
> I tried to import it, but I got following message.
Your text is mangled in transit. Please post only plain text messages
(avoid HTML or ot
On Wed, May 4, 2016 at 8:56 AM, David Shi via Python-list
wrote:
> I found a Python class within an Open Source software.
> I would like to use it in my own Python script.
> I tried to import it, but I got following message.
> from intersection import *Traceback (most recent call
I found a Python class within an Open Source software.
I would like to use it in my own Python script.
I tried to import it, but I got following message.
from intersection import *Traceback (most recent call last): File
"", line 1, in from intersection import *ImportError:
bad ma
Barry Scott, 11.03.2014 22:37:
> On 5 Mar 2014, at 00:14, Bill wrote:
>> I can't figure out how to create an instance
>> of a python class from 'C++':
>
> Why not use pycxx from http://sourceforge.net/projects/cxx/?
>
> This lib does all the heavy li
On 5 Mar 2014, at 00:14, Bill wrote:
> Hello:
>
> I can't figure out how to create an instance
> of a python class from 'C++':
>
Why not use pycxx from http://sourceforge.net/projects/cxx/?
This lib does all the heavy lifting for you for both python2 and
On Wednesday 05 March 2014 17:09:53 Grant Edwards did opine:
> On 2014-03-05, Alister wrote:
> >>> Why are you creating an ABC?
> >>
> >> Because it was the first binary computer that did calculations with
> >> electronic switching elements (gates), and it would be really cool to
> >> have one!
On 2014-03-05, Alister wrote:
>>
>>> Why are you creating an ABC?
>>
>> Because it was the first binary computer that did calculations with
>> electronic switching elements (gates), and it would be really cool to
>> have one! The ABC also pioneered the use of capciators as regenerative
>> storage
On Wed, 05 Mar 2014 16:08:00 +, Grant Edwards wrote:
> On 2014-03-05, Ian Kelly wrote:
>> On Tue, Mar 4, 2014 at 5:14 PM, Bill wrote:
>>> Hello:
>>>
>>> I can't figure out how to create an instance of a python class from
>>> 'C++'
On 2014-03-05, Ian Kelly wrote:
> On Tue, Mar 4, 2014 at 5:14 PM, Bill wrote:
>> Hello:
>>
>> I can't figure out how to create an instance
>> of a python class from 'C++':
>>
>> ( I am relatively new to Python so excuse some of the fol
>
> So far, so good. The object that was passed in was the "Derived"
> class object. Since you presumably only want class objects to be
> passed in, you might want to check that here using PyType_Check.
>
Yes. Will do.
>
> > PyTypeObject *typ = class_decl->ob_type;
>
> In Python, y
On Tue, Mar 4, 2014 at 5:14 PM, Bill wrote:
> Hello:
>
> I can't figure out how to create an instance
> of a python class from 'C++':
>
> ( I am relatively new to Python so excuse some of
> the following. )
>
> In a .py file I create an ABC and then s
Hello:
I can't figure out how to create an instance
of a python class from 'C++':
( I am relatively new to Python so excuse some of
the following. )
In a .py file I create an ABC and then specialize it:
from MyMod import *
from abc import ABCMeta, abstractmethod
On 03/29/2013 06:17 PM, Sam Berry wrote:
Thanks for the responses! My issue was sorted with Benjamins post, just
printing s worked.
Cheers for the info though Chris, if i have any further issues il post them
with some working code.
In that case, you probably should add a line like:
s = Non
On Sat, Mar 30, 2013 at 9:51 AM, Steven D'Aprano
wrote:
> On Sat, 30 Mar 2013 08:24:00 +1100, Chris Angelico wrote:
>
>> On Sat, Mar 30, 2013 at 8:12 AM, Sam Berry
>> wrote:
>>> class test()
>>> s = 1
>>>
>>> def test1()
>>> global s
>>> s = 2
>
>> That's not a global, tha
On Sat, 30 Mar 2013 08:24:00 +1100, Chris Angelico wrote:
> On Sat, Mar 30, 2013 at 8:12 AM, Sam Berry
> wrote:
>> class test()
>> s = 1
>>
>> def test1()
>> global s
>> s = 2
> That's not a global, that's a class variable.
/me thwacks Chris with a halibut.
Not only i
On Sat, Mar 30, 2013 at 9:17 AM, Sam Berry wrote:
> Thanks for the responses! My issue was sorted with Benjamins post, just
> printing s worked.
>
> Cheers for the info though Chris, if i have any further issues il post them
> with some working code.
Awesome! Always happy to help out.
ChrisA
-
Thanks for the responses! My issue was sorted with Benjamins post, just
printing s worked.
Cheers for the info though Chris, if i have any further issues il post them
with some working code.
Sam
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Mar 29, 2013 at 2:12 PM, Sam Berry wrote:
> Hey,
>
> Im new to object orientated programming and have an issue with using classes.
> Im using the kivy module, a GUI creator , so posting the actual code may
> confuse. But an example of what im trying to achieve is below
>
> class test()
>
On Sat, Mar 30, 2013 at 8:12 AM, Sam Berry wrote:
> class test()
> s = 1
>
> def test1()
> global s
> s = 2
>
> def test2()
> global s
> s = 3
>
> def test3()
> global s
> s = 4
That's not a global, that's a class variable. But to gi
Hey,
Im new to object orientated programming and have an issue with using classes.
Im using the kivy module, a GUI creator , so posting the actual code may
confuse. But an example of what im trying to achieve is below
class test()
s = 1
def test1()
global s
s = 2
On Friday, February 1, 2013, Charles Hoskinson wrote:
> I'm developing an online course for beginning python programmers starting
> from basic syntax through object oriented design and GUI. I'd like to
> include some helpful community resources like Code Academy in the appendix
> and I was wonderi
Charles Hoskinson wrote:
> I'm developing an online course for beginning python programmers starting
> from basic syntax through object oriented design and GUI. I'd like to
> include some helpful community resources like Code Academy in the appendix
> and I was wondering if this community has some
On Thu, 20 Sep 2012 06:52:07 -0700, Jure Erznožnik wrote:
> I'm trying to create a class that would lie to the user that a member is
> in some cases a simple variable and in other cases a class. The nature
> of the member would depend on call syntax like so:
> 1. x = obj.member #x becomes the "si
On 9/20/2012 9:52 AM, Jure Erznožnik wrote:
I'm trying to create a class that would lie to the user that a member is in
some cases a simple variable and in other cases a class. The nature of the
member would depend on call syntax like so:
1. x = obj.member #x becomes the "simple" value containe
I'm trying to create a class that would lie to the user that a member is in
some cases a simple variable and in other cases a class. The nature of the
member would depend on call syntax like so:
1. x = obj.member #x becomes the "simple" value contained in member
2. x = obj.member.another_member #
course python' for taught courses.
> At least 2 of MIT's self-guided OpenCourseWare courses use Python.
Note this subtle distinction. A Python course will (theoretically, at
least!) teach you how to write Python code. A Python class is a
collection of methods and stuff. A trivial
On 9/6/2012 11:08 AM, Yves S. Garret wrote:
I'd like to know if there are any online Python classes offered
online from reliable institutions that you would recommend.
Google 'online programming course python' for taught courses.
At least 2 of MIT's self-guided OpenCourseWare courses use P
Ok, I have it :)
PyImport_Import , PyModule_GetDict, PyDict_GetItemString and
PyObject_CallObject
Need to take a second look at cython when I have a spare cycle or 2.
Thanks for the the tip :)
A+
Dids,
--
http://mail.python.org/mailman/listinfo/python-list
unction, I take an instance of the "demo" class and do
> my magic. It's working, all is good.
>
> What I can't figure out is how to create a second C function that
> returns a new instance to the "demo" class to python.
> There must a be tutorial so
It's working, all is good.
What I can't figure out is how to create a second C function that
returns a new instance to the "demo" class to python.
There must a be tutorial somewhere, but I can't find anything. I do
not want to define a new python class in C.
Another e
I can not open your link. Are you sure you provided the correct link?
- Gennadiy
On Fri, Mar 11, 2011 at 10:36 PM, Arthur Mc Coy <1984docmc...@gmail.com>wrote:
> Currently trying to pick up my ava
> http://en.gravatar.com/christinasanders21
> for StackOverflow, which site I found very good fo
Ok, guys. I used my bro account. Now I'm here. By the way is anybody
going to be in Paris Sunday night ?
I invite you if you would help :))) Kiss, well yet 30 minutes at work
and I'm free...
Sophie
--
http://mail.python.org/mailman/listinfo/python-list
Currently trying to pick up my ava http://en.gravatar.com/christinasanders21
for StackOverflow, which site I found very good for my questions,
didn't I?
Yes, and there are problem when adding a picture. Web admins should be
careful.
Can anyone explain me my problem ? :
Christina
--
http:/
Common guys, help me, sweet heart to finish my job and go with my
friend in the bar. Today we have a blues night :) Love it!
Christina
--
http://mail.python.org/mailman/listinfo/python-list
Hi people,
I've created very nice post here:
http://stackoverflow.com/questions/5274690/how-to-get-python-class-serializable-and-well-parsed-by-json-custom-encoder-deco
Yes, there are solutions over the internet, but nothing works for my
custom types.
If you could answer, please read it
Holden Web is pleased to announce the next run of its popular three-day
"Introduction to Python" class in Washington DC on May 11-13, 2010.
Further details of all current event listings are available from
http://holdenweb.eventbrite.com/
regards
Steve
--
Steve Holden
I am trying to access (from Java) a python class that extends a Java
interface. The following program runs fine in the jython console (I
can instantiate Tada, call t.getName() and everything prints
correctly.) However, if I invoke test1() from Java using JSR223, the
returned object is inaccessible
his CObject?
Maybe we can help you choose a better way to handle it at the C level.
I am wrapping a C++ pointer with the python object. That way I can tell with
which C++ object a given python class instance is associated.
The thing is when developing, I need to pickle but I don't nee
cator is as reliable as a custom
> type's tp_dealloc.
You are right. I did not look at the PyCObject_* API close enough.
I thought of wrapping the CObject with a Python class, and calling the
destructor from __del__. That would be less reliable.
S.M.
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 29, 11:16 am, sturlamolden wrote:
> On 29 Sep, 19:11, Carl Banks wrote:
>
> > CObjects can be passed a C function as a deallocator; this should work
> > as reliably as a custom class deallocator.
>
> Except that __del__ prevents cyclic GC.
You are mistaken on two counts.
First of all, a
On Sep 30, 5:24 am, "lallous" wrote:
> Hello
>
> After using the PyCObject, I cannot pickle the class anymore.
> Any simple solution to this problem? (or resorting to __reduce__ is the only
> solution?)
You can't pickle a CObject, you'd have to create a custom type (one
that implements one of th
Hello
After using the PyCObject, I cannot pickle the class anymore.
Any simple solution to this problem? (or resorting to __reduce__ is the only
solution?)
Thanks,
Elias
"Falcolas" wrote in message
news:9d3790aa-f7d9-4bb5-a81f-5428b2d60...@v25g2000yqk.googlegroups.com...
On Sep 29, 2:27 am
Thanks everyone.
Finally, I used Falcolas suggestion and took into consideration
sturlamolden's comments.
Regards,
Elias
"lallous" wrote in message news:h9sgcn$iv...@aioe.org...
Hello
From my C extension module I want to store a C pointer in a given
PyObject.
The only way I figure how to
On 29 Sep, 19:11, Carl Banks wrote:
> CObjects can be passed a C function as a deallocator; this should work
> as reliably as a custom class deallocator.
>
> Carl Banks
Except that __del__ prevents cyclic GC.
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 29, 9:42 am, sturlamolden wrote:
> You can use PyCObject, or write your own extension type that wraps the
> pointer (very easy to to with Cython or Pyrex). The advantage of using
> an extension type is you have a guarantee from Python on the
> deallocator method being called (cdef __dealloc
cdef __dealloc__ in Cython). If the
pointer references a resource that needs to be closed, this is safer
than using a __del__ method in a Python class.
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 29, 2:27 am, "lallous" wrote:
> Hello
>
> From my C extension module I want to store a C pointer in a given PyObject.
>
> The only way I figure how to do it is to use Py_BuildValues and store the
> poiner casted to Py_ssize_t, thus:
>
> Py_BuildValues("n", (Py_ssize_t)my_ptr)
>
> Can it be
Hello
From my C extension module I want to store a C pointer in a given PyObject.
The only way I figure how to do it is to use Py_BuildValues and store the
poiner casted to Py_ssize_t, thus:
Py_BuildValues("n", (Py_ssize_t)my_ptr)
Can it be done differently?
Regards,
Elias
--
http://ma
I would like to automatically generate this for my program. I am
running python in an eclipse context (pydev). I am not familiar with
the best current tools.
Thank you
--
http://mail.python.org/mailman/listinfo/python-list
We are looking for someone that can help with the subject class, Intro to
Python class, 7/21-23, Ft Worth TX. Please let me know if you can help.
Would need your resume and best possible daily rate.
Best regards,
Rich Drehoff
TechnoTraining, Inc.
328 Office Square Lane, Ste. 202
great, thanks for the quick responses :)
On Jun 21, 2:41 am, Carl Banks wrote:
> On Jun 20, 11:32 pm, billy wrote:
>
> > I don't quite understand why this happens. Why doesn't b have its own
> > version of r? If r was just an int instead of a dict, then it would.
>
> > >>> class foo:
>
> > ...
On Jun 20, 11:32 pm, billy wrote:
> I don't quite understand why this happens. Why doesn't b have its own
> version of r? If r was just an int instead of a dict, then it would.
>
> >>> class foo:
>
> ... r = {}
> ... def setn(self, n):
> ... self.r["f"] = n
> ...>>> a = foo()
>
On Jun 21, 2:38 pm, Vincent wrote:
> On Jun 21, 2:32 pm, billy wrote:
>
>
>
> > I don't quite understand why this happens. Why doesn't b have its own
> > version of r? If r was just an int instead of a dict, then it would.
>
> > >>> class foo:
>
> > ... r = {}
> > ... def setn(self, n):
>
On Jun 21, 2:32 pm, billy wrote:
> I don't quite understand why this happens. Why doesn't b have its own
> version of r? If r was just an int instead of a dict, then it would.
>
> >>> class foo:
>
> ... r = {}
> ... def setn(self, n):
> ... self.r["f"] = n
> ...>>> a = foo()
>
I don't quite understand why this happens. Why doesn't b have its own
version of r? If r was just an int instead of a dict, then it would.
>>> class foo:
... r = {}
... def setn(self, n):
... self.r["f"] = n
...
>>> a = foo()
>>> a.setn(4)
>>>
>>> b = foo()
>>> b.r
{'f': 4}
th
[EMAIL PROTECTED] wrote:
> >> Steve, have you been in Guido's time machine again?
>
> Steve> No, honest (hides hands behind back).
>
> Well then what's that red stuff on your face that looks like strawberry jam?
> Could it be the special grease we store next to the keys to the time
> mach
>> Steve, have you been in Guido's time machine again?
Steve> No, honest (hides hands behind back).
Well then what's that red stuff on your face that looks like strawberry jam?
Could it be the special grease we store next to the keys to the time
machine?
Skip
--
http://mail.python.org/m
Steven D'Aprano wrote:
> On Mon, 10 Nov 2008 22:14:16 -0500, Steve Holden wrote:
>
> Subject: Final Python Class of 2009
>
> Steve, have you been in Guido's time machine again?
>
:-)
>
>
No, honest (hides hands behind back).
regards
Steve
--
Steve Holden
Steve Holden wrote:
> As the year draws to a close, Holden Web is pleased to remind readers
> that its final public "Introduction to Python" class of this year will
> be held from 9-11 December at our education center close to Washington, DC.
>
> There are several ho
On Mon, 10 Nov 2008 22:14:16 -0500, Steve Holden wrote:
Subject: Final Python Class of 2009
Steve, have you been in Guido's time machine again?
--
Steven (not Steve Holden, another one)
--
http://mail.python.org/mailman/listinfo/python-list
As the year draws to a close, Holden Web is pleased to remind readers
that its final public "Introduction to Python" class of this year will
be held from 9-11 December at our education center close to Washington, DC.
There are several hotels conveniently located within walking distan
A page describing our 2009 Python class offerings has just
been posted here:
http://home.earthlink.net/~python-training/2009-public-classes.htm
The first class in 2009 will be held January 27-30 in
Colorado, and is now open for enrollments.
These are public classes, open to individuals. They
In article
<[EMAIL PROTECTED]>,
Lie <[EMAIL PROTECTED]> wrote:
> On Jun 19, 7:21 pm, Ulrich Eckhardt <[EMAIL PROTECTED]> wrote:
> > John Dann wrote:
> > > Let's say I define the class in a module called comms.py. The class
> > > isn't really going to inherit from any other class (except presumab
On Jun 19, 10:49 pm, Ulrich Eckhardt <[EMAIL PROTECTED]> wrote:
> Lie wrote:
> > I think it's not that hard to see that it's just a pseudo code
>
> "...in comms.py I have: ..." actually explicitly says that it is actual code
> from a file.
>
> *shrug*
>
> Uli
>
I'm not sure how you think saying 'i
John Dann <[EMAIL PROTECTED]> wrote:
> Yes I was wondering about that, but I wasn't clear about when 'body'
> code (ie not contained within a def block) in the module might run
> under Python. So it seemed to be safer to place the import statement
> inside the 'constructor' to get the earliest war
>
> Yes I was wondering about that, but I wasn't clear about when 'body'
> code (ie not contained within a def block) in the module might run
> under Python. So it seemed to be safer to place the import statement
> inside the 'constructor' to get the earliest warning of non-visibility
> of pyserial
Many thanks for the further comments:
On Thu, 19 Jun 2008 21:24:31 -0400, Terry Reedy <[EMAIL PROTECTED]>
wrote:
>> def __init__(self):
>> Try
>> Import serial # the pyserial library
>The import should be at module level. You only want to do it once, not
John Dann wrote:
Let's say I define the class in a module called comms.py. The class
isn't really going to inherit from any other class (except presumably
in the most primitive base-class sense, which is presumably automatic
and implicit in using the class keyword). Let's call the class
serial
Lie wrote:
> I think it's not that hard to see that it's just a pseudo code
"...in comms.py I have: ..." actually explicitly says that it is actual code
from a file.
*shrug*
Uli
--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
--
http://mail.python.org/ma
On Jun 19, 7:21 pm, Ulrich Eckhardt <[EMAIL PROTECTED]> wrote:
> John Dann wrote:
> > Let's say I define the class in a module called comms.py. The class
> > isn't really going to inherit from any other class (except presumably
> > in the most primitive base-class sense, which is presumably automat
27;object' - ie (object) - you're not just using 'object' as a
> placeholder where there should be a more specific class name or
> object?
Right. 'object' is a builtin python class, used as a base for all classes as
in many OO languages.
--
Cédric Lucantis
--
http://mail.python.org/mailman/listinfo/python-list
Many thanks for the speedy replies.
On Thu, 19 Jun 2008 14:14:02 +0200, Cédric Lucantis <[EMAIL PROTECTED]>
wrote:
>Le Thursday 19 June 2008 13:54:03 John Dann, vous avez écrit :
>> Let's say I define the class in a module called comms.py. The class
>> isn't really going to inherit from any other
John Dann wrote:
> Let's say I define the class in a module called comms.py. The class
> isn't really going to inherit from any other class (except presumably
> in the most primitive base-class sense, which is presumably automatic
> and implicit in using the class keyword). Let's call the class
> s
On Jun 19, 6:54 pm, John Dann <[EMAIL PROTECTED]> wrote:
> A Python newbie, but some basic understanding of how classes, objects
> etc work in eg VB.Net. However, I'm struggling a little to translate
> this knowledge into the Python context.
>
> I'm trying to teach myself this aspect of Python by w
Le Thursday 19 June 2008 13:54:03 John Dann, vous avez écrit :
> A Python newbie, but some basic understanding of how classes, objects
> etc work in eg VB.Net. However, I'm struggling a little to translate
> this knowledge into the Python context.
>
> Maybe I could provide some outline code as an i
A Python newbie, but some basic understanding of how classes, objects
etc work in eg VB.Net. However, I'm struggling a little to translate
this knowledge into the Python context.
I'm trying to teach myself this aspect of Python by working up a trial
project, part of which calls for pulling in data
On 4 Dec, 23:18, Rod Person <[EMAIL PROTECTED]> wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> I've been doing python programming for about 2 years as a hobby and now
> I'm finally able to use it at work in an enterprise environment. Since
> I will be creating the base classes and lib
[EMAIL PROTECTED] a écrit :
> On Dec 5, 12:18 am, Rod Person <[EMAIL PROTECTED]> wrote:
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA1
>>
>> I've been doing python programming for about 2 years as a hobby and now
>> I'm finally able to use it at work in an enterprise environment. Since
>> I wi
On Dec 5, 12:18 am, Rod Person <[EMAIL PROTECTED]> wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> I've been doing python programming for about 2 years as a hobby and now
> I'm finally able to use it at work in an enterprise environment. Since
> I will be creating the base classes and
On Dec 5, 4:18 am, Rod Person <[EMAIL PROTECTED]> wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> I've been doing python programming for about 2 years as a hobby and now
> I'm finally able to use it at work in an enterprise environment. Since
> I will be creating the base classes and l
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Tue, 04 Dec 2007 15:51:18 -0800
Gary Herron <[EMAIL PROTECTED]> wrote:
> Rod Person wrote:
> >
> > 1:
> > class Foo(object):
> > member1=''
> > member2=0
> >
> > def __init__(self,member1='',member2=0):
> > self.member1 = member1
> >
Rod Person wrote:
> I've been doing python programming for about 2 years as a hobby and now
> I'm finally able to use it at work in an enterprise environment. Since
> I will be creating the base classes and libraries I wondering which why
> is consider best when creating python classes:
>
> 1:
> cl
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
I've been doing python programming for about 2 years as a hobby and now
I'm finally able to use it at work in an enterprise environment. Since
I will be creating the base classes and libraries I wondering which why
is consider best when creating python
Chris Mellon a écrit :
> On Nov 23, 2007 1:29 AM, Roc Zhou <[EMAIL PROTECTED]> wrote:
(snip)
>>Since both "var" and "func" are the variable of the class object, and
>
> "members", not variables.
>
"attributes", not members !-)
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 23, 2007 1:29 AM, Roc Zhou <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I'm now being confused by this segment of code:
> >>> class Test:
> ... var = 1
> ... def func(self): pass
> ...
> >>> x = Test()
> >>> y = Test()
> >>> x.var is y.var
> True
> >>> x.func is y.func
> False
> >>> id(x.
On Nov 23, 2007 4:06 PM, Roc Zhou <[EMAIL PROTECTED]> wrote:
> This is the result comes from the Linux.
>
> And the result from Windows is:
>
> >>> class Test:
> var = 1
> def func(self): pass
> >>> x = Test()
> >>> y = Test()
> >>> x.var is y.var
> True
> >>> x.func is y.func
> False
> >>>
This is the result comes from the Linux.
And the result from Windows is:
>>> class Test:
var = 1
def func(self): pass
>>> x = Test()
>>> y = Test()
>>> x.var is y.var
True
>>> x.func is y.func
False
>>> id(x.var)
11228488
>>> id(y.var)
11228488
>>> id(x.func)
14430976
>>> id(y.func)
144336
Hello,
I'm now being confused by this segment of code:
>>> class Test:
... var = 1
... def func(self): pass
...
>>> x = Test()
>>> y = Test()
>>> x.var is y.var
True
>>> x.func is y.func
False
>>> id(x.var); id(y.var)
146132400
146132400
>>> id(x.func); id(y.func)
-1208243388
-1208243388
On Oct 30, 2007 5:52 AM, Fuzzyman <[EMAIL PROTECTED]> wrote:
> On Oct 29, 11:35 pm, Steven Bethard <[EMAIL PROTECTED]> wrote:
> > Fuzzyman wrote:
> > > On Oct 22, 6:43 pm, Steven Bethard <[EMAIL PROTECTED]> wrote:
> > >> # Inherit from object. There's no reason to create old-style classes.
> >
> >
On Oct 29, 11:35 pm, Steven Bethard <[EMAIL PROTECTED]> wrote:
> Fuzzyman wrote:
> > On Oct 22, 6:43 pm, Steven Bethard <[EMAIL PROTECTED]> wrote:
> >> # Inherit from object. There's no reason to create old-style classes.
>
> > We recently had to change an object pipeline from new style classes to
Fuzzyman <[EMAIL PROTECTED]> writes:
> We recently had to change an object pipeline from new style classes
> to old style. A lot of these objects were being created and the
> *extra overhead* of new style classes was killing us. :-)
Can you please expand on this? What extra overhead of new-style
1 - 100 of 202 matches
Mail list logo