Suggested coding style

A

alex23

rantingrick:
"""Since, like the bible the zen is self contradicting, any argument
utilizing
the zen can be defeated utilizing the zen."""

alex23:
"""And like the Bible, the Zen was created by humans as a joke. If you're
taking it too seriously, that's your problem."""

Strangely, calling the bible self-contradictory wasn't seen as
inflammatory...

Seeing the quotes again, I'm pretty sure I was intending to be
flippant _in reference to rantrantrantrick's comment_. Given that it
was a response to someone else referring to the bible _and_ it made a
point about the zen, I'm not entirely sure why my comment was OT.

Again, if you want to disagree with my remark, knock yourself out. If
you want to take it as a personal attack, then there's nothing I can
do to stop you. But do realise that it is _you_ who is interpreting it
as such, and then recall the provision your very own Christ stated
about judging the actions of others: within your own belief system
_it's not your right to do so_.

That never seems to reduce the moral outrage though...
 
S

Steven D'Aprano

Devin said:
I also didn't reprimand anyone, except maybe Steven.

If you are more upset at my describing the Catholic Church as protecting
child molesters than you are at the Church for actually protecting child
molesters, then your priorities are completely screwed up and your
reprimand means less than nothing to me. I wear it as a badge of honour.
 
S

Steven D'Aprano

Chris said:
I don't think he meant that the populace here is exclusively
programmers, but that *on this list* we are here because we're
programmers. We may happen to have coincidental interest in (say)
music, but just because some group of us (or even all of us) all enjoy
music does not mean that it'd be on-topic to have a discussion of the
tetrachord of Mercury.

I didn't say it would be on-topic. But we don't cease to be well-rounded
human beings with concerns beyond the narrow world of Python programming
just because we are writing on a programming forum.
 
C

Chris Angelico

Are you off your medication again?

He's very much like jimontrack (aka Tranzit Jim - google him if you're
curious), whose username people frequently referred to with the t
replaced with a c. Everyone thought he lived in April 1st.

ChrisA
 
A

alex23

Chris Angelico said:
We may happen to have coincidental interest in (say)
music, but just because some group of us (or even all of us) all enjoy
music does not mean that it'd be on-topic to have a discussion of the
tetrachord of Mercury.

As general discussion it would be, sure, but I don't think there's
anything that can be readily dismissed as 'not relevant' in terms of
providing abstract concepts to programmers. I've tried explaining
encapsulation to non-programmers using Reason's hardware rack
metaphor. I'm slowly seeing more and more interest in applying
hermeneutics to computer science, a discipline that arose out of the
study of religious texts.

We don't always know what we don't know. For that alone, I'd rather we
were more inclusive of topics of discussion than exclusionary.
 
A

alex23

Dennis Lee Bieber said:
        Well... We could try for equality in offense -- the Torahor the
Koran? Maybe the Tripitaka or Sutras?

I always enjoyed the possibly apocryphal claim that the design of VRML
was influenced by the story of Indra's Net. Maybe some religious tomes
are just better? :)
 
I

Ian Kelly

Ah ha! Found the answer!

py> "{0:010d}".format(1234)
0000001234

py> "{0:0>10}".format(1234)
0000001234

py> "{0:0>10}".format("1234")
0000001234

py> "{0:mad:>10}".format("1234")
@@@@@@1234

I would skip using the "{int}{repeat}d" syntax and just use the string
padding since you won't need to worry about the input data type. I
hate specificity types in string formats. With the old interpolation i
ALWAYS used %s for everything.

Nope, that doesn't work.
'00000-1234'

The whole point of zfill is that it handles signs correctly.
 
I

Ian Kelly

It's interesting that you find the format specifier "complicated". I
will admit that upon first glance i lamented the new format method
spec and attempted to cling to the old string interpolation crap.
However, as you use the new format method you will come to appreciate
it. It's an adult beverage with an acquired taste. ;-)

I find it interesting that a self-proclaimed API expert like yourself
suggests that it isn't complicated. The documentation on the format
specifiers is around 6 1/2 printed pages long, and that's not even
including the docs for the string.Formatter API. Devin is right,
though, in that a better word for it would be "dense".

"Complicated" is not a bad thing here, because with that complexity
comes expressiveness. It just means that care needs to be taken when
adding new options to ensure that they integrate well with the
existing syntax.
One thing that may help format noobs is to look at the spec as two
parts; the part before the colon and the part after the colon. If you
break it down in this manner the meaning starts to shine through. I
will agree, it is a lot of cryptic info squeezed into a small space
HOWEVER you would no want a verbose format specification.

What makes you think I'm a "format noob"? The details may have
evolved over the years, but the format specifiers are fundamentally
still the same old printf syntax that we've all been using for
decades.
 
A

alex23

Please don't make personal attacks. If you don't feel like addressing
the content of his message, don't switch to implying he has a mental
illness.

Fair enough. It was intended more as a ludicrous accusation to his
ridiculous claim. Lord knows there's enough in his posts to focus on
without the ad hominems :)
 
A

alex23

Tell us more, please.

Well, it's mostly from real world discussions and may actually be an
artefact of my holding degrees in both philosophy & computer
science :) But googling "hermeneutics computer science" does bring up
a heap of entries, although the highest ranked is from 1979, so I may
have oversold the idea of it being a growing interest.

Amazon also shows that there have been a number of publications
dealing with this:
http://www.amazon.com/s?ie=UTF8&keywords=Hermeneutics.&rh=n:3508,k:Hermeneutics.

For me, the main aspect of hermeneutics that could apply here - to
programming especially - is the concept that reading a text informs
you for subsequently reinterpreting the text (the "hermeneutic circle"
of Heidegger). No philosophical notion of truth is needed to explain
this, I see much in common with iterative development processes.
Multiplicity of perspective is similarly important in interpretation:
again, computer systems are developed with many user roles and thus
many 'views' of what is happening.

In the interest of fair play, if anyone still smarting at my flippancy
wants to take a swing at my belief system, it's mostly cobbled
together from Nietzsche, Wittgenstein & Crowley. Personal email
preferably, let's keep it off the list unless its particularly witty :)
 
W

Westley Martínez

Yeah. It's a much more difficult to read thing, but once you learn how
to write it it flows faster.

Of course, I never managed to learn how to write it...

I would suggest that rather than being "complicated" it is "dense".
I'm one of the weirdos who is absolutely hostile to the format method
and continues to use % formatting. I'm pretty sure it is because of my
C background (actually I learned Python before C, and thus learned %
formatting in Python). However, I'm not so opposed to it that I've not
learned it. It is quite "dense", almost feels like something in a
scripting language like Perl. Indeed, I did try it for some time, but
it was just too "heavy" and slow for me. Well someday I'll probably be
forced to use it, but for anyone else who agrees with me, always know
there's at least one Python programmer out there with some (or no)
sense.
 
C

Chris Angelico

I'm one of the weirdos who is absolutely hostile to the format method
and continues to use % formatting.  I'm pretty sure it is because of my
C background (actually I learned Python before C, and thus learned %
formatting in Python).

I quite like printf-style formatting. It's well known, well defined,
and compact. When I write C++ programs, I often still use
printf/sprintf extensively - it just "feels nicer" than iostream (and
the main downside of printf, the lack of argument checking, is largely
solved in recent gcc). So when I work with Python, it makes sense to
use the same thing there. Dense syntax results in easy-to-read format
strings, imho.

ChrisA
 
R

rusi

But anyway, no, we don't agree on what it means to be friendly or what
a hostile atmosphere is. I've noticed that people tend to be a lot
harsher here than what I'm used to, so perhaps your attitude to it is
more common on mailing-lists and I should just adapt.

A Mulla Nasruddin story comes to mind:
The judge in a village court had gone on vacation. Nasrudin was asked
to be temporary judge for a day. Mulla sat on the Judge's chair and
ordered the first case to be brought up for hearing.

"You are right," said Nasrudin after carefully hearing one side.
"You are right," he said after carefully hearing the other side.
"But both cannot be right!" said the court clerk bewildered.
After profound thought said the Mulla:

"You are right"
 
C

Chris Angelico

"You are right," said Nasrudin after carefully hearing one side.
"You are right," he said after carefully hearing the other side.
"But both cannot be right!" said the court clerk bewildered.
After profound thought said the Mulla:

 "You are right"

And I am right, and you are right, and all is right as right can be!
-- Pish-Tush, a Japanese nobleman in service of /The Mikado/

Chris Angelico
 
N

Neil Cerutti

And I am right, and you are right, and all is right as right can be!
-- Pish-Tush, a Japanese nobleman in service of /The Mikado/

Never has being right, proper and correct been so thoroughly
celebrated. Except perhaps when my C++ program compiles without
warnings. That's pretty good, too.
 
D

Devin Jeanpierre

If you are more upset at my describing the Catholic Church as protecting
child molesters than you are at the Church for actually protecting child
molesters

I'm not, and your rhetoric is ridiculous.

Devin
 
R

rantingrick

Note: I am quoting "Passiday" to get this thread back on subject
however my reply is for "alex23" the philosopher"

Try coding in PHP across minor release versions and see how you feel
about deprecating core functions on a whim.

I never said we should remove it now, i said we should deprecate it
now.
In a well declared _break_ with backwards compatibility. Not on a whim
between minor releases.

Please Google deprecate.
Because while you say "some very obscure code", what you really mean
is "code that isn't mine".

Well "alex" i can't see a mob approaching with pitchforks because we
deprecate a misplaced and rarely used functionality of the stdlib.
As you have no access
to the inner states of _any_ of the people you regularly condemn here
with your hypocritical attacks, I've no idea why you consider yourself
to be an expert on their desires and opinions.

Well "alex", like yourself, i hold expertise in many fields BESIDES
programming. One of which being psychology.
 
D

DevPlayer

from attitude import humour

Funny. url link to gif. Funny. Youtube video. Funny.

True Pythonees do not speak in English they speak in Python.

Shame, this discussion will be sent to the Pearly gates or the Flaming
Iron Bars in 5 days. Well, not so much a shame.
 

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

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,072
Latest member
trafficcone

Latest Threads

Top