Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #77321 > unrolled thread
| Started by | Seymore4Head <Seymore4Head@Hotmail.invalid> |
|---|---|
| First post | 2014-08-30 14:27 -0400 |
| Last post | 2014-08-31 19:05 +1000 |
| Articles | 20 on this page of 28 — 12 participants |
Back to article view | Back to comp.lang.python
I have tried and errored a reasonable amount of times Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-30 14:27 -0400
Re: I have tried and errored a reasonable amount of times Tim Chase <python.list@tim.thechases.com> - 2014-08-30 13:48 -0500
Re: I have tried and errored a reasonable amount of times Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-30 14:50 -0400
Re: I have tried and errored a reasonable amount of times Ned Batchelder <ned@nedbatchelder.com> - 2014-08-30 16:20 -0400
Re: I have tried and errored a reasonable amount of times Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-30 16:32 -0400
Re: I have tried and errored a reasonable amount of times Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-31 18:37 +1000
Re: I have tried and errored a reasonable amount of times Chris Angelico <rosuav@gmail.com> - 2014-08-31 19:16 +1000
Re: I have tried and errored a reasonable amount of times Grant Edwards <invalid@invalid.invalid> - 2014-09-02 16:43 +0000
Re: I have tried and errored a reasonable amount of times Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-09-02 12:59 -0400
Re: I have tried and errored a reasonable amount of times Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-03 11:44 +1000
Re: I have tried and errored a reasonable amount of times Rustom Mody <rustompmody@gmail.com> - 2014-09-02 20:14 -0700
Re: I have tried and errored a reasonable amount of times Steven D'Aprano <steve@pearwood.info> - 2014-09-03 07:16 +0000
Re: I have tried and errored a reasonable amount of times Marko Rauhamaa <marko@pacujo.net> - 2014-09-03 10:44 +0300
Re: I have tried and errored a reasonable amount of times Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-04 11:54 +1000
Re: I have tried and errored a reasonable amount of times Chris Angelico <rosuav@gmail.com> - 2014-09-04 12:03 +1000
Re: I have tried and errored a reasonable amount of times Rustom Mody <rustompmody@gmail.com> - 2014-09-03 19:23 -0700
Re: I have tried and errored a reasonable amount of times Marko Rauhamaa <marko@pacujo.net> - 2014-09-04 08:36 +0300
Re: I have tried and errored a reasonable amount of times Denis McMahon <denismfmcmahon@gmail.com> - 2014-09-04 11:17 +0000
Re: I have tried and errored a reasonable amount of times Chris Angelico <rosuav@gmail.com> - 2014-09-04 21:42 +1000
Re: I have tried and errored a reasonable amount of times Denis McMahon <denismfmcmahon@gmail.com> - 2014-09-05 02:53 +0000
Re: I have tried and errored a reasonable amount of times Chris Angelico <rosuav@gmail.com> - 2014-09-05 13:02 +1000
Re: I have tried and errored a reasonable amount of times Grant Edwards <invalid@invalid.invalid> - 2014-09-05 14:54 +0000
Re: I have tried and errored a reasonable amount of times Marko Rauhamaa <marko@pacujo.net> - 2014-09-05 19:45 +0300
Re: I have tried and errored a reasonable amount of times Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-30 22:21 +0100
Re: I have tried and errored a reasonable amount of times Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-30 17:48 -0400
Re: I have tried and errored a reasonable amount of times Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-30 23:32 +0100
Re: I have tried and errored a reasonable amount of times Cameron Simpson <cs@zip.com.au> - 2014-08-31 15:30 +1000
Re: I have tried and errored a reasonable amount of times Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-31 19:05 +1000
Page 1 of 2 [1] 2 Next page →
| From | Seymore4Head <Seymore4Head@Hotmail.invalid> |
|---|---|
| Date | 2014-08-30 14:27 -0400 |
| Subject | I have tried and errored a reasonable amount of times |
| Message-ID | <b2540atcdbtj8hce9mnt4ml4i0nv5qso8u@4ax.com> |
I really tried to get this without asking for help.
mylist = ["The", "earth", "Revolves", "around", "Sun"]
print (mylist)
for e in mylist:
# one of these two choices should print something. Since neither
does, I am missing something subtle.
if e[0].isupper == False:
print ("False")
if e[0].isupper == True:
print ("True")
I am sure in the first , third and fifth choices should be true. Right
now, I am just testing the first letter of each word.
[toc] | [next] | [standalone]
| From | Tim Chase <python.list@tim.thechases.com> |
|---|---|
| Date | 2014-08-30 13:48 -0500 |
| Message-ID | <mailman.13646.1409424597.18130.python-list@python.org> |
| In reply to | #77321 |
On 2014-08-30 14:27, Seymore4Head wrote:
> I really tried to get this without asking for help.
>
> mylist = ["The", "earth", "Revolves", "around", "Sun"]
> print (mylist)
> for e in mylist:
>
> # one of these two choices should print something. Since neither
> does, I am missing something subtle.
>
> if e[0].isupper == False:
> print ("False")
> if e[0].isupper == True:
> print ("True")
>
> I am sure in the first , third and fifth choices should be true.
> Right now, I am just testing the first letter of each word.
There's a difference between e[0].isupper which refers to the method
itself, and e[0].isupper() which then calls that method. Call the
method, and you should be good to go.
-tkc
[toc] | [prev] | [next] | [standalone]
| From | Seymore4Head <Seymore4Head@Hotmail.invalid> |
|---|---|
| Date | 2014-08-30 14:50 -0400 |
| Message-ID | <v6740aprghq946aj1r9mgk1j4865vivoqt@4ax.com> |
| In reply to | #77323 |
On Sat, 30 Aug 2014 13:48:09 -0500, Tim Chase
<python.list@tim.thechases.com> wrote:
>On 2014-08-30 14:27, Seymore4Head wrote:
>> I really tried to get this without asking for help.
>>
>> mylist = ["The", "earth", "Revolves", "around", "Sun"]
>> print (mylist)
>> for e in mylist:
>>
>> # one of these two choices should print something. Since neither
>> does, I am missing something subtle.
>>
>> if e[0].isupper == False:
>> print ("False")
>> if e[0].isupper == True:
>> print ("True")
>>
>> I am sure in the first , third and fifth choices should be true.
>> Right now, I am just testing the first letter of each word.
>
>There's a difference between e[0].isupper which refers to the method
>itself, and e[0].isupper() which then calls that method. Call the
>method, and you should be good to go.
>
>-tkc
>
That works.
Thanks
[toc] | [prev] | [next] | [standalone]
| From | Ned Batchelder <ned@nedbatchelder.com> |
|---|---|
| Date | 2014-08-30 16:20 -0400 |
| Message-ID | <mailman.13652.1409430069.18130.python-list@python.org> |
| In reply to | #77324 |
On 8/30/14 2:50 PM, Seymore4Head wrote:
> On Sat, 30 Aug 2014 13:48:09 -0500, Tim Chase
> <python.list@tim.thechases.com> wrote:
>
>> On 2014-08-30 14:27, Seymore4Head wrote:
>>> I really tried to get this without asking for help.
>>>
>>> mylist = ["The", "earth", "Revolves", "around", "Sun"]
>>> print (mylist)
>>> for e in mylist:
>>>
>>> # one of these two choices should print something. Since neither
>>> does, I am missing something subtle.
>>>
>>> if e[0].isupper == False:
>>> print ("False")
>>> if e[0].isupper == True:
>>> print ("True")
>>>
>>> I am sure in the first , third and fifth choices should be true.
>>> Right now, I am just testing the first letter of each word.
>>
>> There's a difference between e[0].isupper which refers to the method
>> itself, and e[0].isupper() which then calls that method. Call the
>> method, and you should be good to go.
>>
>> -tkc
>>
> That works.
> Thanks
>
Also, instead of:
if e[0].isupper() == False:
if e[0].isupper() == True:
use:
if not e[0].isupper():
if e[0].isupper():
It's clearer and reads better.
--
Ned Batchelder, http://nedbatchelder.com
[toc] | [prev] | [next] | [standalone]
| From | Seymore4Head <Seymore4Head@Hotmail.invalid> |
|---|---|
| Date | 2014-08-30 16:32 -0400 |
| Message-ID | <epc40api3l8gftjgva9shabjt8b48s5id9@4ax.com> |
| In reply to | #77331 |
On Sat, 30 Aug 2014 16:20:56 -0400, Ned Batchelder
<ned@nedbatchelder.com> wrote:
>On 8/30/14 2:50 PM, Seymore4Head wrote:
>> On Sat, 30 Aug 2014 13:48:09 -0500, Tim Chase
>> <python.list@tim.thechases.com> wrote:
>>
>>> On 2014-08-30 14:27, Seymore4Head wrote:
>>>> I really tried to get this without asking for help.
>>>>
>>>> mylist = ["The", "earth", "Revolves", "around", "Sun"]
>>>> print (mylist)
>>>> for e in mylist:
>>>>
>>>> # one of these two choices should print something. Since neither
>>>> does, I am missing something subtle.
>>>>
>>>> if e[0].isupper == False:
>>>> print ("False")
>>>> if e[0].isupper == True:
>>>> print ("True")
>>>>
>>>> I am sure in the first , third and fifth choices should be true.
>>>> Right now, I am just testing the first letter of each word.
>>>
>>> There's a difference between e[0].isupper which refers to the method
>>> itself, and e[0].isupper() which then calls that method. Call the
>>> method, and you should be good to go.
>>>
>>> -tkc
>>>
>> That works.
>> Thanks
>>
>
>Also, instead of:
>
> if e[0].isupper() == False:
> if e[0].isupper() == True:
>
>use:
>
> if not e[0].isupper():
> if e[0].isupper():
>
>It's clearer and reads better.
Thanks
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2014-08-31 18:37 +1000 |
| Message-ID | <5402deb1$0$9505$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #77324 |
For future reference, here is a hint as to how to debug problems like this,
and a cleaner way to write the code.
Seymore4Head wrote:
> On Sat, 30 Aug 2014 13:48:09 -0500, Tim Chase
> <python.list@tim.thechases.com> wrote:
>>> if e[0].isupper == False:
>>> print ("False")
>>> if e[0].isupper == True:
>>> print ("True")
[...]
>>There's a difference between e[0].isupper which refers to the method
>>itself, and e[0].isupper() which then calls that method. Call the
>>method, and you should be good to go.
>
> That works.
> Thanks
We've all done it. I think that anyone who tells you they've never forgotten
the brackets on a zero-argument function call is probably lying :-) And the
worst thing is that you can stare and stare and stare at the code for a
week and not see what's wrong.
Here are two suggestions for debugging difficult problems like this:
- Take a break, and look at it with fresh eyes. E.g. work on something
else for an hour or three, or go and have lunch.
- Use print() to see the intermediate results:
a = e[0].isupper
print(e[0], a, a == False, a == True)
You expect to see something like:
T True False True
but when you see:
T <built-in method isupper of str object at 0xb7d44820> False False
at least you will know *what* is going on, even if you're unsure of *why*.
Now, here is a better way to write your code. Since isupper() returns True
or False, there is no need to compare to True or False to get a boolean
value. It's already a boolean value! So we can write:
if not e[0].isupper():
print("False")
if e[0].isupper():
print("True")
or better still:
if e[0].isupper():
print("initial letter is upper case")
else:
print("initial letter is lower case")
(More descriptive messages are better than cryptic messages.)
--
Steven
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-08-31 19:16 +1000 |
| Message-ID | <mailman.13660.1409476577.18130.python-list@python.org> |
| In reply to | #77343 |
On Sun, Aug 31, 2014 at 6:37 PM, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > - Use print() to see the intermediate results: > > a = e[0].isupper > print(e[0], a, a == False, a == True) And I'll add to this: *Copy and paste* the original code to craft this output statement. I recently was trying to figure out a problem, and retyped to create the output statements... and I didn't make the same typo, so it worked fine. For some reason, my eye didn't notice the error, and I couldn't understand why the intermediate results were correct and the overall result was wrong. (And no, it wasn't the kind of 'wrong' that results in a nice tidy exception. It just resulted in wrong results.) ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Grant Edwards <invalid@invalid.invalid> |
|---|---|
| Date | 2014-09-02 16:43 +0000 |
| Message-ID | <lu4s2t$sgd$2@reader1.panix.com> |
| In reply to | #77323 |
On 2014-08-30, Tim Chase <python.list@tim.thechases.com> wrote:
> On 2014-08-30 14:27, Seymore4Head wrote:
>> I really tried to get this without asking for help.
>>
>> mylist = ["The", "earth", "Revolves", "around", "Sun"]
>> print (mylist)
>> for e in mylist:
>>
>> # one of these two choices should print something. Since neither
>> does, I am missing something subtle.
>>
>> if e[0].isupper == False:
>> print ("False")
>> if e[0].isupper == True:
>> print ("True")
>>
>> I am sure in the first , third and fifth choices should be true.
>> Right now, I am just testing the first letter of each word.
>
> There's a difference between e[0].isupper which refers to the method
> itself, and e[0].isupper() which then calls that method. Call the
> method, and you should be good to go.
I missed the beginning of the thread, but Why are you comparing things
to True and False?
What you should do is
if not e[0].isupper():
asdf()
or
if e[0].isupper():
qwer()
--
Grant Edwards grant.b.edwards Yow! My vaseline is
at RUNNING...
gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Seymore4Head <Seymore4Head@Hotmail.invalid> |
|---|---|
| Date | 2014-09-02 12:59 -0400 |
| Message-ID | <mntb0apmtgqdcb19pu4q3aaa0b413hrov0@4ax.com> |
| In reply to | #77442 |
On Tue, 2 Sep 2014 16:43:09 +0000 (UTC), Grant Edwards
<invalid@invalid.invalid> wrote:
>On 2014-08-30, Tim Chase <python.list@tim.thechases.com> wrote:
>> On 2014-08-30 14:27, Seymore4Head wrote:
>>> I really tried to get this without asking for help.
>>>
>>> mylist = ["The", "earth", "Revolves", "around", "Sun"]
>>> print (mylist)
>>> for e in mylist:
>>>
>>> # one of these two choices should print something. Since neither
>>> does, I am missing something subtle.
>>>
>>> if e[0].isupper == False:
>>> print ("False")
>>> if e[0].isupper == True:
>>> print ("True")
>>>
>>> I am sure in the first , third and fifth choices should be true.
>>> Right now, I am just testing the first letter of each word.
>>
>> There's a difference between e[0].isupper which refers to the method
>> itself, and e[0].isupper() which then calls that method. Call the
>> method, and you should be good to go.
>
>I missed the beginning of the thread, but Why are you comparing things
>to True and False?
>
>What you should do is
>
> if not e[0].isupper():
> asdf()
>
>or
>
> if e[0].isupper():
> qwer()
I wasn't really comparing it to True. I was trying to use it as a
line of code, but since it wasn't working I just tried that to test
it.
Since neither one was working, I knew something was wrong.
BTW I am very new to Python.
Thanks
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2014-09-03 11:44 +1000 |
| Message-ID | <5406726f$0$6512$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #77442 |
Grant Edwards wrote:
> I missed the beginning of the thread, but Why are you comparing things
> to True and False?
I don't understand why people do it, but it's *incredibly* common. A couple
of weeks ago at work, I had to (gently, in a friendly manner) mock one of
our most senior and accomplished developers for doing exactly that. He was
suitably chagrined :-)
And then I wondered back to my desk and promptly found myself doing the same
thing :-(
I think it may have something to do with the linguistic idiom in English
where we distinguish between logical statements and logical statements
about logical statements for emphasis. E.g., suppose we have a syllogism:
Plato is a mortal.
All mortals must eat.
Therefore Plato must eat.
and we wanted to analyse it, we might say something like:
Given the undeniable truth that Plato is, in fact, a mortal, then
if the statement `all mortals must eat` is true [i.e. is a true
statement], then `Plato must eat` likewise is true.
to emphasis that we are making a statement about the truth of the statement
`all mortals must eat`.
I'm not suggesting that this is the only way to talk about the truth or
falsity of statements in English, but it is a very common one:
https://www.google.com.au/search?q=%22if+*+is+true%22
--
Steven
[toc] | [prev] | [next] | [standalone]
| From | Rustom Mody <rustompmody@gmail.com> |
|---|---|
| Date | 2014-09-02 20:14 -0700 |
| Message-ID | <4af60c7a-f4d6-4aa7-b181-fe768ea6f731@googlegroups.com> |
| In reply to | #77460 |
On Wednesday, September 3, 2014 7:14:14 AM UTC+5:30, Steven D'Aprano wrote: > Grant Edwards wrote: > > I missed the beginning of the thread, but Why are you comparing things > > to True and False? > I don't understand why people do it, but it's *incredibly* common. A couple > of weeks ago at work, I had to (gently, in a friendly manner) mock one of > our most senior and accomplished developers for doing exactly that. He was > suitably chagrined :-) > And then I wondered back to my desk and promptly found myself doing the same > thing :-( Logically the boolean domain is a domain over which the natural algebra is boolean algebra, just like there are arithmetic operators over numbers, string operators over strings etc. Intuitively its a different story. Booleans as an (algebraically manipulable) domain is just plain weird. Not sure why... Perhaps because it reifies the structure of our more intimate thinking more than the other domains? Also as you point out, language probably has much to do with it. Dijkstra used to point out A ∧ (B ∨ C) ≡ (A ∧ B) ∨ (A ∧ C) A ∨ (B ∧ C) ≡ (A ∨ B) ∧ (A ∨ C) look normal enough in this form Put then into the way engineers do it and they become A(B + C) = AB + AC A + BC = (A+B)(A+C) and Dijkstra would (gleefully!) point out that the engineers were much more unfamiliar/uneasy with the second than the first. In effect the perfect symmetry of the boolean operators get marred in our intuition when we use poor notation.
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve@pearwood.info> |
|---|---|
| Date | 2014-09-03 07:16 +0000 |
| Message-ID | <5406c052$0$29876$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #77464 |
On Tue, 02 Sep 2014 20:14:51 -0700, Rustom Mody wrote: > Dijkstra > used to point out > > A ∧ (B ∨ C) ≡ (A ∧ B) ∨ (A ∧ C) A ∨ (B ∧ C) ≡ (A ∨ B) ∧ (A ∨ C) look > normal enough in this form > > Put then into the way engineers do it and they become A(B + C) = AB + AC > A + BC = (A+B)(A+C) o_O Who uses + for disjunction (∨ OR) and concatenation for conjunction (∧ AND)? That's crazy notation. -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Marko Rauhamaa <marko@pacujo.net> |
|---|---|
| Date | 2014-09-03 10:44 +0300 |
| Message-ID | <87a96hcfml.fsf@elektro.pacujo.net> |
| In reply to | #77468 |
Steven D'Aprano <steve@pearwood.info>: > Who uses + for disjunction (∨ OR) and concatenation for conjunction (∧ > AND)? That's crazy notation. That's the classic Boolean algebraic notation. In basic algebra, the two interesting operations are "addition" and "multiplication". Boolean math works like elementary arithmetics, with the exception that 1 + 1 = 1 I'm guessing the modern symbols ∨ and ∧ were derived from the set-theoretical analogues, ∪ and ∩, which were also formerly used for the same purpose. Marko
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2014-09-04 11:54 +1000 |
| Message-ID | <5407c63c$0$29967$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #77472 |
Marko Rauhamaa wrote:
> Steven D'Aprano <steve@pearwood.info>:
>
>> Who uses + for disjunction (∨ OR) and concatenation for conjunction (∧
>> AND)? That's crazy notation.
>
> That's the classic Boolean algebraic notation.
Says who? (Apart from you, obviously :-) Since when? I've never seen it in
*any* discussion of Boolean algebra.
Since I answer my own question below (spoiler: George Boole), my questions
are rhetorical.
Mathworld says:
A Boolean algebra is a mathematical structure that is
similar to a Boolean ring, but that is defined using
the meet and join operators instead of the usual
addition and multiplication operators.
and lists the operators as:
^ (logical AND, or "wedge") and v (logical OR, or "vee")
http://mathworld.wolfram.com/BooleanAlgebra.html
Wikipedia lists the operators as
And (conjunction), denoted x∧y (sometimes x AND y or Kxy)
Or (disjunction), denoted x∨y (sometimes x OR y or Axy)
https://en.wikipedia.org/wiki/Boolean_algebra#Operations
So it seems that mathematicians have all but entirely abandoned the old
notation, although they are certainly aware that x∧y is analogous to xy
with both x, y elements of {0, 1}, and similarly for x∨y, although the
analogy is terrible for ∨. 1+1 = 2, not 1. If you perform the addition
modulo 2, then 1+1 = 0, which would make + analogous to XOR, not OR.
I had to go all the way back to George Boole's seminal work "An
Investigation Of The Laws Of Thought" in 1854 to find somebody using that
notation, and he had an excuse, namely he was inventing the subject.
http://gutenberg.org/ebooks/15114
Since Boole isn't with us any more, having died in 1864, my question still
stands: who would be so foolish to use this notation in the 21st century?
Answer: engineers.
http://www.allaboutcircuits.com/vol_4/chpt_7/2.html
--
Steven
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-09-04 12:03 +1000 |
| Message-ID | <mailman.13753.1409796188.18130.python-list@python.org> |
| In reply to | #77516 |
On Thu, Sep 4, 2014 at 11:54 AM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> although the
> analogy is terrible for ∨. 1+1 = 2, not 1.
I wouldn't say terrible. Unclear perhaps, but functional. Try this exercise:
false, true = 0, 1 # or use an old Python
if true + true:
print("true OR true is true")
As long as you accept that any non-zero value is true, and as long as
'and' and 'or' are the only operations you use (you can add 'not' as
long as it's defined the same way: "false if x else true"), addition
for or works fine.
ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Rustom Mody <rustompmody@gmail.com> |
|---|---|
| Date | 2014-09-03 19:23 -0700 |
| Message-ID | <8ca0209e-42a8-4a0b-b91a-27fd3670a275@googlegroups.com> |
| In reply to | #77516 |
On Thursday, September 4, 2014 7:24:19 AM UTC+5:30, Steven D'Aprano wrote: > Marko Rauhamaa wrote: > > Steven D'Aprano: > >> Who uses + for disjunction (∨ OR) and concatenation for conjunction (∧ > >> AND)? That's crazy notation. > > That's the classic Boolean algebraic notation. > Says who? (Apart from you, obviously :-) Since when? I've never seen it in > *any* discussion of Boolean algebra. There are the mathematician/logicians who do boolean algebra (usually as part of lattice theory). They usually use ∧ ∨ ¬ The guys who (ab)use the add/multiply notations of school algebra are the electronics books — Karnaugh maps, minimization all that stuff. One or two pages of truth tables, some of this add/mul notation and then on its all the standard logic-circuit diagrams for combinational and sequential circuits.
[toc] | [prev] | [next] | [standalone]
| From | Marko Rauhamaa <marko@pacujo.net> |
|---|---|
| Date | 2014-09-04 08:36 +0300 |
| Message-ID | <87mwagkkuv.fsf@elektro.pacujo.net> |
| In reply to | #77516 |
Steven D'Aprano <steve+comp.lang.python@pearwood.info>: > Marko Rauhamaa wrote: >> That's the classic Boolean algebraic notation. > > Says who? (Apart from you, obviously :-) Since when? I've never seen > it in *any* discussion of Boolean algebra. I have only run into George Boole, Boolean algebra and booleans in engineering textbooks (digital electronics, software programming). IIRC, they *always* used the multiplication and addition symbols. When studying symbolic logic, I never ran into that notation or Boole or Boolean algebra or booleans. For example, ∧ and ∨ are called connectors instead of operations. IOW, they are symbols of a language instead of functions. Marko
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2014-09-04 11:17 +0000 |
| Message-ID | <lu9hng$glf$1@dont-email.me> |
| In reply to | #77468 |
On Wed, 03 Sep 2014 07:16:34 +0000, Steven D'Aprano wrote: > Who uses + for disjunction (∨ OR) and concatenation for conjunction (∧ > AND)? That's crazy notation. The way I was taught it in the mid 1980s, a.b === a and b, a+b === a or b. -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-09-04 21:42 +1000 |
| Message-ID | <mailman.13765.1409830979.18130.python-list@python.org> |
| In reply to | #77542 |
On Thu, Sep 4, 2014 at 9:17 PM, Denis McMahon <denismfmcmahon@gmail.com> wrote: > On Wed, 03 Sep 2014 07:16:34 +0000, Steven D'Aprano wrote: > >> Who uses + for disjunction (∨ OR) and concatenation for conjunction (∧ >> AND)? That's crazy notation. > > The way I was taught it in the mid 1980s, a.b === a and b, a+b === a or b. The middle dot is another notation for multiplication, as is abuttal (not actually concatenation, in this context). So they're all saying the same thing: boolean 'and' is multiplication, boolean 'or' is addition. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2014-09-05 02:53 +0000 |
| Message-ID | <lub8io$glf$3@dont-email.me> |
| In reply to | #77543 |
On Thu, 04 Sep 2014 21:42:56 +1000, Chris Angelico wrote: > On Thu, Sep 4, 2014 at 9:17 PM, Denis McMahon <denismfmcmahon@gmail.com> > wrote: >> On Wed, 03 Sep 2014 07:16:34 +0000, Steven D'Aprano wrote: >> >>> Who uses + for disjunction (∨ OR) and concatenation for conjunction (∧ >>> AND)? That's crazy notation. >> >> The way I was taught it in the mid 1980s, a.b === a and b, a+b === a or >> b. > > The middle dot is another notation for multiplication, as is abuttal > (not actually concatenation, in this context). So they're all saying the > same thing: boolean 'and' is multiplication, boolean 'or' is addition. Yes Chris, I know that. I was responding to Stephen's statement that using + for or was crazy notation, and pointing out that 30 years ago, that's what UK colleges were teaching! -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.python
csiph-web