;(bar)' from the identifier; instead follow it immediately,
'foo_list[foo]', 'bar_func(bar)'.
None of these are mandatory, but they'll make your code comply with
what Python programmers expect and thus be more easily maintained.
--
\ "Are you pond
er', 'mouse': 'mickey'} == {'mouse':
'mickey', 'dog': 'bone', 'cat': 'fever'}
True
>>> {'dog': 'bone', 'cat': 'fever', 'mouse': 'mickey'} == {'mouse':
'michael', 'dog': 'bone', 'cat': 'fever'}
False
--
\ "Many are stubborn in pursuit of the path they have chosen, few |
`\ in pursuit of the goal." -- Friedrich Nietzsche |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
meric literal values in particular.
--
\"Pinky, are you pondering what I'm pondering?" "Wuh, I think |
`\so, Brain, but burlap chafes me so." -- _Pinky and The Brain_ |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
module.
--
\"I always had a repulsive need to be something more than |
`\ human." -- David Bowie |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
o go unchallenged in the archives :-)
--
\ "Never do anything against conscience even if the state demands |
`\ it." -- Albert Einstein |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
y
reading the program, the origin of every name in the current
namespace.
--
\ "I hope if dogs ever take over the world, and they chose a |
`\king, they don't just go by size, because I bet there are some |
_o__)Chihuahuas with some good ideas." -- Jack Handey |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
ort happens at run-time. The compiler can't catch it.
--
\ "I stayed up all night playing poker with tarot cards. I got a |
`\ full house and four people died." -- Steven Wright |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
erence, at exactly the time it's most
useful.
There are many who call TDD "test-driven design" for this same reason.
--
\ "A child of five could understand this. Fetch me a child of |
`\ five." -- Groucho
-- Alvin Toffler |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
ually." -- Steven Wright |
`\ |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
that users are enabling, or is it the default
behaviour?
More importantly, whom do we beat with the clue-by-four to make it
stop?
--
\ "For of those to whom much is given, much is required." -- |
`\ John F. Kennedy |
_o__)
ure in
Perl, I doubt it.
--
\ "Everything is futile." -- Marvin of Borg |
`\ |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
ts help (C-h m) for all the cool things you
can do.
--
\ "Our products just aren't engineered for security." -- Brian |
`\ Valentine, senior vice-president of Microsoft Windows |
_o__) development |
Ben
\"Holy unrefillable prescriptions, Batman!" -- Robin |
`\ |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
ed power |
`\ and expressiveness. With Python, even a regular guy can reach |
_o__)for the stars." -- Raymond Hettinger |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
just been proven
not to work? (If the only reason is "because I might need it later",
again, that's what a VCS is for.)
--
\"I'd take the awe of understanding over the awe of ignorance |
`\ any day." -- Douglas Adams |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
I said, 'Insanity, your |
`\ honour. Who in their right mind would park in the passing |
_o__) lane?'" -- Steven Wright |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
happens?
--
\ "The only tyrant I accept in this world is the still voice |
`\ within." -- Mahatma Gandhi |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
ot;True greatness is measured by how much freedom you give to |
`\ others, not by how much you can coerce others to do what you |
_o__) want." --Larry Wall |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
\"With Lisp or Forth, a master programmer has unlimited power |
`\ and expressiveness. With Python, even a regular guy can reach |
_o__)for the stars." -- Raymond Hettinger |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
] power and control will shift to those who |
`\ are actually contributing something useful rather than just |
_o__) having lunch." -- Douglas Adams |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
hon/>
http://mail.python.org/pipermail/python-list/>
--
\ "What you have become is the price you paid to get what you |
`\ used to want." -- Mignon McLaughlin |
_o__) |
Ben Finney
--
; you can derive from and redistribute cmd, so long as you
comply with the license on cmd.
--
\ "What I have to do is see, at any rate, that I do not lend |
`\ myself to the wrong which I condemn." -- Henry Thoreau, _Civil |
_o__)
break
As for reading each line: that's unavoidable if you want a specific
line from a stream of variable-length lines.
--
\ "I have never made but one prayer to God, a very short one: 'O |
`\ Lord, make my enemies ridiculous!' And God granted it." -- |
_o__) Voltaire |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
alone." -- Anonymous |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
#x27;t see any parts of the
message written by you, only paragraphs of quoted text.
--
\"The World is not dangerous because of those who do harm but |
`\ because of those who look at it without doing anything." -- |
_o__)
olding dogmas that are different from our own." -- |
_o__) Charles Issawi |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
uage user (that's you and
I) should *not* expect any particular behaviour to hold between
different implementations.
--
\ "Holy priceless collection of Etruscan snoods, Batman!" -- |
`\ Robin |
_o__)
nformation |
`\ technology as a McDonalds Certified Food Specialist is to the |
_o__) culinary arts." —Michael Bacarella |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
can picture in my mind a world without war, a world without |
`\ hate. And I can picture us attacking that world, because they'd |
_o__) never expect it." -- Jack Handey |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
Dick Moores <[EMAIL PROTECTED]> writes:
> At 06:13 PM 8/9/2007, Ben Finney wrote:
> >it's entirely left to the language implementation which
> >optimisation trade-offs to make, and the language user (that's you
> >and I) should *not* expect any particular b
hin one path prefix of a domain.
--
\ "Listen: we are here on Earth to fart around. Don't let anybody |
`\ tell you otherwise." -- _Timequake_, Kurt Vonnegut |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
) in most GNU/Linux
distributions, or you can install it from the download link.
--
\ "Pity the meek, for they shall inherit the earth." -- Donald |
`\ Robert Perry Marquis |
_o__)
for the
target.
with input_file:
# ... do stuff
> and there's a moment when the above code doesn't know to close
> myFile.
Closing the file will occur when the object is cleaned up by garbage
collection.
--
\ "I bought a self learning record to learn Spanish. I
or posting untested code snippets, Thanks
for the catch.
--
\"There was a point to this story, but it has temporarily |
`\ escaped the chronicler's mind." -- Douglas Adams |
_o__) |
Ben Fi
only ten minutes." -- Steven Wright |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
Ben Finney <[EMAIL PROTECTED]> writes:
> foo.setdefault(whatever, {})
> foo[whatever].setdefault(someother, 0)
> foo[whatever] += delta
Should, of course, be:
foo.setdefault(whatever, {})
foo[whatever].setdefault(someother, 0)
foo[whatever][some
way, perhaps you could be more explicit about what
danger you think exists?
--
\ "Are you pondering what I'm pondering?" "I think so, Brain, but |
`\pants with horizontal stripes make me look chubby." -- _Pinky |
_o__) and The Brain_ |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
; -- |
_o__)Jamie Zawinski, in alt.religion.emacs |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
in on vacation |
`\ unless acted upon by an outside force." -- Carol Reichel |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes:
> On Thu, 30 Aug 2007 17:09:36 +1000, Ben Finney wrote:
> > It's letting you know that the item isn't in the list. There's no
> > sensible return value from an "index" function in that c
s. Not me, I'm afraid of |
`\widths." -- Steven Wright |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
Ben Finney <[EMAIL PROTECTED]> writes:
> def get_an_index_even_if_not_found(the_list, the_item):
Bah. Should be "…(the_list, the_value):".
--
\"Don't worry about people stealing your ideas. If your ideas |
`\are any good, you'll have
[EMAIL PROTECTED] writes:
> On Aug 30, 12:09 am, Ben Finney <[EMAIL PROTECTED]>
> wrote:
> > It's letting you know that the item isn't in the list. There's no
> > sensible return value from an "index" function in that condition.
>
> for str
xception isn't "something that should never happen", it's
something that is entirely possible and needs to be handled somehow.
--
\ "Always do right. This will gratify some people, and astonish |
`\ the rest." --
l("34.45")
They support the full range of arithmetic operations, without
cumulative precision errors that floats are prone to.
--
\ "As the evening sky faded from a salmon color to a sort of |
`\ flint gray, I thought back to the salmon I caught that morning, |
_o__) and how
ations on real-world (analogue)
measurements.
--
\"Too many Indians spoil the golden egg." -- Sir Joh |
`\ Bjelke-Petersen |
_o__) |
Ben Finney
--
http:/
"Rightful liberty is unobstructed action, according to our |
`\will, within limits drawn around us by the equal rights of |
_o__) others." -- Thomas Jefferson |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
than the GIL.
--
\"Pinky, are you pondering what I'm pondering?" "Umm, I think |
`\ so, Brain, but three men in a tub? Ooh, that's unsanitary!" -- |
_o__)_Pinky and The Brain_ |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
Thorsten Kampe <[EMAIL PROTECTED]> writes:
> * Ben Finney (Thu, 30 Aug 2007 18:02:15 +1000)
> > Bruno Desthuilliers <[EMAIL PROTECTED]> writes:
> > > What's with using your brain instead of whining ?
> >
> > Now now, no need for snappiness.
>
counts." -- Will Rogers |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
icult to find them if one
looks. Doing so doesn't appear to illustrate any point I see relevant
in this thread.
--
\ "If you're a horse, and someone gets on you, and falls off, and |
`\ then gets right back on you, I think you should buck him off |
_o__)
uld they care about it?" -- Thomas Hesse, Sony BMG, 2006 |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
lue is lost — unless
you bind that previous value somewhere else first so you can get at it
again.
--
\ "I got up the other day, and everything in my apartment has |
`\ been stolen and replaced with an exact replica." -- Steven |
_o__) Wright |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
m and use that. If you use the options
for including random elements, the generated UUIDs will even satisfy
your "unpredictable" requirement.
--
\ "This sentence contradicts itself -- no actually it doesn't." |
`\ -- Dougla
L. Mencken |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
> party libraries that are not following the PEP?
Follow PEP 8 for your code. Grit your teeth and use the non-standard
conventions of third-party libraries, until such time as they are
(backward-incompatibly) changed to be compliant.
--
\ "Don't be afraid of missing opportuniti
e for any package.
--
\ "Try to become not a man of success, but try rather to become a |
`\ man of value." —Albert Einstein |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
TheFlyingDutchman <[EMAIL PROTECTED]> writes:
> On Sep 10, 7:12 pm, Ben Finney <[EMAIL PROTECTED]>
> wrote:
> > TheFlyingDutchman <[EMAIL PROTECTED]> writes:
> > > Looking at the documentation it looks excellent. But I don't
> > > understan
the code you see presently in version
0.4.2.
--
\ "That's all very good in practice, but how does it work in |
`\ *theory*?" —Anonymous |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
later you're hungry again." -- George Miller |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
, but |
`\pants with horizontal stripes make me look chubby." -- _Pinky |
_o__) and The Brain_ |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
erable to the magic of "instance is passed as the
first argument to a method"?
--
\ "If nothing changes, everything will remain the same." -- |
`\ Barne's Law |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
le-textwrap>.
--
\"Madness is rare in individuals, but in groups, parties, |
`\ nations and ages it is the rule." -- Friedrich Nietzsche |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
7;instance.method(args)'
syntax is just sugar for 'Class.method(instance, args)'.
--
\"Choose mnemonic identifiers. If you can't remember what |
`\ mnemonic means, you've got a problem." -- Larry Wall |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
"Peter Decker" <[EMAIL PROTECTED]> writes:
> On 9/12/07, Ben Finney <[EMAIL PROTECTED]> wrote:
> > How is that preferable to the magic of "instance is passed as the
> > first argument to a method"?
>
> So everything that isn't passed exp
oo = foo + 1'".
--
\ "I don't know half of you half as well as I should like, and I |
`\ like less than half of you half as well as you deserve." -- |
_o__)Bilbo Baggins |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
d you consider how to wrap it in that new
(harder-to-debug) context.
--
\"What if the Hokey Pokey IS what it's all about?" —anonymous |
`\ |
_o__)
t;I was in a bar the other night, hopping from barstool to |
`\ barstool, trying to get lucky, but there wasn't any gum under |
_o__) any of them." -- Emo Philips |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
ato |
`\ "To do is to be" -- Aristotle |
_o__) "Do be do be do" -- Sinatra |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
William Heymann <[EMAIL PROTECTED]> writes:
> On Saturday 03 March 2007, Ben Finney wrote:
> > Bjoern Schliessmann <[EMAIL PROTECTED]> writes:
> >
> > if not recs.has_key(piid): # [1]
> >
> Why not
>
> if piid not in recs:
>
> That
;ceiling".
--
\"Most people don't realize that large pieces of coral, which |
`\ have been painted brown and attached to the skull by common |
_o__) wood screws, can make a child look like a deer." -- Jack Handey |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
st, thinks slowest." -- Anonymous |
`\ |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
in front of the fire for the evening in two minutes." |
_o__) -- Steven Wright |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
rec.humor.oracle.d |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
ent namespace.
--
\ "When cryptography is outlawed, bayl bhgynjf jvyy unir |
`\ cevinpl." -- Anonymous |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
(at least) Java, but PEP
8 prefers lowercase_with_underscores.
--
\ "My theory of evolution is that Darwin was adopted." -- Steven |
`\ Wright |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
ut I |
`\never saw any reason to limit myself." -- Emo Philips |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
st aren't engineered for security." -- Brian |
`\ Valentine, senior vice-president of Microsoft Windows |
_o__) development |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
http://www.earth.li/projectpurple/
Got sigmatch == ^/home/bignose/\.sigs/news.*$
--
\"The right to search for truth implies also a duty; one must |
`\ not conceal any part of what one has recognized to be true." |
_o__) -- Albert Einstein |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
Ben Finney <[EMAIL PROTECTED]> writes:
> Now, when I write unit tests for my program (i.e. a Python module
> designed to be run as a command), it can still be imported safely
> into my unit tests, and all the code gets covered by test cases
> except the three-line stanza at th
rectly relevant to
your reply.)
--
\"Beware of and eschew pompous prolixity." -- Charles A. |
`\ Beardsley |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
:-)
--
\ "I may disagree with what you say, but I will defend to the |
`\death your right to mis-attribute this quote to Voltaire." -- |
_o__) Avram Grumer, rec.arts.sf.written, May 2000 |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
\ "Buy not what you want, but what you need; what you do not need |
`\ is expensive at a penny." -- Cato, 234-149 BC, Relique |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
asked what he thought of Western civilization) |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
rentheses can be used just about anywhere you
might otherwise need backslash-escaped line breaks.
--
\ "My, your, his, hers, ours, theirs, its. |
`\ I'm, you're, he's, she's, we're, they're, it's." |
_o__) -- Anonymous, alt.sysadmin.recovery |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
t entertaining, if not informative.
It looks like a great get-started guide for the many C++ refugees I
hope we can gain :-)
--
\"Why, I'd horse-whip you if I had a horse." -- Groucho Marx |
`\
other class.
As for the original question: the __init__ method of a class is called
immediately after the constructor, so that's the place to initialise
any instance attributes.
--
\ "At my lemonade stand I used to give the first glass away free |
`\ and charge five doll
"Steven D'Aprano" <[EMAIL PROTECTED]> writes:
> On Mon, 19 Mar 2007 19:48:37 +1100, Ben Finney wrote:
>
> > It's also best to inherit every class from another class, leading
> > to a single hierarchy for all classes and types. 'object' is th
l rich, I hope I'm not real mean to poor |
`\ people, like I am now." -- Jack Handey |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
't even
know exist.
--
\ "People always ask me, 'Where were you when Kennedy was shot?' |
`\ Well, I don't have an alibi." -- Emo Philips |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
illing to go through hell to get it." -- Donald Robert Perry |
_o__) Marquis |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
quot;Somebody told me how frightening it was how much topsoil we |
`\ are losing each year, but I told that story around the campfire |
_o__) and nobody got scared." -- Jack Handey |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
st. Is there a better way?
--
\"Beware of and eschew pompous prolixity." -- Charles A. |
`\ Beardsley |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
take. You have to let nudity |
_o__) 'happen.'" -- Jack Handey |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
s wouldn't be doing that.
The crackers, however, might.
--
\ "Try to become not a man of success, but try rather to become a |
`\man of value." -- Albert Einstein |
_o__) |
B
ot;foo"
>>> b = "bar"
>>> c = "baz"
>>> a = b = c
>>> a, b, c
('baz', 'baz', 'baz')
--
\"During my service in the United States Congress, I took the |
`\
gift for the President would be a chocolate |
`\ revolver. And since he's so busy, you'd probably have to run up |
_o__) to him real quick and hand it to him." -- Jack Handey |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
""" Play a new game """
game = game_class()
game.start_play()
--
\"The number of UNIX installations has grown to 10, with more |
`\ expected." -- Unix Programmer's Manual, 2nd Ed., 12-Jun-1972 |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
ot sure you realize that what you heard is not what I |
_o__) meant." -- Robert J. McCloskey |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
2401 - 2500 of 4138 matches
Mail list logo