Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
self.__dict__ tricks
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  22 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Tim Johnson  
View profile  
 More options Oct 30, 1:16 pm
Newsgroups: comp.lang.python
From: Tim Johnson <t...@johnsons-web.com>
Date: Thu, 29 Oct 2009 21:16:37 -0500
Local: Fri, Oct 30 2009 1:16 pm
Subject: self.__dict__ tricks
This is not a request for help but a request for comments:
Consider the following code and note that
1)The initializer uses the dictionary style of arguments
2)The check loop executes before all of the class variables
  are declared
## --------------------------------------------------------------------
class formLoader():
        def __init__(self,**kw):
                self.fileName = None
                self.record = None
                self.string = None
                ## Uncomment below to see that only fileName, record and string
                ## are recorded by __dict__
                #std.debug("self.__dict__",self.__dict__)
                for k in kw.keys():
                        if k in self.__dict__:
                                self.__dict__[k] = kw[k]
                        else:
                                raise AttributeError("%s is not a class member. Use one of ('%s')"
                                                   % (repr(k),"', '".join(self.__dict__.keys())))
                self.tokens = ["form","input","textarea","select","option","form"]
                self.inputTypes = ["button","checkbox","file","hidden","image","password",
                                   "radio","reset","submit","text"]
                self.inputValTypes = ["file","hidden","password","text"]                                                  
                self.colnames = []      ## case-insensitive column names
                self.formIndexes = []   ## Index forms in outer list
## .....
## --------------------------------------------------------------------
Now if I were to code something like the following:
fml = formLoader(fileName=doc,tokens="tim")
## Note that `tokens' is passed as a named argument.
I get the following error message:
AttributeError: 'tokens' is not a class member. Use one of ('record',
'string', 'fileName')

I am not complaining! This is a good thing and a cool idiom.
Placing the the check loop after _only_ the keywords that I wanted to
allow _disallows_ any others.
I'd welcome comments - such as any other applications.

Always a newbie ....
--
Tim
t...@johnsons-web.com
http://www.akwebsoft.com


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steven D'Aprano  
View profile  
 More options Oct 30, 3:23 pm
Newsgroups: comp.lang.python
From: Steven D'Aprano <st...@REMOVE-THIS-cybersource.com.au>
Date: 30 Oct 2009 04:23:03 GMT
Local: Fri, Oct 30 2009 3:23 pm
Subject: Re: self.__dict__ tricks

On Thu, 29 Oct 2009 21:16:37 -0500, Tim Johnson wrote:
> This is not a request for help but a request for comments: Consider the
> following code and note that 1)The initializer uses the dictionary style
> of arguments 2)The check loop executes before all of the class variables
>   are declared

Could you explain what problem you are trying to solve?

> class formLoader():

Idiomatic Python is to use CamelCase for classes.

>    def __init__(self,**kw):
>            self.fileName = None
>            self.record = None
>            self.string = None
>            ## Uncomment below to see that only fileName, record
>               ## and string are recorded by __dict__
>            #std.debug("self.__dict__",self.__dict__)
>               for k in kw.keys():

In recent versions of Python, this is best written as

for k in kw:

>                    if k in self.__dict__:
>                            self.__dict__[k] = kw[k]

Is your intention to ensure that the only keyword arguments allowed are
fileName, record and string?

Perhaps the easiest way to do that is:

for k in kw:
    if k not in ('filename', 'record', 'string'):
        raise Exception()  # whatever...
    setattr(self, k) = kw[k]

>                    else:
>                            raise AttributeError(

In my opinion, AttributeError is not appropriate here. Passing an invalid
parameter shouldn't raise the same error as failing an attribute look-up.
That's misleading and confusing.

>                               "%s is not a class member. Use one of ('%
>                               s')" % (repr(k),"', '".join
>                               (self.__dict__.keys())))

[Aside: eight space tabs are *WAY* too big for Usenet and email. You
should use four spaces, or even two, when posting here.]

It is idiomatic Python to use "instance attributes" to refer to
attributes attached to instances, and "class attributes" to refer to
those attached to classes. Talking about "class members" will confuse
Python developers who aren't also familiar with Java or C++. (I know it
confuses *me* -- are class members shared by all instances in a class, as
the name implies, or are they individual to the instance, as your code
implies?)

I also should point out that your trick will fail if you are using
__slots__.

>            self.tokens =

["form","input","textarea","select","option","form"]

>            self.inputTypes =
>            ["button","checkbox","file","hidden","image","password",
>                               "radio","reset","submit","text"]
>            self.inputValTypes = ["file","hidden","password","text"]
> self.colnames
>            = []      ## case-insensitive column names
> self.formIndexes = []   ##
>            Index forms in outer list

Is any of that relevant to the trick you are asking for comments for? If
not, why is it here?

> I'd welcome comments - such as any other applications.

Personally, I don't like it. The method signature makes it impossible to
tell what arguments are excepted, and it forces me to use keywords even
if I'd prefer to use positional arguments. I prefer to let the
interpreter check the arguments for me:

class FormLoader():
    def __init__(self, fileName=None, record=None, string=None):
        self.fileName = fileName
        self.record = record
        self.string = string

That's all it takes, and you get the benefit of a method signature that
makes it obvious what arguments it takes.

--
Steven


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Finney  
View profile  
 More options Oct 30, 3:55 pm
Newsgroups: comp.lang.python
From: Ben Finney <ben+pyt...@benfinney.id.au>
Date: Fri, 30 Oct 2009 15:55:04 +1100
Local: Fri, Oct 30 2009 3:55 pm
Subject: Re: self.__dict__ tricks

Steven D'Aprano <st...@REMOVE-THIS-cybersource.com.au> writes:
> On Thu, 29 Oct 2009 21:16:37 -0500, Tim Johnson wrote:
> > class formLoader():

> Idiomatic Python is to use CamelCase for classes.

Or rather: Instead of camelCase names, idiomatic Python is to use
TitleCase names.

--
 \     “We are not gonna be great; we are not gonna be amazing; we are |
  `\           gonna be *amazingly* amazing!” —Zaphod Beeblebrox, _The |
_o__)                Hitch-Hiker's Guide To The Galaxy_, Douglas Adams |
Ben Finney


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Finney  
View profile  
 More options Oct 30, 4:00 pm
Newsgroups: comp.lang.python
From: Ben Finney <ben+pyt...@benfinney.id.au>
Date: Fri, 30 Oct 2009 16:00:10 +1100
Local: Fri, Oct 30 2009 4:00 pm
Subject: Re: self.__dict__ tricks

Ben Finney <ben+pyt...@benfinney.id.au> writes:
> Steven D'Aprano <st...@REMOVE-THIS-cybersource.com.au> writes:

> > On Thu, 29 Oct 2009 21:16:37 -0500, Tim Johnson wrote:
> > > class formLoader():

> > Idiomatic Python is to use CamelCase for classes.

> Or rather: Instead of camelCase names, idiomatic Python is to use
> TitleCase names.

Blah, my attempt at clarity just made it more confusing.

Instead of camelCase names, idiomatic Python is to use TitleCase names
for classes.

--
 \         “Pinky, are you pondering what I'm pondering?” “I think so, |
  `\         Brain, but how will we get a pair of Abe Vigoda's pants?” |
_o__)                                           —_Pinky and The Brain_ |
Ben Finney


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steven D'Aprano  
View profile  
 More options Oct 30, 6:13 pm
Newsgroups: comp.lang.python
From: Steven D'Aprano <st...@REMOVE-THIS-cybersource.com.au>
Date: 30 Oct 2009 07:13:08 GMT
Local: Fri, Oct 30 2009 6:13 pm
Subject: Re: self.__dict__ tricks

On Fri, 30 Oct 2009 15:55:04 +1100, Ben Finney wrote:
> Steven D'Aprano <st...@REMOVE-THIS-cybersource.com.au> writes:

>> On Thu, 29 Oct 2009 21:16:37 -0500, Tim Johnson wrote:
>> > class formLoader():

>> Idiomatic Python is to use CamelCase for classes.

> Or rather: Instead of camelCase names, idiomatic Python is to use
> TitleCase names.

Thank you for the correction. I always mix up those two.

--
Steven


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
MRAB  
View profile  
 More options Oct 31, 2:28 am
Newsgroups: comp.lang.python
From: MRAB <pyt...@mrabarnett.plus.com>
Date: Fri, 30 Oct 2009 15:28:47 +0000
Local: Sat, Oct 31 2009 2:28 am
Subject: Re: self.__dict__ tricks
Steven D'Aprano wrote:
> On Fri, 30 Oct 2009 15:55:04 +1100, Ben Finney wrote:

>> Steven D'Aprano <st...@REMOVE-THIS-cybersource.com.au> writes:

>>> On Thu, 29 Oct 2009 21:16:37 -0500, Tim Johnson wrote:
>>>> class formLoader():
>>> Idiomatic Python is to use CamelCase for classes.
>> Or rather: Instead of camelCase names, idiomatic Python is to use
>> TitleCase names.

> Thank you for the correction. I always mix up those two.

Wouldn't it be clearer if they were called dromedaryCase and
BactrianCase? :-)

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Golden  
View profile  
 More options Oct 31, 2:43 am
Newsgroups: comp.lang.python
From: Tim Golden <m...@timgolden.me.uk>
Date: Fri, 30 Oct 2009 15:43:17 +0000
Local: Sat, Oct 31 2009 2:43 am
Subject: Re: self.__dict__ tricks

MRAB wrote:
> Steven D'Aprano wrote:
>> On Fri, 30 Oct 2009 15:55:04 +1100, Ben Finney wrote:

>>> Steven D'Aprano <st...@REMOVE-THIS-cybersource.com.au> writes:

>>>> On Thu, 29 Oct 2009 21:16:37 -0500, Tim Johnson wrote:
>>>>> class formLoader():
>>>> Idiomatic Python is to use CamelCase for classes.
>>> Or rather: Instead of camelCase names, idiomatic Python is to use
>>> TitleCase names.
>> Thank you for the correction. I always mix up those two.

> Wouldn't it be clearer if they were called dromedaryCase and
> BactrianCase? :-)

It's not often I really get a laugh out of this
mailing list, but that really made me chuckle.

Thanks :)

TJG


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Johnson  
View profile  
 More options Oct 31, 3:16 am
Newsgroups: comp.lang.python
From: Tim Johnson <t...@johnsons-web.com>
Date: Fri, 30 Oct 2009 11:16:29 -0500
Local: Sat, Oct 31 2009 3:16 am
Subject: Re: self.__dict__ tricks
On 2009-10-30, Steven D'Aprano <st...@REMOVE-THIS-cybersource.com.au> wrote:

> Could you explain what problem you are trying to solve?

>> class formLoader():

  Hi Steve
  In a nutshell:
  The 'problem' is to parse a form in such a way that tags which are to
  be modified are represented as dictionaries. The 'grunt' work is
  done.  This class will probably grow with time.

> Idiomatic Python is to use CamelCase for classes.

  Can you point me to a discussion on Idiomatic Python, CamelCase and
  other matters?

> Is your intention to ensure that the only keyword arguments allowed are
> fileName, record and string?

 Correct.

> Perhaps the easiest way to do that is:

> for k in kw:
>     if k not in ('filename', 'record', 'string'):
>         raise Exception()  # whatever...
>     setattr(self, k) = kw[k]

  Understood. A better 'trick'

>>                        else:
>>                                raise AttributeError(

> In my opinion, AttributeError is not appropriate here. Passing an invalid
> parameter shouldn't raise the same error as failing an attribute look-up.
> That's misleading and confusing.

  What error class or other approach do you recommend?

> [Aside: eight space tabs are *WAY* too big for Usenet and email. You
> should use four spaces, or even two, when posting here.]

  Yikes! I just starting using vim with slrn again. Will take care of
  that.

> It is idiomatic Python to use "instance attributes" to refer to
> attributes attached to instances, and "class attributes" to refer to
> those attached to classes. Talking about "class members" will confuse
> Python developers who aren't also familiar with Java or C++. (I know it
> confuses *me* -- are class members shared by all instances in a class, as
> the name implies, or are they individual to the instance, as your code
> implies?)

 Thanks for that. C++ corrupted me.

> I also should point out that your trick will fail if you are using
> __slots__.

  ??. Will research that. Elaborate if you wish.

>>                self.tokens =
> ["form","input","textarea","select","option","form"]
<....>

> Is any of that relevant to the trick you are asking for comments for? If
> not, why is it here?

 It was there to illustrate my edification of the usage of self.__dict__

>> I'd welcome comments - such as any other applications.

> Personally, I don't like it. The method signature makes it impossible to
> tell what arguments are excepted, and it forces me to use keywords even
> if I'd prefer to use positional arguments. I prefer to let the
> interpreter check the arguments for me:

  Using your tuple example would clarify things. The method signature
  then becomes the tuple. I.E

  #<steve sayeth>    
  if k not in ('filename', 'record', 'string'):
       # handle here

  If the class grows - and I expect it will - I'd prefer to stick with
  the keywords approach. That approach also allows me to use a
  dictionary to initialize the object.

  Thanks for the input. Very helpful.
  - and always a newbie -
--
Tim
t...@johnsons-web.com
http://www.akwebsoft.com


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steven D'Aprano  
View profile  
 More options Oct 31, 1:37 pm
Newsgroups: comp.lang.python
From: Steven D'Aprano <st...@REMOVE-THIS-cybersource.com.au>
Date: 31 Oct 2009 02:37:10 GMT
Local: Sat, Oct 31 2009 1:37 pm
Subject: Re: self.__dict__ tricks

On Fri, 30 Oct 2009 11:16:29 -0500, Tim Johnson wrote:
> On 2009-10-30, Steven D'Aprano <st...@REMOVE-THIS-cybersource.com.au>
> wrote:

>> Could you explain what problem you are trying to solve?

>>> class formLoader():

>   Hi Steve
>   In a nutshell:
>   The 'problem' is to parse a form in such a way that tags which are to
>   be modified are represented as dictionaries. The 'grunt' work is done.
>    This class will probably grow with time.

The standard way of doing this is to list the arguments as parameters,
together with their defaults:

def __init__(self, filename=None, record=None, string=None):
    ...

Then Python will do the error checking for your, and raise an exception
if the caller passes an unexpected argument. Can you explain why this
isn't enough for your needs, and you need to do something else?

>> Idiomatic Python is to use CamelCase for classes.
>   Can you point me to a discussion on Idiomatic Python, CamelCase and
>   other matters?

See PEP 8:

http://www.python.org/dev/peps/pep-0008/

>> In my opinion, AttributeError is not appropriate here. Passing an
>> invalid parameter shouldn't raise the same error as failing an
>> attribute look-up. That's misleading and confusing.

> What error class or other approach do you recommend?

Unless you have a good reason for doing something different, do what
Python built-ins do:

>>> int('123', parrot=16)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'parrot' is an invalid keyword argument for this function

>> I also should point out that your trick will fail if you are using
>> __slots__.
>   ??. Will research that. Elaborate if you wish.

__slots__ are an optimization for making objects smaller than normal if
you have many millions of them:

http://docs.python.org/reference/datamodel.html#slots

>   If the class grows - and I expect it will - I'd prefer to stick with
>   the keywords approach. That approach also allows me to use a
>   dictionary to initialize the object.

You can still do that with named parameters.

>>> class Parrot:

...     def __init__(self, name='Polly', colour='blue',
...     breed='Norwegian'):
...         self.name = name
...         self.colour = colour
...         self.breed = breed
...     def speak(self):
...         print "%s the %s %s says 'Give us a kiss!'" % (
...         self.name, self.colour, self.breed)
...
>>> p = Parrot("Sparky", 'white', "Cockatoo")
>>> p.speak()

Sparky the white Cockatoo says 'Give us a kiss!'

>>> data = dict(colour='red', name='Fred', foo=1)
>>> p = Parrot(**data)  # raise an error with bad input

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() got an unexpected keyword argument 'foo'

>>> del data['foo']  # fix the bad input
>>> p = Parrot(**data)
>>> p.speak()

Fred the red Norwegian says 'Give us a kiss!'

--
Steven


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hendrik van Rooyen  
View profile  
 More options Oct 31, 7:08 pm
Newsgroups: comp.lang.python
From: Hendrik van Rooyen <hend...@microcorp.co.za>
Date: Sat, 31 Oct 2009 10:08:06 +0200
Local: Sat, Oct 31 2009 7:08 pm
Subject: Re: self.__dict__ tricks
On Friday, 30 October 2009 17:28:47 MRAB wrote:

> Wouldn't it be clearer if they were called dromedaryCase and
> BactrianCase? :-)

Ogden Nash:

The Camel has a single hump-
The Dromedary, two;
Or the other way around-
I'm never sure. - Are You?

- Hendrik


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Johnson  
View profile  
 More options Nov 1, 3:15 am
Newsgroups: comp.lang.python
From: Tim Johnson <t...@johnsons-web.com>
Date: Sat, 31 Oct 2009 11:15:48 -0500
Local: Sun, Nov 1 2009 3:15 am
Subject: Re: self.__dict__ tricks
On 2009-10-31, Steven D'Aprano <st...@REMOVE-THIS-cybersource.com.au> wrote:

 Understood. I kyped that method from from an open source library module
 and have been using it ever since.

>>> I also should point out that your trick will fail if you are using
>>> __slots__.
>>   ??. Will research that. Elaborate if you wish.

> __slots__ are an optimization for making objects smaller than normal if
> you have many millions of them:

> http://docs.python.org/reference/datamodel.html#slots

  Thanks.
<....>

<...> OK. That makes sense. You have made a believer of me.

I really appreciate all the time you have taken with this.
Many programmers I know stay away from 'lists' such as this, because
they are afraid to show their ignorance. Me, I'm fearless, and I have
learned a lot that I might not have otherwise.

take care
--
Tim
t...@johnsons-web.com
http://www.akwebsoft.com


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
MRAB  
View profile  
 More options Nov 1, 4:24 am
Newsgroups: comp.lang.python
From: MRAB <pyt...@mrabarnett.plus.com>
Date: Sat, 31 Oct 2009 17:24:58 +0000
Local: Sun, Nov 1 2009 4:24 am
Subject: Re: self.__dict__ tricks
Hendrik van Rooyen wrote:
> On Friday, 30 October 2009 17:28:47 MRAB wrote:

>> Wouldn't it be clearer if they were called dromedaryCase and
>> BactrianCase? :-)

> Ogden Nash:

> The Camel has a single hump-
> The Dromedary, two;
> Or the other way around-
> I'm never sure. - Are You?

If you make the first letter a capital:

     Dromedary starts with "D", 1 bump, 1 hump.

     Bactrian starts with "B", 2 bumps, 2 humps.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steven D'Aprano  
View profile  
 More options Nov 1, 4:35 pm
Newsgroups: comp.lang.python
From: Steven D'Aprano <st...@REMOVE-THIS-cybersource.com.au>
Date: 01 Nov 2009 05:35:26 GMT
Local: Sun, Nov 1 2009 4:35 pm
Subject: Re: self.__dict__ tricks

On Sat, 31 Oct 2009 11:15:48 -0500, Tim Johnson wrote:
> Many programmers I know stay away from 'lists' such as this, because
> they are afraid to show their ignorance. Me, I'm fearless, and I have
> learned a lot that I might not have otherwise.

The only stupid question is the one you are afraid to ask.

Good luck!

--
Steven


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Aahz  
View profile  
 More options Nov 3, 3:54 pm
Newsgroups: comp.lang.python
From: a...@pythoncraft.com (Aahz)
Date: 2 Nov 2009 20:54:08 -0800
Local: Tues, Nov 3 2009 3:54 pm
Subject: Re: self.__dict__ tricks
In article <02fd0c85$0$1326$c3e8...@news.astraweb.com>,
Steven D'Aprano  <st...@REMOVE-THIS-cybersource.com.au> wrote:

>On Sat, 31 Oct 2009 11:15:48 -0500, Tim Johnson wrote:

>> Many programmers I know stay away from 'lists' such as this, because
>> they are afraid to show their ignorance. Me, I'm fearless, and I have
>> learned a lot that I might not have otherwise.

>The only stupid question is the one you are afraid to ask.

"There are no stupid questions, only stupid people."
--
Aahz (a...@pythoncraft.com)           <*>         http://www.pythoncraft.com/

[on old computer technologies and programmers]  "Fancy tail fins on a
brand new '59 Cadillac didn't mean throwing out a whole generation of
mechanics who started with model As."  --Andrew Dalke


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Finney  
View profile  
 More options Nov 3, 4:13 pm
Newsgroups: comp.lang.python
From: Ben Finney <ben+pyt...@benfinney.id.au>
Date: Tue, 03 Nov 2009 16:13:08 +1100
Local: Tues, Nov 3 2009 4:13 pm
Subject: Re: self.__dict__ tricks

a...@pythoncraft.com (Aahz) writes:
> "There are no stupid questions, only stupid people."

The earliest source I know for that aphorism is the fictional teacher
Mister Garrisson, from South Park. Can anyone source it earlier?

--
 \        “Read not to contradict and confute, nor to believe and take |
  `\          for granted … but to weigh and consider.” —Francis Bacon |
_o__)                                                                  |
Ben Finney


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Simon Brunning  
View profile  
 More options Nov 3, 10:26 pm
Newsgroups: comp.lang.python
From: Simon Brunning <si...@brunningonline.net>
Date: Tue, 3 Nov 2009 11:26:49 +0000
Local: Tues, Nov 3 2009 10:26 pm
Subject: Re: self.__dict__ tricks
2009/11/1 Steven D'Aprano <st...@remove-this-cybersource.com.au>:

> The only stupid question is the one you are afraid to ask.

I was once asked, and I quote exactly, "are there any fish in the Atlantic sea?"

That's pretty stupid. ;-)

--
Cheers,
Simon B.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ethan Furman  
View profile  
 More options Nov 4, 4:59 am
Newsgroups: comp.lang.python
From: Ethan Furman <et...@stoneleaf.us>
Date: Tue, 03 Nov 2009 09:59:32 -0800
Local: Wed, Nov 4 2009 4:59 am
Subject: Re: self.__dict__ tricks

Simon Brunning wrote:
> 2009/11/1 Steven D'Aprano <st...@remove-this-cybersource.com.au>:

>>The only stupid question is the one you are afraid to ask.

> I was once asked, and I quote exactly, "are there any fish in the Atlantic sea?"

> That's pretty stupid. ;-)

Are there any fish in the Dead Sea?

~Ethan~


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rami Chowdhury  
View profile  
 More options Nov 4, 6:54 am
Newsgroups: comp.lang.python
From: "Rami Chowdhury" <rami.chowdh...@gmail.com>
Date: Tue, 03 Nov 2009 11:54:44 -0800
Local: Wed, Nov 4 2009 6:54 am
Subject: Re: self.__dict__ tricks
On Tue, 03 Nov 2009 09:59:32 -0800, Ethan Furman <et...@stoneleaf.us>  
wrote:

> Simon Brunning wrote:
>> 2009/11/1 Steven D'Aprano <st...@remove-this-cybersource.com.au>:

>>> The only stupid question is the one you are afraid to ask.
>>   I was once asked, and I quote exactly, "are there any fish in the  
>> Atlantic sea?"
>>  That's pretty stupid. ;-)

> Are there any fish in the Dead Sea?

Depends on how you define fish, surely ;-)?

--
Rami Chowdhury
"Never attribute to malice that which can be attributed to stupidity" --  
Hanlon's Razor
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steven D'Aprano  
View profile  
 More options Nov 4, 1:25 pm
Newsgroups: comp.lang.python
From: Steven D'Aprano <ste...@REMOVE.THIS.cybersource.com.au>
Date: 04 Nov 2009 02:25:06 GMT
Local: Wed, Nov 4 2009 1:25 pm
Subject: Re: self.__dict__ tricks

On Tue, 03 Nov 2009 11:26:49 +0000, Simon Brunning wrote:
> 2009/11/1 Steven D'Aprano <st...@remove-this-cybersource.com.au>:

>> The only stupid question is the one you are afraid to ask.

> I was once asked, and I quote exactly, "are there any fish in the
> Atlantic sea?"

> That's pretty stupid. ;-)

Once in the distant past, there were no fish in what would become the
Atlantic Ocean (not sea); and some day in the future there won't be any
fish either. At the rate we're going that day may not be that far away:
fish are being over-fished all over the world, jellyfish are blooming,
and there are areas of the Namibian continental where the dominant
species have flipped from fish to jellyfish:

http://www.scienceinafrica.co.za/2009/september/jellyfish.htm
http://www.sciencedaily.com/releases/2006/07/060711091411.htm
http://www.sciencedaily.com/releases/2009/06/090609092057.htm

So, no, not a stupid question at all.

--
Steven


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Finney  
View profile  
 More options Nov 4, 1:59 pm
Newsgroups: comp.lang.python
From: Ben Finney <ben+pyt...@benfinney.id.au>
Date: Wed, 04 Nov 2009 13:59:03 +1100
Local: Wed, Nov 4 2009 1:59 pm
Subject: Re: self.__dict__ tricks

Simon Brunning <si...@brunningonline.net> writes:
> 2009/11/1 Steven D'Aprano <st...@remove-this-cybersource.com.au>:

> > The only stupid question is the one you are afraid to ask.

> I was once asked, and I quote exactly, "are there any fish in the
> Atlantic sea?"

> That's pretty stupid. ;-)

Not at all. The person asking the question might be ignorant of the
facts about fishing, or the Atlantic, or marine ecosystems in that
region, etc., in which case the question is smart and wise and to the
point.

Especially compared with the alternative: not asking the question
perpetuates the ignorance.

--
 \     “If I had known what it would be like to have it all... I might |
  `\     have been willing to settle for less.” —Jane Wagner, via Lily |
_o__)                                                           Tomlin |
Ben Finney


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ethan Furman  
View profile  
 More options Nov 5, 1:36 am
Newsgroups: comp.lang.python
From: Ethan Furman <et...@stoneleaf.us>
Date: Wed, 04 Nov 2009 06:36:46 -0800
Local: Thurs, Nov 5 2009 1:36 am
Subject: Re: self.__dict__ tricks
Dennis Lee Bieber wrote:

 > Perfectly valid answer -- there are no fish as there is no
 > Atlantic sea <G>

Steven D'Aprano wrote:

 > Once in the distant past, there were no fish in what would become the
 > Atlantic Ocean (not sea)

What's with the bias against the word 'sea'?

sea
–noun
1.   the salt waters that cover the greater part of the earth's surface.
2.   a division of these waters, of considerable extent, more or less
definitely marked off by land boundaries: the North Sea.
3.   one of the seven seas; ocean.

I'd say the Atlantic qualifies!  ;-)

~Ethan~


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steven D'Aprano  
View profile  
 More options Nov 5, 10:50 am
Newsgroups: comp.lang.python
From: Steven D'Aprano <ste...@REMOVE.THIS.cybersource.com.au>
Date: 04 Nov 2009 23:50:49 GMT
Local: Thurs, Nov 5 2009 10:50 am
Subject: Re: self.__dict__ tricks

On Wed, 04 Nov 2009 06:36:46 -0800, Ethan Furman wrote:
> Dennis Lee Bieber wrote:
>  > Perfectly valid answer -- there are no fish as there is no Atlantic
>  > sea <G>

> Steven D'Aprano wrote:
>  > Once in the distant past, there were no fish in what would become the
>  > Atlantic Ocean (not sea)

> What's with the bias against the word 'sea'?

The Atlantic Ocean is named the Atlantic Ocean, not the Atlantic Lake or
Atlantic Puddle or Atlantic Dewdrop or Atlantic Sea.

Otherwise, sea is a perfectly good word, for describing what the Atlantic
Ocean *is* rather than what it is *named*.

--
Steven


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google