On Thu, 09 Mar 2006 15:45:13 +, Duncan Booth wrote:
> Like it or not, Python uses exceptions for normal loop flow control. That's
> a fact of life, live with it: every normal termination of a for loop is an
> exception. Real exceptions don't get masked: for loops terminate with
> StopIterat
Duncan Booth <[EMAIL PROTECTED]> writes:
> wrote:
>
>> Coming from a background that exposed me to far too many languages, I
>> find the latter two examples (i.e. use try/except) to be horrible
>> solutions. It's not a matter of light/heavy weight, it's a matter of
>> using exceptions for normal
<[EMAIL PROTECTED]> wrote:
...
> I recommend reading Effective Java (Bloch), specifically the beginning
> of the exceptions chapter, for more details why using exceptions to
> exit loops is a bad thing (and while the title is effective java, much
> of it is directly applicable to a lot of python
wrote:
> Coming from a background that exposed me to far too many languages, I
> find the latter two examples (i.e. use try/except) to be horrible
> solutions. It's not a matter of light/heavy weight, it's a matter of
> using exceptions for normal loop flow control is a really bad idea.
> 1) I
Coming from a background that exposed me to far too many languages, I
find the latter two examples (i.e. use try/except) to be horrible
solutions. It's not a matter of light/heavy weight, it's a matter of
using exceptions for normal loop flow control is a really bad idea.
1) I think it's less cle
On Sun, 05 Mar 2006 15:09:28 +0100, Fredrik Tolf wrote:
> Hi list!
>
> I'm relatively new to Python, and one thing I can't seem to get over is
> the lack of in-expression assignments, as present in many other
> languages. I'd really like to know how Python regulars solve the
> problems posed by t
Fredrik Tolf <[EMAIL PROTECTED]> wrote:
...
> I'm relatively new to Python, and one thing I can't seem to get over is
> the lack of in-expression assignments, as present in many other
> languages. I'd really like to know how Python regulars solve the
> problems posed by that.
In general, we've
Fredrik Tolf wrote:
> However, since I can't do that in Python, I ended up using an extra
> local variable instead, like this:
>
> f = getattr(self, "cmd_" + name)
> f2 = getattr(self, "cmdv_" + name)
> if callable(f):
> # Do something with f
> elif callable(f2):
> # Do something with f2
Fredrik Tolf wrote:
> I'm relatively new to Python, and one thing I can't seem to get over is
> the lack of in-expression assignments, as present in many other
> languages. I'd really like to know how Python regulars solve the
> problems posed by that.
>
> For example, I recently wanted to do this
Hi list!
I'm relatively new to Python, and one thing I can't seem to get over is
the lack of in-expression assignments, as present in many other
languages. I'd really like to know how Python regulars solve the
problems posed by that.
For example, I recently wanted to do this:
if callable(f = get
10 matches
Mail list logo