Ivan Van Laningham wrote:
Bad Michael. Bad, bad Michael.
:(
Well personally I consider it better to tell people of hacks
like that with a warning not to use them than let them
discover them on their own (without such a warning).
Plus dubious Python hacks that should never be used in
production cod
Hi All--
Michael Hoffman wrote:
>
> Jaime Wyant wrote:
>
> > # This won't work
> > if a > 5: print "a > 5";else print "Doh"
>
> This will:
>
> ["Doh", "a > 5"][a > 5]
>
> I highly discourage using it though--it's somewhat obtuse.
>
Bad Michael. Bad, bad Michael.
Metta,
Ivan
---
Michael Hoffman wrote:
Jaime Wyant wrote:
# This won't work
if a > 5: print "a > 5";else print "Doh"
This will:
["Doh", "a > 5"][a > 5]
I highly discourage using it though--it's somewhat obtuse.
It's also limited to evaluating expressions, which is
probably not very useful to the OP...
--
http://m
Jaime Wyant wrote:
# This won't work
if a > 5: print "a > 5";else print "Doh"
This will:
["Doh", "a > 5"][a > 5]
I highly discourage using it though--it's somewhat obtuse.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 30 Mar 2005 14:26:20 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote:
> Jaime Wyant wrote:
> > Well, I'm embedding python in an old C console app. This app uses a
> > lot of ; delimited records.
> >
> > I want to allow the execution of arbitrary python statements inside
> > some of these rec
Jaime Wyant wrote:
[snip]
After goofing around with this idea, I've realized you can't be very
expressive with a bunch of python statements strung together. My
biggest problem is that I can't figure out (i don't think you can),
how to do conditionals that are strung together:
# This won't work
if
Jaime Wyant wrote:
Well, I'm embedding python in an old C console app. This app uses a
lot of ; delimited records.
I want to allow the execution of arbitrary python statements inside
some of these records. I was hoping there was an easy way to set the
statement terminator. I will simply make up
Well, I'm embedding python in an old C console app. This app uses a
lot of ; delimited records.
I want to allow the execution of arbitrary python statements inside
some of these records. I was hoping there was an easy way to set the
statement terminator. I will simply make up a new terminator a
Jaime Wyant wrote:
I know I've seen this somewhere, but can't seem to google it. Is
there a way to use an alternate statement separator, other than the
default ';'?
The validity of Terry's answer (which is true for the general case)
aside, it might be possible to do what you are trying to do
if yo
"Jaime Wyant" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>I know I've seen this somewhere, but can't seem to google it. Is
> there a way to use an alternate statement separator, other than the
> default ';'?
Other than \n, no. Both are builtin to the language definition and
i
I know I've seen this somewhere, but can't seem to google it. Is
there a way to use an alternate statement separator, other than the
default ';'?
jw
--
http://mail.python.org/mailman/listinfo/python-list
11 matches
Mail list logo