Python equivalent for C module

Derek Martin code at pizzashack.org
Tue Oct 21 00:30:32 EDT 2008


On Mon, Oct 20, 2008 at 10:43:55PM +0000, Steven D'Aprano wrote:
> All of this is just splitting hairs, 

Indeed... :)

> because you don't really mean Python is making a copy of the name
> 'DEBUG', but of the *data* that DEBUG refers to, namely the object
> True. 

Well, as long as we're having semantic discussions...  If you reread
my post, it should be clear that what you wrote above can not possibly
be the case.  If you recall, my intent was to make a copy of a means
of accessing the value known by the name "DEBUG" contained in the
debug module, which could be accessed from any module in the program.
Clearly the data itself *must not* be a copy, or else what I was
trying to do would never have worked.  What I was refering to as a
copy was in fact essentially the name, or more accurately (as regards
my conception of purpose) a reference to the data.

> > The *object* very much is: it is immutable.
> 
> So what? The *name* DEBUG is not read-only.

You may have missed where I explained that the name refers to two
different things, and that I, speaking in loose terms, was refering to
both things simultaneously but in different contexts.  I was speaking
loosely -- I was using "read-only" as a figure of speech of sorts, and
elaborated *correctly* what actually happens.   Again, if you reread
my original post with that explanation in mind, I think you'll find
that this is the only sensible interpretation for what I wrote.

> Actually it is a very common convention in Python circles. I often use it 
> myself. However it's not the only one, and from time to time I use 
> others. I would consider using DEBUG unusual, but not excessively so.

To be honest, same here.  My post contained throw-away C code that I
typed up on the fly, and the same goes for the Python -- I simply
translated the C code literally, so to speak.  As has been pointed out
in a different thread (by Bruno himself, if I'm not mistaken), the
code hastily posted here need not represent the code that one would
write in "real" programs.  But I find it offensive that certain people
here can't resist lambasting some posters who have simple questions,
because the code they posted isn't up to their particular favorite
coding "standards" (i.e. conventions), and I will speak out about it,
especially when it's done to me.  I didn't ask about coding
conventions, but Bruno's response was roughly 75% about how my code
sucks, and maybe 25% about answering my question.  And what part did
answer my question was completely redundant.  It was roughly 95% a
waste of time and energy for both him and me, though I did learn about
the logging module...
 
> Deary deary me... you come along here, asking noob Python questions, and 
> then get shirty when people give you friendly and perfectly good answers. 

Well, we disagree that the answer Bruno provided was either friendly
or perfectly good.  I did receive perfectly good answers, and if you
read the whole thread, you saw me accept such answers graciously.
Bruno's answer smacked of a superiority and arrogance that is not
uncommon among certain frequent posters.  He has no idea what my
program does, or what my real code looks like, but apparently deigns
himself the Code Police, and finds it necessary to punnish people for
posting code which does not conform to his idea of Programming Law.  

I can't deny that I should have been able to answer my own question
with only a few more moments thought...  Though I don't think it's
quite right to characterize questions about scope as "noob" questions.
I suspect actual noobs don't yet know enough to ask such questions.

> Are you trying to ensure that the next question you ask remains 
> unanswered?

Not at all, just trying to preempt the pound of attitude that often
goes with the ounce of answers.  But if the choice is between no
answer, and an answer that barely manages to avoid calling me an idiot
(especially over coding style), I'd rather have no answer.

-- 
Derek D. Martin
http://www.pizzashack.org/
GPG Key ID: 0x81CFE75D

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20081021/d8069573/attachment-0001.sig>


More information about the Python-list mailing list