Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #70554

Re: Moving to an OOP model from an classically imperitive one

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python@mrabarnett.plus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'repository': 0.05; 'string': 0.09; 'oop': 0.09; 'url:github': 0.09; 'def': 0.12; 'attributes:': 0.16; 'dictionary.': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'identifier.': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'obviously,': 0.16; 'received:192.168.1.4': 0.16; 'subject:OOP': 0.16; 'tuple': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'written': 0.21; 'header:User- Agent:1': 0.23; 'manager.': 0.24; 'replace': 0.24; "i've": 0.25; 'source': 0.25; 'define': 0.26; 'pass': 0.26; 'certain': 0.27; 'defined': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'program,': 0.31; 'code': 0.31; 'class': 0.32; 'run': 0.32; 'subject:from': 0.34; 'could': 0.34; 'something': 0.35; 'there': 0.35; 'subject:one': 0.36; 'possible': 0.36; 'example,': 0.37; 'two': 0.37; 'to:addr:python-list': 0.38; 'files': 0.38; 'does': 0.39; 'moving': 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'new': 0.61; 'simple': 0.61; 'email addr:gmail.com': 0.63; 'name': 0.63; 'such': 0.63; 'combining': 0.68; 'subject:Moving': 0.84; 'url:master': 0.84
X-CM-Score 0.00
X-CNFS-Analysis v=2.1 cv=ZphjKrLG c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=tLkI8qN_j18A:10 a=F4yUQISD6U4A:10 a=ihvODaAuJD4A:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=pGLkceISAAAA:8 a=xVGdyC2wAAAA:8 a=NEAV23lmAAAA:8 a=QcP5zVPQDZi_R2H2T4IA:9 a=QEXdDO2ut3YA:10 a=MSl-tDqOz04A:10 a=oPp87nXtMccA:10
X-AUTH mrabarnett:2500
Date Thu, 24 Apr 2014 00:08:27 +0100
From MRAB <python@mrabarnett.plus.com>
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Moving to an OOP model from an classically imperitive one
References <80a82415-fc67-4ccf-8827-27a0ba5459b7@googlegroups.com>
In-Reply-To <80a82415-fc67-4ccf-8827-27a0ba5459b7@googlegroups.com>
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.9472.1398294517.18130.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1398294517 news.xs4all.nl 2929 [2001:888:2000:d::a6]:57854
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:70554

Show key headers only | View raw


On 2014-04-23 21:57, tim.thelion@gmail.com wrote:
> Hello,
>
> I am currently writting a program called subuser(subuser.org), which
> is written as classically imperative code.  Subuser is, essentially,
> a package manager.  It installs and updates programs from
> repositories.
>
> I have a set of source files
> https://github.com/subuser-security/subuser/tree/master/logic/subuserCommands/subuserlib
> which have functions in them.  Each function does something to a
> program, it identifies the program by the programs name.  For
> example, I have an installProgram function defined as such:
>
> def installProgram(programName, useCache):
>
> Now I've run into a flaw in this model.  There are certain situations
> where a "programName" is not a unique identifier. It is possible for
> two repositories to each have a program with the same name.
> Obviously, I could go through my code and replace all use of the
> string "programName" with a tuple of (programName, repository).  Or I
> could define a new class with two attributes: programName and
> repository, and pass such a simple object arround, or pass a
> dictionary.  However, I think this would be better solved by moving
> fully to an OOP model.  That is, I would have a SubuserProgram class
> which had methods such as "install", "describe", "isInstalled"...
>
[snip]
Could you make the program name unique just by combining it with the
repository name in a single string?

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Moving to an OOP model from an classically imperitive one tim.thelion@gmail.com - 2014-04-23 13:57 -0700
  Re: Moving to an OOP model from an classically imperitive one Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-04-23 22:15 +0100
  Re: Moving to an OOP model from an classically imperitive one Ian Kelly <ian.g.kelly@gmail.com> - 2014-04-23 15:23 -0600
    Re: Moving to an OOP model from an classically imperitive one Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-04-24 12:26 +1200
  Re: Moving to an OOP model from an classically imperitive one Ethan Furman <ethan@stoneleaf.us> - 2014-04-23 14:42 -0700
    Re: Moving to an OOP model from an classically imperitive one tim.thelion@gmail.com - 2014-04-24 00:32 -0700
  Re: Moving to an OOP model from an classically imperitive one MRAB <python@mrabarnett.plus.com> - 2014-04-24 00:08 +0100
    Re: Moving to an OOP model from an classically imperitive one tim.thelion@gmail.com - 2014-04-24 00:21 -0700
      Re: Moving to an OOP model from an classically imperitive one Chris Angelico <rosuav@gmail.com> - 2014-04-24 17:36 +1000
      Re: Moving to an OOP model from an classically imperitive one Steven D'Aprano <steve@pearwood.info> - 2014-04-24 09:08 +0000
  Re: Moving to an OOP model from an classically imperitive one Chris Angelico <rosuav@gmail.com> - 2014-04-24 09:12 +1000
  Re: Moving to an OOP model from an classically imperitive one Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-04-24 12:21 +1200
    Re: Moving to an OOP model from an classically imperitive one tim.thelion@gmail.com - 2014-04-24 09:53 -0700
      Re: Moving to an OOP model from an classically imperitive one Amirouche Boubekki <amirouche.boubekki@gmail.com> - 2014-04-25 19:21 +0200
  Re:Moving to an OOP model from an classically imperitive one Dave Angel <davea@davea.name> - 2014-04-23 22:01 -0400

csiph-web