Skip to content

Instantly share code, notes, and snippets.

@zygiss
Created July 19, 2023 20:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zygiss/c3ddeb0729a7de3bc20be25bf23b11e6 to your computer and use it in GitHub Desktop.
Save zygiss/c3ddeb0729a7de3bc20be25bf23b11e6 to your computer and use it in GitHub Desktop.
Usage of `iff` in Python
PC/pyconfig.h
334:/* configure.ac defines HAVE_LARGEFILE_SUPPORT iff
Python/dtoa.c
1428: /* Skip leading zeros: lz is true iff there were leading zeros. */
1497: /* Skip zeros. lz is true iff there are leading zeros. */
Objects/obmalloc.c
1272:Subtracting B throughout, this is true iff
Objects/listobject.c
1146: error. Else "k" is set to true iff X<Y, and an "if (k)" block is
Objects/codeobject.c
114:/* all_name_chars(s): true iff s matches [a-zA-Z0-9_]* */
Python/instrumentation.c
1310: /* Set original_opcode to the opcode iff the instruction
Doc/includes/ndiff.py
54:# open two files & spray the diff to stdout; return false iff a problem
69:# return false iff a problem
Objects/longobject.c
2200: * base B digit iff _PyLong_DigitValue[Py_CHARPyLong_MASK(c)] < B.
4270: round up iff the most significant of the extra bits is 1, and
4780: ++num_table_entries; /* incremented iff MULT succeeded */
Objects/abstract.c
2218: int wrapped; /* for PY_ITERSEARCH_INDEX, true iff n wrapped around */
Tools/patchcheck/reindent.py
185: # Note that a line is all-blank iff it's "\n".
Doc/library/doctest.rst
1445: iff the command-line switch ``-v`` is used.
1547: Return ``True`` iff the actual output from an example (*got*) matches the
Lib/urllib/request.py
2555: Return True iff this host shouldn't be accessed using a proxy
Lib/_pydecimal.py
1706: # overflow: exp_min > Etop iff self.adjusted() > Emax
2105: # (2) must apply. Now |y| < 1/nbits(xc) iff |yc|*nbits(xc) <
2106: # 10**-ye iff len(str(|yc|*nbits(xc)) <= -ye.
2344: # result has sign 1 iff self._sign is 1 and other is an odd integer
Lib/wave.py
241: _fmt_chunk_read -- 1 iff the FMT chunk has been read
242: _data_seek_needed -- 1 iff positioned correctly in audio
Lib/xml/dom/minidom.py
296: # return True iff node is part of a document tree
1178: doc="True iff this text node contains only whitespace"
1520: """Returns true iff this element is declared to have an EMPTY
1525: """Returns true iff the named attribute is a DTD-style ID."""
1529: """Returns true iff the identified attribute is a DTD-style ID."""
Lib/tabnanny.py
156: # n.indent_level(t) for all t >= 1 iff m.norm == n.norm.
158: # true iff raw[:n] is of the form (T*)(S*)
210: # return true iff self.indent_level(t) == other.indent_level(t)
230: # Return True iff self.indent_level(t) < other.indent_level(t)
239: # form (T*)(S*), M.less(N) iff M.len() < N.len() and
242: # Note that M is of the form (T*)(S*) iff len(M.norm[0]) <= 1.
Lib/_pyio.py
467: """closed: bool. True iff the file has been closed.
Lib/test/test_long.py
106: # round-half-to-even: fractional part is r/b, which is > 0.5 iff
107: # 2*r > b, and == 0.5 iff 2*r == b.
Lib/test/test_pyclbr.py
28: ''' succeed iff {l1} - {ignore} == {l2} - {ignore} '''
35: ''' succeed iff hasattr(obj,attr) or attr in ignore. '''
43: ''' succeed iff key in obj or key in ignore. '''
50: ''' succeed iff a == b or a in ignore or b in ignore '''
55: ''' succeed iff pyclbr.readmodule_ex(modulename) corresponds
Lib/test/test_doctest.py
920:iff `-v` appears in sys.argv:
Lib/test/test_buffer.py
435:# in full generality. A structure is valid iff it fits in the
Lib/test/test_set.py
2039: with two vertices being adjacent iff the corresponding
Lib/test/test_codeop.py
14: '''succeed iff str is a valid piece of code'''
19: '''succeed iff str is the start of a valid piece of code'''
23: '''succeed iff str is the start of an invalid piece of code'''
Lib/test/test_complex.py
41: """Return true iff floats x and y "are close"."""
76: """Return true iff complexes x and y "are close"."""
Lib/test/test_hash.py
2:# iff a==b then hash(a)==hash(b)
Lib/test/test_minidom.py
732: # check the doctype iff the original DOM maintained it
Lib/email/_header_value_parser.py
1002: a flag that is True iff there were any quoted printables decoded.
2938: # RFC2231 encoding iff needed.
Lib/sysconfig.py
179:# True iff _CONFIG_VARS has been fully initialized.
Lib/difflib.py
124: function that takes a sequence element and returns true iff the
170: # returning true iff the element is "junk" -- this has
817: and return true iff the string is junk. The module-level function
953: # a[best_i] very similar to b[best_j]; eqi is None iff they're not
1047: Return True for ignorable line: iff `line` is blank or contains a single '#'.
1063: Return True for ignorable character: iff `ch` is a space or tab.
1311: return true iff the string is junk. The default is None, and is
1316: 1), and returns true iff the character is junk. The default is
Lib/_pydatetime.py
2588:# So z' is UTC-equivalent to x iff z'.d = z.d at this point. If they are equal,
Lib/doctest.py
630: # A callable returning a true value iff its argument is a blank line
1218: only failures if false; by default, it's true iff '-v' is in
1605: Return True iff the actual output from an example (`got`)
1918: only failures if false; by default, it's true iff "-v" is in sys.argv.
2031: only failures if false; by default, it's true iff "-v" is in sys.argv.
Lib/idlelib/pyparse.py
145: This will be reliable iff given a reliable is_char_in_string()
Modules/_pickle.c
2230: * needed. This is so iff the MSB is all redundant sign
Lib/idlelib/editor.py
1287: # Return true iff colorizer hasn't (re)gotten this far
Lib/numbers.py
195: * i > 0 iff self > 0;
Modules/_testcapi/vectorcall.c
249:Return true iff Py_TPFLAGS_HAVE_VECTORCALL is set on the class.
Lib/trace.py
393: @param count true iff it should count number of times each
395: @param trace true iff it should print out each line that is
397: @param countfuncs true iff it should just output a list of
407: @param timing true iff timing information be displayed
Lib/fileinput.py
17:line number in the current file; isfirstline() returns true iff the
19:iff the line was read from sys.stdin. Function nextfile() closes the
Modules/socketmodule.c
2756:/* Return true iff msg->msg_controllen is valid, cmsgh is a valid
Modules/_testcapi/clinic/vectorcall.c.h
184:"Return true iff Py_TPFLAGS_HAVE_VECTORCALL is set on the class.");
Modules/_decimal/libmpdec/mpdecimal.c
3917: * 1 / b_coeff' is exact iff b_coeff' exclusively has prime factors 2 or 5.
5047: * 1) log10(x) < 0 iff adjexp(x) < 0
5201: * 1) log10(x) < 0 iff adjexp(x) < 0
Modules/_datetimemodule.c
148:/* k = i+j overflows iff k differs in sign from both inputs,
149: * iff k^i has sign bit set and k^j has sign bit set,
150: * iff (k^i)&(k^j) has sign bit set.
1101:/* Create a timedelta instance. Normalize the members iff normalize is
7069:So z' is UTC-equivalent to x iff z'.d = z.d at this point. If they are equal,
Lib/html/entities.py
1030: 'iff;': '\u21d4',
Include/pyport.h
66:Meaning: To be defined iff i>>j does not extend the sign bit when i is a
Misc/HISTORY
13344: attribute that is True iff there are uncommitted changes.
21691: True iff the current Python has IPv6 support. See SF patch #658327.
27549: - New symbol USE_GETHOSTBYNAME_LOCK defined iff the lock should be used.
30197:the first argument and returns true iff first is second, or is a
30199:and returns true iff first is an instance of the second, or any
30665:iff -O is not specified). With -O, no code is generated for assert
Mac/BuildScript/build-installer.py
401: Return True iff the default Xcode version can use PGO and LTO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment