Snippet of AI instructions, available by calling `pyparsing.show_best_practices()` from Python
Example showing DeprecationWarning raised when calling pyparsing `parseString` instead of `parse_string`
TINY code example of a leap year determination function. Complete code: int is_divisible(int a, int b) { float quo := a / b; int iquo := quo; return quo = iquo; } int is_leap_year(int yr) { int div_by_400 := is_divisible(yr, 400); if div_by_400 then return 1; end int div_by_100 := is_divisible(yr, 100); if div_by_100 then return 0; end int div_by_4 := is_divisible(yr, 4); return div_by_4; } int main() { string s; int year; int this_year; read this_year; repeat read yr; if yr = "q" then return 0; end year := yr; is_leap := is_leap_year(year); write year; write " "; if is_leap then if year > this_year then write "will be"; elseif year < this_year then write "was"; else write "is"; end else if year > this_year then write "will not be"; elseif year < this_year then write "was not"; else write "is not"; end end write " a leap year"; write endl; until 0 }
This past weekend I pushed version 3.3.1 of pyparsing to PyPI (3.3.0 had a small but CI-stopping packaging blip). Includes AI instructions of pyparsing best practices. Deprecated camelCase names now throw DeprecatedWarnings. TINY teaching language parser+REPL
#PythonDevelopment #python #pyparsing