On Fri, 14 Jun 2013 16:07:56 +0300, Nick the Gr33k wrote:
Thanks for explaining this but i cannot follow its logic at all. My mind
is stuck trying to interpret it as an English sentence:
if ('Parker' and 'May' and '2001')
if ('Parker' or 'May' or '2001')
i just don't get it and i feel
On 14/6/2013 7:31 μμ, Steven D'Aprano wrote:
On Fri, 14 Jun 2013 16:07:56 +0300, Nick the Gr33k wrote:
Thanks for explaining this but i cannot follow its logic at all. My mind
is stuck trying to interpret it as an English sentence:
if ('Parker' and 'May' and '2001')
if ('Parker' or 'May' or
On Sat, Jun 15, 2013 at 2:56 AM, Nick the Gr33k supp...@superhost.gr wrote:
What i'm trying to say that both these exprs are Boolean Expressions
therefore should return Boolean values not variable's values, even if they
are truthy.
Okay, now we get to the nub of the matter.
In some languages,
Nick the Gr33k writes:
(a or b or c)
'abcd'
This for me, should evaluate to True but instead it has been
evaluated to the first variable's value, which is a truthy value of
course since its not an empty string, but shouldn't it return True
instead?
In your own programs, write bool(a or
On 06/14/2013 09:56 AM, Nick the Gr33k wrote:
On 14/6/2013 7:31 μμ, Steven D'Aprano wrote:
On Fri, 14 Jun 2013 16:07:56 +0300, Nick the Gr33k wrote:
Returning True is the same thing as returning a variable's truthy value?
NO! 'True' and 'False' are the two values of the boolean type.
On 13/6/2013 4:55 πμ, Steven D'Aprano wrote:
On Wed, 12 Jun 2013 14:17:32 +0300, Νικόλαος Κούρας wrote:
doesn't that mean?
if '=' not in ( name and month and year ):
if '=' does not exists as a char inside the name and month and year
variables?
i think it does, but why it
:
On 12 June 2013 10:55, Neil Cerutti ne...@norwich.edu wrote:
He's definitely trolling. I can't think of any other reason to
make it so hard to kill-file himself.
He's not a troll, he's a help vampire:
http://slash7.com/2006/12/22/vampires/
... a particularly extreme example, I'll admit:
Am 13.06.2013 09:11, schrieb Νικόλαος Κούρας:
On 13/6/2013 4:55 πμ, Steven D'Aprano wrote:
The and operator works in a similar fashion. Experiment with it and see
how it works for yourself.
I read yours psots many times,all of them, tryign to understand them.
But you didn't do what he
On Jun 12, 8:20 pm, Zero Piraeus sche...@gmail.com wrote:
:
On 12 June 2013 10:55, Neil Cerutti ne...@norwich.edu wrote:
He's definitely trolling. I can't think of any other reason to
make it so hard to kill-file himself.
He's not a troll, he's a help vampire:
On 2013-06-12, Zero Piraeus sche...@gmail.com wrote:
On 12 June 2013 10:55, Neil Cerutti ne...@norwich.edu wrote:
He's definitely trolling. I can't think of any other reason to
make it so hard to kill-file himself.
He's not a troll, he's a help vampire:
In article
8a75b1e4-41e8-45b5-ac9e-6611a4698...@g9g2000pbd.googlegroups.com,
rusi rustompm...@gmail.com wrote:
On Jun 12, 8:20 pm, Zero Piraeus sche...@gmail.com wrote:
:
On 12 June 2013 10:55, Neil Cerutti ne...@norwich.edu wrote:
He's definitely trolling. I can't think of any
On 13/6/2013 3:22 μμ, Sibylle Koczian wrote:
Am 13.06.2013 09:11, schrieb Νικόλαος Κούρας:
On 13/6/2013 4:55 πμ, Steven D'Aprano wrote:
The and operator works in a similar fashion. Experiment with it and
see
how it works for yourself.
I read yours psots many times,all of them, tryign to
On 13/6/2013 12:16 πμ, Sibylle Koczian wrote:
Am 12.06.2013 22:00, schrieb Νικόλαος Κούρας:
On 12/6/2013 10:48 μμ, Sibylle Koczian wrote:
if '=' not in ( name and month and year ):
i understand: if '=' not in name AND '=' not in month AND '=' not in
year
Wrong. The '=' not in (...) first
if '-' not in name + month + year:
cur.execute( '''SELECT * FROM works WHERE clientsID = (SELECT id FROM
clients WHERE name = %s) and MONTH(lastvisit) = %s and YEAR(lastvisit) =
%s ORDER BY lastvisit ASC''', (name, month, year) )
elif '-' not in name + year:
On Thu, 13 Jun 2013 17:26:18 +0300, Νικόλαος Κούρας wrote:
i just want 4 cases to examine so correct execute to be run:
i'm reading and reading and reading this all over:
if '-' not in ( name and month and year ):
and i cant comprehend it.
Don't just read it. Open the interactive
On Jun 12, 3:44 pm, Tim Roberts t...@probo.com wrote:
It seems silly to fire up a regular expression compiler to look for a
single character.
if name.find('=') 0 and month.find('=') 0 and year.find('=') 0:
If truthiness is the only concern, I prefer using `in`:
if '=' in name and
On Tue, 11 Jun 2013 22:49:05 -0600, Michael Torrie wrote:
What do each of these functions return? When you print out
re.search('=', name) what happens?
First of all i have changed the code to the following because using a
regex
to detect a single char was an overkill.
if '=' not in name
On Wed, Jun 12, 2013 at 5:45 PM, Νικόλαος Κούρας supp...@superhost.gr wrote:
First of all i have changed the code to the following because using a
regex
to detect a single char was an overkill.
if '=' not in name and '=' not in month and '=' not in year:
It'd be courteous to acknowledge
On Tue, 11 Jun 2013 13:20:52 -0700, Νικόλαος Κούρας wrote:
The above if structure works correctly *only* if the user sumbits by
form:
name, month, year or month, year
If, he just enter a year in the form and sumbit then, i get no error,
but no results displayed back.
Any ideas as to
On 12/6/2013 11:27 πμ, Denis McMahon wrote:
On Tue, 11 Jun 2013 13:20:52 -0700, Νικόλαος Κούρας wrote:
The above if structure works correctly *only* if the user sumbits by
form:
name, month, year or month, year
If, he just enter a year in the form and sumbit then, i get no error,
but no
On Wed, Jun 12, 2013 at 9:54 AM, Νικόλαος Κούρας supp...@superhost.gr wrote:
but if enumerate yields 0 instead of '==' then elif '=' not in
year of course fails.
So, i must tell:
for i, month in enumerate(months):
print('option value=%s %s /option' % (i, month) )
to somehow
On 12/6/2013 12:07 μμ, F�bio Santos wrote:
On Wed, Jun 12, 2013 at 9:54 AM, Νικόλαος Κούρας supp...@superhost.gr wrote:
but if enumerate yields 0 instead of '==' then elif '=' not in
year of course fails.
So, i must tell:
for i, month in enumerate(months):
print('option value=%s
On 12 Jun 2013 10:29, Νικόλαος Κούρας supp...@superhost.gr wrote:
On 12/6/2013 12:07 μμ, F�bio Santos wrote:
On Wed, Jun 12, 2013 at 9:54 AM, Νικόλαος Κούρας supp...@superhost.gr
wrote:
but if enumerate yields 0 instead of '==' then elif '=' not in
year of course fails.
So, i must
[Please trim your replies to the relevant parts.]
On 12.06.2013 10:54, Νικόλαος Κούρας wrote:
But when it comes to select '==' from month instead of
'==' to be submitted a zero gets submitted and i think the
problem is the way i'm filling up months into the drop down menu which
On 11Jun2013 18:25, Nikos nagia.rets...@gmail.com wrote:
| What are the values of 'name', 'month' and 'year' in each of the cases?
|
| Printing out ascii(name), ascii(month) and ascii(year), will be helpful.
|
| Then try stepping through those lines in your head.
|
| i hav epribted all
Original Message
Subject: Re: A certainl part of an if() structure never gets executed.
Date: Wed, 12 Jun 2013 10:07:39 +0100
From: Fábio Santos fabiosantos...@gmail.com
To: Νικόλαος Κούρας supp...@superhost.gr
CC: python-list@python.org python-list@python.org
Newsgroups
On 12/6/2013 1:07 μμ, Andreas Perstinger wrote:
So, i must tell:
for i, month in enumerate(months):
print('option value=%s %s /option' % (i, month) )
to somehow return '==' instead of 0 but don't know how.
As with most of your problems you are barking up the wrong tree.
Why
Oh my God!
i just need to do this:
for i, month in enumerate( months ):
print('option value=%s %s /option' % (month, month) )
--
http://mail.python.org/mailman/listinfo/python-list
Am Mittwoch, 12. Juni 2013 12:07:54 UTC+2 schrieb Andreas Perstinger:
[Please trim your replies to the relevant parts.]
On 12.06.2013 10:54, Νικόλαος Κούρας wrote:
But when it comes to select '==' from month instead of
'==' to be submitted a zero gets submitted and i think
As with most of your problems you are barking up the wrong tree.
Why not use the actual value you get from the form to check whether you
have a valid month?
Do you understand why 0 is submitted instead of ==?
Bye, Andreas
I have corrected the enumerate loop but it seems thet now the
On 12 Jun 2013 12:08, Νικόλαος Κούρας supp...@superhost.gr wrote:
Oh my God!
i just need to do this:
for i, month in enumerate( months ):
print('option value=%s %s /option' % (month, month) )
Usually what goes in option value=... is an ID of something. You should
keep using (i,
On 2013-06-12, Chris Angelico ros...@gmail.com wrote:
On Wed, Jun 12, 2013 at 5:45 PM, ?? supp...@superhost.gr wrote:
First of all i have changed the code to the following because using a
regex
to detect a single char was an overkill.
if '=' not in name and '=' not in month and
On 12/6/2013 2:49 μμ, F�bio Santos wrote:
On 12 Jun 2013 12:08, �� supp...@superhost.gr
mailto:supp...@superhost.gr wrote:
Oh my God!
i just need to do this:
for i, month in enumerate( months ):
� � � � print('option value=%s %s /option' % (month, month) )
Usually
On 12/06/2013 14:05, Neil Cerutti wrote:
Also, I wish he would stop fudging his From info. I've got
something like 8 entries for this ass in my killfile, and it
seems I need a new one every day.
An ass eh, when did he get promoted to that position?
--
Steve is going for the pink ball - and
On 2013-06-12, Grant Edwards invalid@invalid.invalid wrote:
On 2013-06-12, Tim Roberts t...@probo.com wrote:
?? nikos.gr...@gmail.com wrote:
[code]
if not re.search( '=', name ) and not re.search( '=', month )
and not re.search( '=', year ):
On 2013-06-12, Tim Roberts t...@probo.com wrote:
?? nikos.gr...@gmail.com wrote:
[code]
if not re.search( '=', name ) and not re.search( '=', month )
and not re.search( '=', year ):
cur.execute( '''SELECT * FROM works WHERE clientsID =
(SELECT
On 12/06/2013 12:17, Νικόλαος Κούρας wrote:
As with most of your problems you are barking up the wrong tree.
Why not use the actual value you get from the form to check whether you
have a valid month?
Do you understand why 0 is submitted instead of ==?
Bye, Andreas
I have corrected
On 12/6/2013 7:40 μμ, MRAB wrote:
On 12/06/2013 12:17, Νικόλαος Κούρας wrote:
As with most of your problems you are barking up the wrong tree.
Why not use the actual value you get from the form to check whether you
have a valid month?
Do you understand why 0 is submitted instead of
On 12/06/2013 18:13, Νικόλαος Κούρας wrote:
On 12/6/2013 7:40 μμ, MRAB wrote:
On 12/06/2013 12:17, Νικόλαος Κούρας wrote:
As with most of your problems you are barking up the wrong tree.
Why not use the actual value you get from the form to check whether you
have a valid month?
Do you
On 12/6/2013 8:53 μμ, MRAB wrote:
and then what this is doing?
if '=' not in ( name or month or year ):
In English, the result of:
x or y
is basically:
if bool(x) is true then the result is x, otherwise the result is y
For example:
bool()
False
or world
'world'
Am 12.06.2013 20:06, schrieb Νικόλαος Κούρας:
Whn i see:
if( x and y ):
i understand: if x expression = True AND ALSO y expression = True then
execute
if( x or y ):
i understand: if x expression = True OR y expression = True then execute
You didn't read MRABs explanation, did you?
if '='
On 12/6/2013 10:48 μμ, Sibylle Koczian wrote:
if '=' not in ( name and month and year ):
i understand: if '=' not in name AND '=' not in month AND '=' not in year
Wrong. The '=' not in (...) first evaluates the expression in
parentheses, that's what parentheses are for. And then it looks for
On Wed, Jun 12, 2013 at 9:07 PM, feedthetr...@gmx.de wrote:
If you still don't know why you get 0 read:
http://www.w3schools.com/tags/att_option_value.asp (or something in
greek about html forms)
(Sorry, I know, you do not read doks, because they describe what the software
DOES and not
On Thu, Jun 13, 2013 at 6:00 AM, Νικόλαος Κούρας supp...@superhost.gr wrote:
On 12/6/2013 10:48 μμ, Sibylle Koczian wrote:
if '=' not in ( name and month and year ):
i understand: if '=' not in name AND '=' not in month AND '=' not in year
Wrong. The '=' not in (...) first evaluates the
Am 12.06.2013 22:00, schrieb Νικόλαος Κούρας:
On 12/6/2013 10:48 μμ, Sibylle Koczian wrote:
if '=' not in ( name and month and year ):
i understand: if '=' not in name AND '=' not in month AND '=' not in
year
Wrong. The '=' not in (...) first evaluates the expression in
parentheses, that's
On Wed, 12 Jun 2013 14:17:32 +0300, Νικόλαος Κούρας wrote:
doesn't that mean?
if '=' not in ( name and month and year ):
if '=' does not exists as a char inside the name and month and year
variables?
i think it does, but why it fails then?
No. Python is very close to
On Thu, Jun 13, 2013 at 11:55 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
In English:
the cat is in the box or the cupboard or the kitchen
means:
the cat is in the box, or the cat is in the cupboard, or the cat is in
the kitchen.
But that is not how Python works. In
Chris Angelico ros...@gmail.com writes:
On Thu, Jun 13, 2013 at 11:55 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
In English:
the cat is in the box or the cupboard or the kitchen
means:
the cat is in the box, or the cat is in the cupboard, or the cat is in
the
On Thu, Jun 13, 2013 at 2:35 PM, Kushal Kumaran
kushal.kumaran+pyt...@gmail.com wrote:
In [4]: 'cd' in s1 or 'cd' in s2 or 'cd' in s3
Out[4]: False
In [5]: 'cd' in s1+s2+s3
Out[5]: True
That's why I said it works for *character* in string, not *string* in
string. If your first operand is a
On 13/6/2013 4:55 πμ, Steven D'Aprano wrote:
On Wed, 12 Jun 2013 14:17:32 +0300, Νικόλαος Κούρας wrote:
doesn't that mean?
if '=' not in ( name and month and year ):
if '=' does not exists as a char inside the name and month and year
variables?
i think it does, but why it
[code]
if not re.search( '=', name ) and not re.search( '=', month )
and not re.search( '=', year ):
cur.execute( '''SELECT * FROM works WHERE clientsID =
(SELECT id FROM clients WHERE name = %s) and MONTH(lastvisit) = %s and
YEAR(lastvisit) = %s ORDER BY
On 11/06/2013 21:20, Νικόλαος Κούρας wrote:
[code]
if not re.search( '=', name ) and not re.search( '=', month )
and not re.search( '=', year ):
cur.execute( '''SELECT * FROM works WHERE clientsID =
(SELECT id FROM clients WHERE name = %s) and
On 11/06/2013 21:20, Νικόλαος Κούρας wrote:
[code]
if not re.search( '=', name ) and not re.search( '=', month )
and not re.search( '=', year ):
cur.execute( '''SELECT * FROM works WHERE clientsID =
(SELECT id FROM clients WHERE name = %s) and
Umm, Niko. (Superfluous Unicode Removed)
The code you have written is very difficult to read because you are doing too
much inside the conditional and you're repeating things!. For starters you
could compile those regexps and re-use them:
## BEGIN SESSION ##
py import re
py s = \
... hello.
On Jun 12, 6:20 am, Νικόλαος Κούρας nikos.gr...@gmail.com wrote:
[code]
http://pythonconquerstheuniverse.wordpress.com/2009/09/10/debugging-in-python/
Hey, I have a problem, here is my code, you work it out is not a
valid debugging technique.
--
Τη Τετάρτη, 12 Ιουνίου 2013 1:43:21 π.μ. UTC+3, ο χρήστης MRAB έγραψε:
On 11/06/2013 21:20, Νικόλαος Κούρας wrote:
[code]
if not re.search( '=', name ) and not re.search( '=', month )
and not re.search( '=', year ):
cur.execute( '''SELECT * FROM
On Tuesday, June 11, 2013 8:25:30 PM UTC-5, nagia@gmail.com wrote:
is there a shorter and more clear way to write this?
i didnt understood what Rick trie to told me.
My example included verbatim copies of interactive sessions within the Python
command line. You might understand them
On 12/06/2013 02:25, nagia.rets...@gmail.com wrote:
Τη Τετάρτη, 12 Ιουνίου 2013 1:43:21 π.μ. UTC+3, ο χρήστης MRAB έγραψε:
On 11/06/2013 21:20, Νικόλαος Κούρας wrote:
[snip]
What are the values of 'name', 'month' and 'year' in each of the cases?
Printing out ascii(name), ascii(month) and
On Jun 12, 11:46 am, Rick Johnson rantingrickjohn...@gmail.com
wrote:
Utilizing the power of interactive sessions, for learning and debugging,
should be a cornerstone fundamental of your programming work-flow when
writing code in an interpreted language like Python.
Unfortunately with Ferrous,
On Wed, Jun 12, 2013 at 11:57 AM, alex23 wuwe...@gmail.com wrote:
On Jun 12, 11:46 am, Rick Johnson rantingrickjohn...@gmail.com
wrote:
Utilizing the power of interactive sessions, for learning and debugging,
should be a cornerstone fundamental of your programming work-flow when
writing code
On Jun 12, 12:05 pm, Chris Angelico ros...@gmail.com wrote:
You have to include the coding phase. How else would he get into an error
state?
Via copy paste.
--
http://mail.python.org/mailman/listinfo/python-list
On Tuesday, June 11, 2013 9:14:38 PM UTC-5, alex23 wrote:
On Jun 12, 12:05 pm, Chris Angelico ros...@gmail.com wrote:
You have to include the coding phase.
How else would he get into an error state?
Via copy paste.
Now that's more like it Alex!
If you move to my side the Python
On Tuesday, June 11, 2013 10:37:39 PM UTC-5, Rick Johnson wrote:
Now that's more like it Alex!
Opps, it seems i falsely interpreted Chris's post as directed towards me, and
then with that false assumption in mind i went on to falsely interpreted reply
to Chris. Folks if your not already
On 06/11/2013 02:20 PM, Νικόλαος Κούρας wrote:
[code]
if not re.search( '=', name ) and not re.search( '=', month )
and not re.search( '=', year ):
What do each of these functions return? When you print out
re.search('=', name) what happens?
When you're debugging you should
On 06/11/2013 10:49 PM, Michael Torrie wrote:
--- my_cgi_script.py ---
import do_something
# handle cgi stuff
# get name, month year
dosomething.dosomething(name, month, year)
Make that do_something.do_something
--
?? nikos.gr...@gmail.com wrote:
[code]
if not re.search( '=', name ) and not re.search( '=', month )
and not re.search( '=', year ):
cur.execute( '''SELECT * FROM works WHERE clientsID =
(SELECT id FROM clients WHERE name = %s) and
101 - 166 of 166 matches
Mail list logo