Skip to content

Instantly share code, notes, and snippets.

@DavidEGx
Last active July 23, 2019 13:30
Show Gist options
  • Save DavidEGx/0dd7d84e23477a91797351e013e7e0fa to your computer and use it in GitHub Desktop.
Save DavidEGx/0dd7d84e23477a91797351e013e7e0fa to your computer and use it in GitHub Desktop.
Perl Python cheatsheet
+-------------------------------------------------------------------------------------------------------------------------------+
| Feature Perl Python |
+-------------------------------------------------------------------------------------------------------------------------------+
| Documentation perlpod docstrings |
| check doc perldoc MODULE class.__doc__ |
| Filter grep { COND } @array [ x for x in list if COND ] |
| Format strings "x: $x" "x: {}".format(x) |
| "x: {x}" |
| Formatter perltidy black |
| autopep8 |
| yapf |
| Iteration |
| next next continue |
| break last break |
| range for my $i (0..10) { CODE } for i in range(0, 11): |
| key-value while (my ($k, $v) = each %hash { CODE } for k, v in dict.items(): |
| get idx for idx, val in enumerate(list): |
| Linter perl -c -w flake8 |
| perlcritic |
| Map map { CODE } @array [ CODE for x in list ] |
| Modules/packages www.metacpan.org pypi.org |
| management cpanm pip |
| ORM DBIx::Class SQLAlchemist |
| REPL perlconsole python3 |
| Jupyter + Devel::IPerl Jupyter |
| Devel::REPL |
| Print structures Data::Dumper pprint |
| Static typing MyPy |
| Unit tests Test::Simple |
| Test::More |
| Test::Exception |
+-------------------------------------------------------------------------------------------------------------------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment