For educational reasons I've decided to create my own CA. Here is what I learned.
Lets get some context first.
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
from django.db import models, migrations | |
class Migration(migrations.Migration): | |
dependencies = [ | |
('spigot', '0034_hydrated_connection_view_v2'), |
using DYMO.Label.Framework; | |
namespace ConsoleApp1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Printers printers = new Printers(); | |
I absolutely love using operator overrides in low-level objects because it can make the caller's use case WAY more intuitive. There are certainly some pitfalls though.
__getitem__
and __setitem__
to make an object more dictionary-like, make sure to also override __iter__
OR __contains__
since they're called to handle membership tests like in
and not in
. (ref: https://docs.python.org/3/reference/expressions.html#membership-test-operations)Enums can be a little tedious in Python, but there are a few things I try to do to streamline usage:
I hereby claim:
To claim this, I am signing this object: