All Projects → judy2k → stupid-python-tricks

judy2k / stupid-python-tricks

Licence: Unlicense license
Stupid Python tricks.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to stupid-python-tricks

twc
TypeScript based, boilerplate-less, Polymer toolbox friendly Polymer Modules
Stars: ✭ 33 (-70.54%)
Mutual labels:  decorators
futils
Utilities for generic functional programming
Stars: ✭ 21 (-81.25%)
Mutual labels:  decorators
soap-typescript
SOAP decorators for creating wsdl's and annotating services to provide metadata for node-soap
Stars: ✭ 20 (-82.14%)
Mutual labels:  decorators
flextool
C++ compile-time programming (serialization, reflection, code modification, enum to string, better enum, enum to json, extend or parse language, etc.)
Stars: ✭ 32 (-71.43%)
Mutual labels:  metaclass
realar
5 kB Advanced state manager for React
Stars: ✭ 41 (-63.39%)
Mutual labels:  decorators
type-arango
🥑 TypeArango manages ArangoDB collections, documents, relations and routes by taking advantage of TypeScript typings.
Stars: ✭ 55 (-50.89%)
Mutual labels:  decorators
socket.io-react
A High-Order component to connect React and Socket.io easily
Stars: ✭ 67 (-40.18%)
Mutual labels:  decorators
resty
A Node.js framework
Stars: ✭ 20 (-82.14%)
Mutual labels:  decorators
TvrboReact
Dream starter project: React, Redux, React Router, Webpack
Stars: ✭ 13 (-88.39%)
Mutual labels:  decorators
vue-corator
this is vue decorator utils
Stars: ✭ 33 (-70.54%)
Mutual labels:  decorators
serialize
Serializers for typescript based on decorators
Stars: ✭ 14 (-87.5%)
Mutual labels:  decorators
ts-test-decorators
Write your tests in a Java-like annotation-driven manner via JS decorators
Stars: ✭ 37 (-66.96%)
Mutual labels:  decorators
Python
covers python basic to advance topics, practice questions, logical problems in python, web development using html, css, bootstrap, jquery, DOM, Django 🚀🚀. 💥 🌈
Stars: ✭ 29 (-74.11%)
Mutual labels:  decorators
tsed
📐 Ts.ED is a Node.js and TypeScript framework on top of Express to write your application with TypeScript (or ES6). It provides a lot of decorators and guideline to make your code more readable and less error-prone.
Stars: ✭ 2,350 (+1998.21%)
Mutual labels:  decorators
drape
Drape – Reincarnation of Draper for Rails 5
Stars: ✭ 57 (-49.11%)
Mutual labels:  decorators
xml-core
xml-core is a set of classes that make it easier to work with XML within the browser and node.
Stars: ✭ 18 (-83.93%)
Mutual labels:  decorators
mocha-allure2-example
Allure 2 Mocha examples
Stars: ✭ 18 (-83.93%)
Mutual labels:  decorators
ta-json
Type-aware JSON serializer/parser
Stars: ✭ 67 (-40.18%)
Mutual labels:  decorators
koa-smart
A framework base on Koajs2 with Decorator, Params checker and a base of modules (cors, bodyparser, compress, I18n, etc…) to let you develop smart api easily
Stars: ✭ 31 (-72.32%)
Mutual labels:  decorators
typijs
The Angular CMS Framework for building fully-featured SPA sites powered by NodeJS and MongoDB with TypeScript
Stars: ✭ 141 (+25.89%)
Mutual labels:  decorators

Stupid Python Tricks

This is (or will be) a consolidated repository of all the stupid Python tricks I have written (and can still find).

A stupid python trick is usually an experiment with an advanced language feature; ostensibly to learn how it works, but usually in order to abuse that feature to write something truly horrible.

I used to be a Perl programmer.

I am also no longer the only person responsible for all of this.

fizz_buzz_abomination

This one got out of hand. It is an attempt to write Fizz Buzz, using as many language features as possible. It uses a bunch of functional techniques, a strategy pattern implementation, and dynamically named closures (I was especially proud of that).

It is PEP-8 compliant.

one_line_regex

A friend of mine used to complain that he couldn't run a regex as part of an if statement's expression if he wanted to use the returned groups (you can in Perl using implicit variables).

I worked out how to modify the caller's scope to dynamically add a variable containing the result of the pattern match. Mission accomplished.

Ish

Ish is a stupid library that allows you to test if a variable is tru-ish or false-ish. Ish has graduated to its own repository!

marge_simpson

I wanted to see if I could create an emoticon that was valid Python syntax. It turns out I could! OOO[:-P]

clever_path_ob

Subclass str, add a bunch of interesting properties and methods, and voila, easy path management, if a little bit too much voodoo.

Note: I'm not 100% sure I wrote this. Some of it doesn't seem like my style. It's possible I came up with inspiration from looking at someone else's code.

decorator_experiments

Contains an 'everlasting cache' (which is not very useful), and a (crazy) decorator-based dependency calling mechanism. Warning, may cause seizures!

stupid_metaclass_tricks

Only one trick! A metaclass that automatically replaces get_ and set_ methods with properties that call the methods. Too much magic, but a neat trick, I think.

super_considered_obligatory

Ever forget to call tearDown your test's superclass? Now you can ensure that any class inheriting fro you doesn't forget to call super().method implicitly.

If that's too much magic, there is also a decorator you can put on a method to ensure that we call super().

true_false

You've all heard of the classic #define TRUE FALSE trick in C, right?

gradually_worse_pi

Import this module, then import math and print out pi in a loop. I guarantee you'll be surprised!

autoargs

It's so tiresome writing constructors that copy all their arguments to self. Now you can just use this very clever @autoargs decorator, and all will be done for you!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].