Skip to content

Instantly share code, notes, and snippets.

@jangia
Created December 28, 2020 21:52
Show Gist options
  • Save jangia/767f1cb5cbe94e666ce2f6d02cfc171c to your computer and use it in GitHub Desktop.
Save jangia/767f1cb5cbe94e666ce2f6d02cfc171c to your computer and use it in GitHub Desktop.
SRP violated
import datetime
class User:
def __init__(self, username, banned_until):
self.username = username
self.banned_until = banned_until
def save(self):
print('I am saving to PostgreSQL')
def ban(self):
self.banned_until = datetime.datetime.today() + datetime.timedelta(days=7)
def charge(self):
print('Charge credit card of user using Stripe')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment