namespace dictionaries ok?

D

Duncan Booth

James said:
Were it not for Steve Holden's providing me with a link off the list,
I would have never known to what it is you are referring. I have read
some relevant literature to find that this is more widely known as
"top-posting". I'll go with majority rules here, but I would like to
say that my lack of "netiquette" in this matter comes from
practicality and not malice.

No, I didn't think it was malice which is why I just added what I
considered to be a polite request at the end of my message. I assumed that
most people either knew the phrase or could find out in a few seconds using
Google so there wasn't much point in rehashing the arguments. Probably I
should have equally lambasted Ron for the heinous crime of bottom-quoting.

In general, there are three ways to quote a message: top-quoting, which
forces people to read the message out of order; bottom-quoting which is
nearly as bad because it hides the new comments; and proper quoting in
context where you trim the message and put specific points under brief bits
of context.

The thread in question had a horrific mix of top and bottom quoting, so
that when I tried to reply at what I thought was an appropriate point in
quote from James (4) comment from Ron (5)

I spent a while trying to trim that down to relevant context, and in
particular trying to work out in what order the original statements had
been made. In the end I gave up and replied to an earlier message which was
more easily trimmable.
Also, here is a well written synopsis of the arguments in
favor of top-posting and they may even be strong enough to legitimize the
practice:

The arguments are mostly sound, but I would draw slightly different
conclusions:

Follow the conventions of the particular newsgroup or mailing list, but
with that in mind, for all replies, Middle Post. Respond to each point in
turn with lots of snipping.

He's right though, its not a religious issue.
 
I

Iain King

Duncan said:
No, I didn't think it was malice which is why I just added what I
considered to be a polite request at the end of my message. I assumed that
most people either knew the phrase or could find out in a few seconds using
Google so there wasn't much point in rehashing the arguments. Probably I
should have equally lambasted Ron for the heinous crime of bottom-quoting.

In general, there are three ways to quote a message: top-quoting, which
forces people to read the message out of order; bottom-quoting which is
nearly as bad because it hides the new comments; and proper quoting in
context where you trim the message and put specific points under brief bits
of context.

Just to continue this off-topic argument :) -

I've never heard the terms top-quoting, bottom-quoting. I've heard
top-posting and bottom-posting before (lots). But regardless of
however many people use top-quoting and bottom-quoting, surely you're
using them the wrong way around? If I top-post, then that means that
the quote is at the bottom, no?

To quote someone's sig block:
"To top-post is human, to bottom-post and snip is sublime."

Iain
 
R

Ron Adam

Duncan said:
No, I didn't think it was malice which is why I just added what I
considered to be a polite request at the end of my message. I assumed that
most people either knew the phrase or could find out in a few seconds using
Google so there wasn't much point in rehashing the arguments. Probably I
should have equally lambasted Ron for the heinous crime of bottom-quoting.

I usually try to keep things in reasonable context and or order. I tend
to bottom quote only when either the message is short enough to fit on a
single page, or when I'm adding new content that isn't a direct response
to an individual item but builds on the above ideas. Sometimes deciding
what to trim out of various really good replies is difficult. ;-)

In any case, I don't take offense to any suggested improvements. I
wouldn't be surprised if many of my posts were considered hard to follow
at times. A chronic sleeping disorder combined with dyslexia can
sometimes make expressing my thoughts in words rather challenging on
some (most) days.

comment from Ron (5)


I spent a while trying to trim that down to relevant context, and in
particular trying to work out in what order the original statements had
been made. In the end I gave up and replied to an earlier message which was
more easily trimmable.

I was undecided weather to trim the later (earlier) responses or not,
but decided to leave them in.

>
The arguments are mostly sound, but I would draw slightly different
conclusions:

Follow the conventions of the particular newsgroup or mailing list, but
with that in mind, for all replies, Middle Post. Respond to each point in
turn with lots of snipping.

In general I find a well written top post in a friarly prompt *email* to
be fine. What I refer to as well written in this case, is where the
author restates the question, points, or issues in their own word first,
and then follow that up with their response and or conclusions.
Especially if it's any sort of official or at least non casual
interchange. In that case the quotes appended to the end serves as
history that can be referenced if needed.

But in news groups, it's best to try and keep things conversational with
as you call middle posts. It allows people to add to the conversation
as if they were all present at the same time, even though they may
actually be replying at varying different times. I tend to try not to
break up paragraphs if possible though, and attempt to break my posts up
into short paragraphs to leave spaces for others to insert their
replies. But I wouldn't claim I'm completely consistent on these issues
myself.

> He's right though, its not a religious issue.

Yep, I agree with this also. ;-)

Cheers,
Ron
 
A

Alex Martelli

Ron Adam said:
class namespace(dict):
def __getattr__(self, name):
return self.__getitem__(name) ...
Any thoughts? Any better way to do this?

If any of the keys (which become attributes through this trick) is named
'update', 'keys', 'get' (and so on), you're toast; it really looks like
a nasty, hard-to-find bug just waiting to happen. If you're really
adamant on going this perilous way, you might try overriding
__getattribute__ rather than __getattr__ (the latter is called only when
an attribute is not found "in the normal way").

If you think about it, you're asking for incompatible things: by saying
that a namespace X IS-A dict, you imply that X.update (&c) is a bound
method of X; at the same time, you also want X.update to mean just the
same thing as X['update']. Something's gotta give...!-)


Alex
 
G

Grant Edwards

No, I didn't think it was malice which is why I just added what I
considered to be a polite request at the end of my message. I assumed that
most people either knew the phrase or could find out in a few seconds using
Google so there wasn't much point in rehashing the arguments. Probably I
should have equally lambasted Ron for the heinous crime of bottom-quoting.

In general, there are three ways to quote a message: top-quoting, which
forces people to read the message out of order;

Uh, no. Isn't what we're doing here top-quoting? The quoted
stuff is at the top. Everything is in chronological order. I
think what you're referring to is "top-posting".
 
D

Duncan Booth

Grant said:
Uh, no. Isn't what we're doing here top-quoting? The quoted
stuff is at the top. Everything is in chronological order. I
think what you're referring to is "top-posting".

Yes, Iain King already pointed this out.
 
R

Ron Adam

Alex said:
If any of the keys (which become attributes through this trick) is named
'update', 'keys', 'get' (and so on), you're toast; it really looks like
a nasty, hard-to-find bug just waiting to happen. If you're really
adamant on going this perilous way, you might try overriding
__getattribute__ rather than __getattr__ (the latter is called only when
an attribute is not found "in the normal way").

Thanks Alex, I was wondering what the difference between __getattr__ and
__getattribute__ was.

If you think about it, you're asking for incompatible things: by saying
that a namespace X IS-A dict, you imply that X.update (&c) is a bound
method of X; at the same time, you also want X.update to mean just the
same thing as X['update']. Something's gotta give...!-)

Alex

Part of the motivation of this is to try and keep names as names and
data as data in my programs. I would use dictionaries for data storage,
and namespace_dicts for strictly name/value passing. So some
limitations with names are expected just as they would exist anywhere
else with object names. Ie.. can't use keywords, and using names of
methods can cause objects to break, etc...

This seems to be the closest to a generic namespace object so far.

class namespace(dict):
__getattribute__ = dict.__getitem__
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__

Not having any public and/or visible methods of it's own is a good thing
here. So you would need to use dict.update(A_namespace, A_dict) in this
case. I don't think thats a problem. Maybe a namespace object, (as I
am thinking of it), should not have it's own interface, but inherit one
from the object it's inserted into?

Anyway... this is experimental, and not production code of any sort. ;-)

Cheers,
Ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,269
Messages
2,571,338
Members
48,026
Latest member
DannieKeeg

Latest Threads

Top