On 6/12/05, Steve Jorgensen <[EMAIL PROTECTED]> wrote:
> Oops - I thought I cancelled that post when I relized I was saying nothing,
Would that everyone cancelled their posts when they realised that they
weren't saying anything. ;-)
--
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonlin
On Tue, 14 Jun 2005 06:40:51 +0200, Terry Hancock wrote
(in article <[EMAIL PROTECTED]>):
> I find the biggest problem coming to Python from a language
> like C, C++, or Java is that you overthink things and try to
> do them the hard way. A lot of times, you find out that the
> "Python way" to do
On Monday 13 June 2005 03:50 pm, Kalle Anke wrote:
> On Mon, 13 Jun 2005 20:41:48 +0200, Terry Hancock wrote
> (in article <[EMAIL PROTECTED]>):
>
> > 1) Assume the variables are of a sensible type (not
> > necessarily the one you expected, though), and provide
> > exception handling to catch the
Kalle Anke <[EMAIL PROTECTED]> writes:
> On Mon, 13 Jun 2005 20:41:48 +0200, Terry Hancock wrote
> (in article <[EMAIL PROTECTED]>):
>
>> 1) Assume the variables are of a sensible type (not
>> necessarily the one you expected, though), and provide
>> exception handling to catch the case where the
On Mon, 13 Jun 2005 20:41:48 +0200, Terry Hancock wrote
(in article <[EMAIL PROTECTED]>):
> 1) Assume the variables are of a sensible type (not
> necessarily the one you expected, though), and provide
> exception handling to catch the case where their interface
> does not match what you expect.
I really think the problem is that you are trying to use
techniques whose only reason for existing is that they make
up for deficiencies in other languages:
For example, the *reason* for the Java or C++ use of get/set
methods is to allow for the future possibility of needing to
make those operat
Hello!
> You can 'hide' you getsetters using a property attribute[1]:
For me, the property attribute is a beast:
class A(object):
def getP(self): return 'A'
p = property(getP)
class A2(A):
def getP(self): return 'A2'
a = A()
a2 = A2()
print a.getP(), a2.getP()
print a.p,
Peter Dembinski wrote:
> Chris Spencer <[EMAIL PROTECTED]> writes:
>
>
>>Peter Dembinski wrote:
>>
>>Of course, in that Python is dynamically typed as opposed to the
>>static typing of Java or C++. Please excuse my previous mis-wording :)
>
>
> Mis-wording?
I previously said Python was "untype
Chris Spencer <[EMAIL PROTECTED]> writes:
> Peter Dembinski wrote:
>> Bruno Desthuilliers <[EMAIL PROTECTED]> writes:
>>
>>> Nope. Python *is* typed. But it doesnt confuse implementation with
>>> semantic.
>> Python is typed. And its type system may look strange for anyone
>> who did only Java or
Peter Dembinski wrote:
> Bruno Desthuilliers <[EMAIL PROTECTED]> writes:
>
>>Nope. Python *is* typed. But it doesnt confuse implementation
>>with semantic.
>
>
> Python is typed. And its type system may look strange for anyone who
> did only Java or C++ programming before :>
Of course, in tha
Bruno Desthuilliers wrote:
> Chris Spencer a écrit :
>
>> I was providing the original poster with a simple way to ensure
>> appropriate type.
>
>
> s/appropriate type/specific implementation/
>
> Hint : the appropriate type for print >> XXX is "whatever has a
> 'write(anything_that_can_be_co
Chris Spencer a écrit :
> Bruno Desthuilliers wrote:
>
>> And *this* is highly unpythonic. And un-OO too, since it makes foo()
>> dependant on *class* Bar, when it should most probably be enough that
>> it only depends on (probably part of) the *interface* of class Bar.
>
> I was providing the
Bruno Desthuilliers <[EMAIL PROTECTED]> writes:
[snap]
>> Being an untyped language, Python does not require you to enforce
>> types.
>
> Nope. Python *is* typed. But it doesnt confuse implementation
> with semantic.
Python is typed. And its type system may look strange for anyone who
did only
Bruno Desthuilliers wrote:
> And *this* is highly unpythonic. And un-OO too, since it makes foo()
> dependant on *class* Bar, when it should most probably be enough that it
> only depends on (probably part of) the *interface* of class Bar.
I was providing the original poster with a simple way t
Chris Spencer a écrit :
> Kalle Anke wrote:
>
>> On Sun, 12 Jun 2005 13:59:27 +0200, deelan wrote
>> (in article <[EMAIL PROTECTED]>):
>>
>> void doSomething( data : SomeClass ){ ... }
>>
>> and I would be sure at compile time that I would only get SomeClass
>> objects as parameters into the meth
"vincent wehren" <[EMAIL PROTECTED]> writes:
> "Peter Dembinski" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> news:[EMAIL PROTECTED]
> | Kalle Anke <[EMAIL PROTECTED]> writes:
> |
> | [snap]
> |
> | >> sys.maxint = -12345
> | >
> | > I don't really understand what you're meaning.
> |
> | He meant
On Sun, 12 Jun 2005 15:35:46 +0200, Kalle Anke wrote:
> Anyway, I got another "problem" (read: being used to do it like this in other
> languages). I'm used to use statically typed languages and for me one of the
> advantages is that I can be sure that a parameter is of a certain type. So in
>
"Peter Dembinski" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
| Kalle Anke <[EMAIL PROTECTED]> writes:
|
| [snap]
|
| >> sys.maxint = -12345
| >
| > I don't really understand what you're meaning.
|
| He meant None = 1 :>
I'm sure you know that has become a no-no in Python 2
Kalle Anke <[EMAIL PROTECTED]> writes:
[snap]
>> sys.maxint = -12345
>
> I don't really understand what you're meaning.
He meant None = 1 :>
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 12 Jun 2005 14:40:26 +, Chris Spencer wrote:
> Being an untyped language, Python does not require you to enforce types.
> However, for those that require such functionality, you can get away
> with using the "assert" statement.
Assuming that Python isn't executed with the optimize s
Kalle Anke wrote:
> On Sun, 12 Jun 2005 13:59:27 +0200, deelan wrote
> (in article <[EMAIL PROTECTED]>):
>
> void doSomething( data : SomeClass ){ ... }
>
> and I would be sure at compile time that I would only get SomeClass objects
> as parameters into the method.
Being an untyped language, Py
"alex23" wrote:
> Kalle Anke wrote:
> > I'm coming to Python from other programming languages. I like to
> > hide all attributes of a class and to only provide access to them
> > via methods.
>
> I'm pretty fond of this format for setting up class properties:
>
> class Klass(object):
> def pro
On Sun, 12 Jun 2005 15:35:46 +0200,
Kalle Anke <[EMAIL PROTECTED]> wrote:
> In learning Python I've understood that I should write code in such a
> way that it can handle different data and this is fine with me. But
> what if I have a class where different attributes should only have
> values of a
On Sun, 12 Jun 2005 15:35:15 +0200, John Machin wrote
(in article <[EMAIL PROTECTED]>):
> OTOH, I beseech you to consider an attitude transplant :-)
;-)
> I.e. put your effort into writing code that allows people to do useful
> things, rather than opaque guff full of __blahblah__ that stops the
Kalle Anke wrote:
> On Sun, 12 Jun 2005 12:20:29 +0200, tiissa wrote
> (in article <[EMAIL PROTECTED]>):
>
>
>
>>You can 'hide' you getsetters using a property attribute[1]:
>>
>>[1]http://docs.python.org/lib/built-in-funcs.html
>
>
> Thanks, this is exactly what I was looking for
>
>
OTOH,
On Sun, 12 Jun 2005 13:59:27 +0200, deelan wrote
(in article <[EMAIL PROTECTED]>):
> the pythonic way is to use "property" (as others have already explained)
> only when is *stricly necessary*. this may clarify things up:
Thanks for the link (although Java was only one of the languages I was
thi
On Sun, 12 Jun 2005 12:20:29 +0200, tiissa wrote
(in article <[EMAIL PROTECTED]>):
> You can 'hide' you getsetters using a property attribute[1]:
>
> [1]http://docs.python.org/lib/built-in-funcs.html
Thanks, this is exactly what I was looking for
--
http://mail.python.org/mailman/listinfo/py
Kalle Anke wrote:
> I'm coming to Python from other programming languages. I like to
> hide all attributes of a class and to only provide access to them
> via methods.
(...)
> Is this the "Pythonic" way of doing it or should I do it in a different
> way or do I have to use setX/getX (shudder)
the
Kalle Anke wrote:
> I'm coming to Python from other programming languages. I like to
> hide all attributes of a class and to only provide access to them
> via methods.
I'm pretty fond of this format for setting up class properties:
class Klass(object):
def propname():
def
On Sun, 12 Jun 2005 03:15:27 -0700, Steve Jorgensen <[EMAIL PROTECTED]>
wrote:
...
>>Is this the "Pythonic" way of doing it or should I do it in a different
>>way or do I have to use setX/getX (shudder)
>
>I'm totally new to Python myself, but my understanding is that
...
Oops - I thought I cance
Kalle Anke wrote:
> I'm coming to Python from other programming languages. I like to
> hide all attributes of a class and to only provide access to them
> via methods. Some of these languages allows me to write something
> similar to this
>
> int age( )
> {
> return theAge
> }
>
> void age( x :
On Sun, 12 Jun 2005 11:54:52 +0200, Kalle Anke <[EMAIL PROTECTED]> wrote:
>I'm coming to Python from other programming languages. I like to
>hide all attributes of a class and to only provide access to them
>via methods. Some of these languages allows me to write something
>similar to this
>
>int
I'm coming to Python from other programming languages. I like to
hide all attributes of a class and to only provide access to them
via methods. Some of these languages allows me to write something
similar to this
int age( )
{
return theAge
}
void age( x : int )
{
theAge = x
}
(I usually do m
33 matches
Mail list logo