Path: csiph.com!usenet.pasdenom.info!news.franciliens.net!fdn.fr!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'beer': 0.05; 'explicitly': 0.05; 'correct.': 0.07; 'defines': 0.09; 'sure,': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'def': 0.12; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hierarchy,': 0.16; 'old-style': 0.16; 'sorts': 0.16; 'subclass': 0.16; 'subject:hotel': 0.16; 'substitution': 0.16; 'write.': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'else,': 0.19; 'input': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'helpful': 0.24; 'cc:2**0': 0.24; 'class.': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'url:wiki': 0.31; 'usually': 0.31; 'everywhere': 0.31; 'url:wikipedia': 0.31; 'class': 0.32; 'this.': 0.32; 'quite': 0.32; 'advice': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'doing': 0.36; 'url:org': 0.36; 'too': 0.37; 'project': 0.37; 'pm,': 0.38; 'rather': 0.38; 'extremely': 0.39; 'though,': 0.39; 'sure': 0.39; 'system.': 0.39; 'hotel': 0.61; "you're": 0.61; 'first': 0.61; 'provide': 0.64; 'different': 0.65; 'management': 0.65; 'wish': 0.70; 'carefully': 0.74; 'special': 0.74; 'age': 0.80; 'bar:': 0.84; 'object:': 0.84; 'subject:system': 0.84; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=soi5FWMV+clH+9qky+++dAEUb7d6dfj1PuDh+opID3o=; b=yDU/U5ndryOA8wCp0Tz13I+5cUXD3sOusmyzlZNCrI3JKOzX9P0TJyHdP4wNlz6Ixq dEx430SZ5TIHTD7n99UXBM3gdhos4FTVXnAPx9D+9k/eMmaiJ+pm7rKX7mVePQOTFrzA tmt74FrlQFI4WZ0e19D+48pOwOT0ri/mTppCSdV7QKalB0yUMd0PeJfMSaYEFq56/3TI PkdT6SvVEA9wHZ0R+cSAFxqD2JyqJNURh9HdFYlY0Zd/05Tp31ThFEJlWnsz/pz4NhFp AzM1S57Q8HRN4SlETCerfdN3A57PqwrX5SAqgPRpHCptm1RUHN16AjrySAvL3a6zv1yk XYDA== MIME-Version: 1.0 X-Received: by 10.43.171.6 with SMTP id ns6mr1924135icc.61.1414480176205; Tue, 28 Oct 2014 00:09:36 -0700 (PDT) In-Reply-To: <3f10c652-9d9d-4353-b24f-939d21978998@googlegroups.com> References: <3f10c652-9d9d-4353-b24f-939d21978998@googlegroups.com> Date: Tue, 28 Oct 2014 18:09:36 +1100 Subject: Re: hotel management system From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1414480185 news.xs4all.nl 2955 [2001:888:2000:d::a6]:47330 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:79825 On Tue, Oct 28, 2014 at 5:42 PM, ngangsia akumbo wrote: > Please can someone look at my code and may be advice and may be help me with some correction. I have been learning python for some time now. This is my first project i wish to write. A hotel management system. > > > http://pastebin.com/LMHmuTiC > Sure, we can do code reviews! It's usually helpful to provide your code in-line, though, rather than linking to pastebin. You're using Python 2, as evidenced by the print statements. So don't do this, ever: > def emp_age(): > """displaying employees age""" > > age = input("Enter age: ") The input function is extremely dangerous. Everywhere else, you use raw_input, which is correct. > class Bar: This is an old-style class. It's better to explicitly subclass object: class Bar(object): > class Beer(Bar): Not sure why you're doing this. Firstly, you never use your Beer class... but secondly, your Beer isn't a special type of Bar, it's a quite different thing. When you subclass, it's usually helpful to follow the Liskov Substitution Principle: https://en.wikipedia.org/wiki/Liskov_substitution_principle Think carefully about your class hierarchy, because it defines all sorts of things about your code. Be sure you're happy with it before you code up too much else. ChrisA