Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #109214
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Gerald Britton <gerald.britton@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Package setup best practice style question |
| Date | Sat, 28 May 2016 12:15:25 -0400 |
| Lines | 33 |
| Message-ID | <mailman.9.1464452134.1839.python-list@python.org> (permalink) |
| References | <CAPxRSnZKXLxx850ysMuOHxGs-E1oepCLta8YxGuO7+NHypJ7fg@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de dR0InFryFmzHaQHNozykWQJ7+9mFzNWgFszHLr7Klaog== |
| Return-Path | <gerald.britton@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.022 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; 'preference': 0.05; 'subject:question': 0.08; 'python': 0.10; '__init__.py': 0.16; 'better?': 0.16; 'practices.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'suppose': 0.22; 'leave': 0.23; 'this:': 0.23; 'import': 0.24; 'message-id:@mail.gmail.com': 0.27; 'about.': 0.29; "i'm": 0.30; 'skip:_ 10': 0.32; 'options': 0.33; 'class': 0.33; 'received:google.com': 0.35; 'should': 0.36; 'project': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'to:addr :python-list': 0.36; 'two': 0.37; 'method': 0.37; 'received:209': 0.38; 'feedback': 0.38; 'received:209.85.214': 0.39; 'url:in': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'linkedin': 0.66; 'add:': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to; bh=gsjmK6mHypMYBeCuS0SJTPf9Z+iFdFl5NsTVIyHMSbo=; b=WrpPuvA+Zu9TXRPInIF0MuZECY4L4Tn3G94GzdE/vAuP+RbBanoWJzgY+CVYFI+x3X xFHQ9PQsgTy3kdaL6gSfqeKHSJlgCicb1ASDfhIkYfPv1k00YYR1fXTChdIQRjGH4A19 W7ApyCSHWE8DEPf0jfNZhr2f541bq+s5kn//xHXitk3XSL6DA+D57tB+OBgNMRdMlU0A HxUL/yN9hGc0bqiLPP9TEWRe4wwaarDmluJGrjtgNZRmrGJ/R8Gpwq4F8Akm9RSH3Fsd ibIihoqqAQnJXAsHUWpkKZu1K7oOGGqKwTIg7I2J4W8OsZIQrFzlH8OlFf9lLLagHO0t P6CQ== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to; bh=gsjmK6mHypMYBeCuS0SJTPf9Z+iFdFl5NsTVIyHMSbo=; b=igrcHT5UAdXmLNGVhE149h3ohH8FlgXTleGpKhMITFeNVoihVuXpHOjjz4VoPFPbZp VlECHJUmeeqqrg4N3n6crezvKjljzcGDFN7tnSRH7h1YceOX8oJrqZEs9l+QX09eR5ve NLSywvDVCeOZ8sM8bPFQQ8a8L3d802NcOHo9Z17HySB+oKcerCeW+0Z8rT37cR2OBNgx V26keJWMTiRr/GCIVPhjO6DwPiAVnhbWvF1Ye/tave2Q3dN51qNWq5F0zRuhFx0jwSjz z6FAqctYyGs7uTiZJA/gIgoBmyTLxfTTj9fhqEiwgv5VV/3LVZhu9IOIkNvOwg5AwF7e MCrg== |
| X-Gm-Message-State | ALyK8tKB2/iCExhkVExMMx3icLk8GUNq/MvEQ5SnWaqpkZLRHNqweDITkFfD99XfVC1hOr34CX4PZd20gRBc3A== |
| X-Received | by 10.36.96.14 with SMTP id i14mr2996972itc.91.1464452125294; Sat, 28 May 2016 09:15:25 -0700 (PDT) |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.22 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.22 |
| 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> |
| X-Mailman-Original-Message-ID | <CAPxRSnZKXLxx850ysMuOHxGs-E1oepCLta8YxGuO7+NHypJ7fg@mail.gmail.com> |
| Xref | csiph.com comp.lang.python:109214 |
Show key headers only | View raw
suppose I have a simple python project setup like this:
Project diectory
prog.py
pkg directory
__init__.py
mod1.py
class A:
In order to have class A (unqualified) available from prog.py, there are a
few options that I know about. I'm currently considering two of them and
would like some feedback on best practices.
1. in pkg.__init__.py add:
from pkg.mod1 import A
in prog.py add:
from pkg import A
2. leave __init__.py empty
in prog.py add:
from pkg.mod1 import A
Is there a preference or best practice that would indicate to prefer method
1 or method 2? Are there methods 3, 4, 5, ... that I should consider that
are even better?
--
Gerald Britton, MCSE-DP, MVP
LinkedIn Profile: http://ca.linkedin.com/in/geraldbritton
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Package setup best practice style question Gerald Britton <gerald.britton@gmail.com> - 2016-05-28 12:15 -0400
Re: Package setup best practice style question Steven D'Aprano <steve@pearwood.info> - 2016-05-29 03:00 +1000
Re: Package setup best practice style question Steven D'Aprano <steve@pearwood.info> - 2016-05-29 13:02 +1000
csiph-web