> [Guido] > > Um, the notation is '|' and '&', not 'or' and 'and', and those are > > what I learned in school. Seems pretty conventional to me (Greg > > Wilson actually tried this out on unsuspecting newbies and found that > > while '+' worked okay, '*' did not -- read the PEP). [Tim] > FYI, kjbuckets uses '+' (union) and '&' (intersection). '*' is used for FTI, ISETL uses '+' and '*' as synonyms for the spelled-out 'inter' and 'union' operators. Playing with a sample session for possible inclusion in the tutorial, I've found that '|' is not nearly as clear in its intention as '+'. Raymond Hettinger ------------------------------------------------------------------- from sets import Set engineers = Set(['John', 'Jane', 'Jack', 'Janice']) programmers = Set(['Jack', 'Sam', 'Susan', 'Janice']) management = Set(['Jane', 'Jack', 'Susan', 'Zack']) employees = engineers | programmers | management # more clear with '+' engineering_management = engineers & programmers fulltime_management = management - engineers - programmers engineers.add('Marvin') print engineers, 'Look, Marvin was added' print employees.issuperset(engineers), 'There is a problem' print employees, 'Hmm, employees needs an update' employees.update(engineers) print employees, 'Looks fine now' for group in [engineers, programmers, management, employees]: group.discard('Susan') print group
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4