On Wed, Aug 6, 2014 at 1:37 AM, Neil D. Cerutti wrote:
> In simple cases like that, functions could do very well by including a
> little bundle of data (probably a dict) as one of the parameters for each
> related function.
And this is exactly how object orientation is done in C. You just have
a
On 8/4/2014 6:44 PM, John Gordon wrote:
In Shubham Tomar
writes:
classes. I understand that you define classes to have re-usable methods and
procedures, but, don't functions serve the same purpose.
Can someone please explain the idea of classes
If a function simply accepts some data, does
Shubham Tomar writes:
> Python is the first programming language that I'm learning.
> I'm confused by the idea of classes and intimidated by syntax defining
> classes. I understand that you define classes to have re-usable methods and
> procedures, but, don't functions serve the same purpose.
As
On 8/4/2014 6:44 PM, John Gordon wrote:
__init__() is the initializer method, which is called as one step of
creating a class object.
In fact, it is the last step and usually is the main step for
user-defined classes, and the only step one need be concerned with.
Object is the lowest-level
In Shubham Tomar
writes:
> classes. I understand that you define classes to have re-usable methods and
> procedures, but, don't functions serve the same purpose.
> Can someone please explain the idea of classes
If a function simply accepts some data, does some calculations on that
data and th
On 8/4/2014 4:40 AM, Shubham Tomar wrote:
Hi,
Python is the first programming language that I'm learning.
I'm confused by the idea of classes and intimidated by syntax defining
classes. I understand that you define classes to have re-usable methods
and procedures, but, don't functions serve the
On 20 November 2013 12:57, Steven D'Aprano
wrote:
> On Wed, 20 Nov 2013 10:32:08 +1000, alex23 wrote:
>>
>> They appear to be resurrecting a 12 year old thread.
>
> Wow, that's one slow News server.
http://en.wikipedia.org/wiki/Slow_Movement
:)
--
https://mail.python.org/mailman/listinfo/python
On Wed, 20 Nov 2013 10:32:08 +1000, alex23 wrote:
> On 20/11/2013 12:12 AM, Chris Angelico wrote:
>> On Wed, Nov 20, 2013 at 12:50 AM, Annmarina Nagy
>> wrote:
>>> the command label gets "stuck"
>>
>> A bit of context would help hugely. Are you replying to someone else's
>> post? All we have is a
On 20/11/2013 12:12 AM, Chris Angelico wrote:
On Wed, Nov 20, 2013 at 12:50 AM, Annmarina Nagy wrote:
the command label gets "stuck"
A bit of context would help hugely. Are you replying to someone else's
post? All we have is a subject line.
They appear to be resurrecting a 12 year old threa
On Wed, Nov 20, 2013 at 12:50 AM, Annmarina Nagy wrote:
> the command label gets "stuck"
A bit of context would help hugely. Are you replying to someone else's
post? All we have is a subject line.
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
the command label gets "stuck"
--
https://mail.python.org/mailman/listinfo/python-list
Many thanks to all who responded to my "Python Classes: Simplify?" thread.
There seem to be several good reasons for this particular syntactical
choice, I am all the wiser for your kind explanations. My faith in the
simplicity and elegance of this beautiful language is reinforced.
Thanks all!
--
Steven Lehar wrote:
It seems to me that the Python class system is needlessly confusing.
Am I missing something?
For example in the class Complex given in the documentation
*class Complex:*
*def __init__(self, realpart, imagpart):*
*self.r = realpart*
*self.i = imagpart*
*
The issue of explicitly naming a "self" parameter has been discussed in
depth on a number of occasions. I recommend a google search for "python
implicit self" for some of the reasons why it exists. Here's what Guido
has to say about it:
http://neopythonic.blogspot.com/2008/10/why-explicit-self-h
On 03/22/2012 10:51 AM, Steven Lehar wrote:
It seems to me that the Python class system is needlessly confusing.
Am I missing something?
For example in the class Complex given in the documentation
*class Complex:*
*def __init__(self, realpart, imagpart):*
*self.r = realpart*
*
On Thu, Mar 22, 2012 at 3:51 AM, Steven Lehar wrote:
> It seems to me that the Python class system is needlessly confusing. Am I
> missing something?
Explicit `self` is slightly annoying, but you'll get over it quickly (trust me).
> For example in the class Complex given in the documentation
>
>
On Thu, Mar 22, 2012 at 9:51 PM, Steven Lehar wrote:
> It seems to me that the Python class system is needlessly confusing. Am I
> missing something?
>
> For example in the class Complex given in the documentation
>
> class Complex:
> def __init__(self, realpart, imagpart):
> self.r =
Ok thanks I'll try remembering it.
On 8/28/07, Erik Jones <[EMAIL PROTECTED]> wrote:
>
> On Aug 28, 2007, at 12:04 AM, Lamonte Harris wrote:
>
> > How come you have to set the initialized created variables to equal
> > the parameters, shouldn't that be default?
> >
> > class testing:
> >
On Aug 28, 2007, at 12:04 AM, Lamonte Harris wrote:
> How come you have to set the initialized created variables to equal
> the parameters, shouldn't that be default?
>
> class testing:
> def __init__(self,testing):
>self.testing = testing
> x = testing("testing")
>
[EMAIL PROTECTED] wrote:
> James Stroud wrote:
>
>>[EMAIL PROTECTED] wrote:
>>
>>>I have a text file that I am parsing. Each line is of the form:
>>>
>>>max_time 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12
>>>
>>>The first item is the field name and the next twelve items are valu
James Stroud wrote:
> [EMAIL PROTECTED] wrote:
> > I have a text file that I am parsing. Each line is of the form:
> >
> > max_time 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12
> >
> > The first item is the field name and the next twelve items are values
> > for each month in the y
[EMAIL PROTECTED] wrote:
> I have a text file that I am parsing. Each line is of the form:
>
> max_time 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12
>
> The first item is the field name and the next twelve items are values
> for each month in the year. There are multiple lines eac
[EMAIL PROTECTED] wrote:
> I have a text file that I am parsing. Each line is of the form:
>
> max_time 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12
>
> The first item is the field name and the next twelve items are values
> for each month in the year. There are multiple lines e
Cegep du Vieux Montreal (technical college level), uses Python for CGI
in web developement class.
...At least when I give this course ;-)
Jean-Marc
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> anyone know of any college/school that is teaching the python language?
>
Bordeaux University (France) uses Python in a "programming 101" course.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.sp
Yeha, sure. The Royal Institute of Technology in Stockholm, Sweden
teaches Python for some of its introductory programming and algorithm
courses.
--
http://mail.python.org/mailman/listinfo/python-list
On Thursday 21 April 2005 08:48 am, codecraig wrote:
> widget = gui.MyCustomWidget.MyCustomWidge()
>
> ...seems weird, how should I structure this? Is it not common to have
> one class in a .py?
No, it isn't really. Usually, there will be several related classes in a single
module. Only if the
codecraig wrote:
also is it common to have one class per file?
seems weird to have, MyCustomWidget.MyCustomWidget
thanks
Well, this *is* fairly normal, but you can manage the namespace to your
advantage if you wish. So, for example, gui/__init__.py could do
from CustomWidget import CustomWidg
codecraig wrote:
Thanks, but I am not familiar with the "__all__" variable, could u give
me an example?
Without using, __all__would i do this in my __init__.py?
import MyCustomWidget1
import MyCustomWidget2
import MyCustomWidget3
etc?
Yes, correct. __all__ just limits the names that are importe
also is it common to have one class per file?
seems weird to have, MyCustomWidget.MyCustomWidget
thanks
--
http://mail.python.org/mailman/listinfo/python-list
Thanks, but I am not familiar with the "__all__" variable, could u give
me an example?
Without using, __all__would i do this in my __init__.py?
import MyCustomWidget1
import MyCustomWidget2
import MyCustomWidget3
etc?
--
http://mail.python.org/mailman/listinfo/python-list
codecraig wrote:
What is the best/common way to structure ur python code for an
application?
For example...if I create some custom GUI widgets I have this
C:\stuff
--> gui
--: MyCustomWidget.py
--: TestWidgets.py
so MyCustomWidget.py has one class, class MyCustomWidget: ...
so from
32 matches
Mail list logo