property() usage - is this as good as it gets?

castironpi castironpi at gmail.com
Mon Aug 25 01:49:52 EDT 2008


On Aug 24, 10:41 pm, alex23 <wuwe... at gmail.com> wrote:
> On Aug 25, 12:42 pm, castironpi <castiro... at gmail.com> wrote:
>
> > I'm baffled.  I don't understand what you write.  
>
> Which is pretty much how I feel about -all- of your posts.

Alright.  You're articulate.  I'm getting a better picture of what
your problem with me is.  What we have is a misunderstanding, *not a
war*.  If you think I leave the grounds of civil argument, be sure to
say so.  Otherwise, I'll expect observation, premise, conclusion.
Just like a good A.I. would.  (Computers are good at something, and
that's logic.)

> > I think someone in
> > my shoes would be justified in dismissing it as either malicious or a
> > miscommunication.  
>
> No, it's frustration at the sharp decrease in signal:noise that this
> newsgroup has undertaken since your arrival.

You also want to assign causality and/or blame as a result.  The
evidence is circumstantial.  I'm sorry you're frustrated.  If I've had
a negative influence, which is hard to prove, that would mean that I'm
influential (in the bad way).  I'm not sure I can accept that at this
point in my life.  It's a problem.  But I also feel that I've been
plonked without hearing me out, which only escalates the frustration.
(Google search castironpi+plonk.  Ha.)

> But how about this, your code snippet from this very thread,
> your -first- of two seemingly independent replies to the original
> post:
>
> >  def _getbalance( self ):
> >    return self._tree.geti(
> >      self.where+ self.lookup[ 'balance' ] )
>
> >  def _getparent( self ):
> >    return self._tree.getI(
> >      self.where+ self.lookup[ 'parent' ] )
>
> > Where 'balance' and 'parent' could both come from something generic:
>
> > balance= property( tree_lookup( 'balance' ) )
> > parent= property( tree_lookup( 'parent' ) )
>
> In your 'example', you reference one marked-as-implementation
> attribute, two unspecified attributes, one unspecified method and one
> unspecified function. That you refer to one function as both 'geti'
> and 'getI' leads me to believe this -isn't- workable code and you've
> just re-keyed this in without testing.

It is from real code.  If you want the link say so.  It's an in-place
memory manager that I think is quite nifty... *and* functional.  *And*
pure Python.

Others earlier proposed similar things; mine was just more
specialized.

Miles:
    x = defaultproperty('_x')
    y = defaultproperty('_y')

Medardo:
    x = property(*attrmanager('_x'))
    y = property(*attrmanager('_y'))

I see a similarity between theirs and mine, but you only criticize
mine.  Do you agree that mine was similar?

If I would have said, "Where 'balance' and 'parent' both share
something generic", instead of "could both come from something
generic", would that have made more sense?  That would definitely be
my fault.  Word choice is definitely a weakness and I am not perfect.

> I've also -no- idea what you're trying to demonstrate here. It's not
> clear nor obvious, and I can't see how your _getwhatever methods tie
> in with the property definition.

My point was, "Here's one snippet you could clear up with some
abstraction."  It answers the OP's question directly:

"It works well enough, but I can't help feeling there a cleaner more
readable way of doing this (with less duplication, etc).  Is this as
good as it gets?"

But I did not organize my post well, so I can see your confusion.

> > For instance, "I won't like it if you do" and "I won't think it's
> > clever if you do" aren't consistent belief structures, they're fight
> > structures.  You have made such claims.
>
> No, what I've stated is I've yet to see -any- code samples that you've
> provided be of any real, clear use to -anyone-. This isn't a 'fight
> structure', this is an opinion formed by the overwhelming amount of
> evidence you keep contributing to this group.

I'm lost.  Do you want to see some clever code, even if I wrote it,
and even if I think it is clever too?  I am wanting a code review.

> > In the post above, I make two claims, ask two questions, and encourage
> > a brainstorm.  I don't see how what you say applies to it.
>
> What you said was: "When brainstorming, don't restrict yourself to
> Python syntax-- make
> something up, and we'll write Python."
>
> What I'm contesting is your ability to write Python.
>
> Furthermore, people -aren't- posting questions to the "castironpi
> hour", they're asking questions to help further their understanding of
> Python, not to give you further opportunity to emphasise your
> misunderstanding of it. Suggesting they 'brainstorm' without any
> understanding of the language itself and that you'll somehow magically
> generate Python code for them is, based on what you've written here,
> laughable.

No, and this is not my editorial, blog, or advice column, no matter
how much I write.  Brainstorming is healthy and productive.  The OP
was looking for a way to improve something he'd written and was
already working.  I was urging him to think outside the box, then get
help getting back "in to the box," metaphorically.  This is different
than inviting someone to brainstorm who is asking for help with the
'range' function, you know.  Python makes a lot of things possible
that other languages don't, and I don't believe that anyone knows the
extent of that.

> > I am willing to change the way I communicate.  I want to communicate
> > effectively.  But, until someone takes something I want to say, and
> > says it the right way, I can't learn how.  So I wait and write Python,
> > and share my frustration with my peers.
>
> Given how many people have publicly killfiled you on this group, I'm
> not sure who you consider to be your 'peers'. There was a -lot- of
> initial frustration at your post, along with even more dismissal of it
> as the output of a poorly written AI experiment.

YES, no kidding.  I'm amazed myself, but I just chalk it up to my
being new on Usenet and bad with people.  I'll work on it but Rome
wasn't built in a day.  My peer is someone who is bad at
communicating.  How am I supposed to establish communication with him
or her?

> You're -failing- the Turing test. If that isn't telling you something
> is wrong with your communication style, I don't really know what will.

I am aware, thanks to the group, that something is wrong.  But I don't
know what it is.

> Assumed by someone...
[snip, ok?]

> Which leads me to reiterate my original statement, only framing it now
> as a question: what -real world- applications or systems have you
> worked on...in -any- language? I find it difficult to believe you've
> ever worked on any, or even more pointedly, had to work on -someone
> else's real world code-. Because the sample code fragments you post,
> when not broken, at best seem to relate to pointless wankery on your
> behalf, without any practical application whatsoever, and at worst
> carry deep-seated misunderstandings about how Python works.

Most of my programming is either academic research, academic study, or
hobbyist.  If you're asking if I have any experience, yes I do.  If
you're asking whether I've been forced to write awful code under
someone else's deadline, no I haven't.  That's important.  I don't
know what trait that gives my code, maybe abstractness, but no my
experience is not typical.  And the academic research wasn't for the
business colleges either.  If you want my credentials, e-mail me.  I
went to a 4-year Research 1, but I believe that people's work should
speak for itself.

My offer stands to show you my code.  Probably not my resume or work
history though.  Fair?

Lastly, if I spend too much time on the newsgroup (300 in February,
wow), that is, on this one newsgroup, it's important to bring that to
my attention.  That is not something that anyone can judge for
themselves.  (A famous philosopher contends that friends are the
harshest critics.)  It is Ok to have that opinion and it's ok if you
notice it; that doesn't automatically mean you do too.  I could use a
kick in the rear to branch out, and perhaps diversify my time.  I
think I would find it most productive to point-blank say so.



More information about the Python-list mailing list