Chris Nyland wrote at 2021-5-4 22:20 -0400:
> ...
>So for a while now I have taken to converting
>my module, in this example database.py, to the __init__.py of the package.
>I remember reading years back that having code in the __init__.py was bad
>practice but I can't reme
> Either of these still leaves a database.database namespace laying about and
> to me it just seems untidy. So for a while now I have taken to converting
> my module, in this example database.py, to the __init__.py of the package.
> So I was hoping to get
> feed back from a wider aud
naturally I make a package folder called database, put and empty
__init__.py, in goes my database module and all resource files. Here is
where I my primary design question comes in. As organized now as described
to import and use the package I need
from database import database
or I have to put in
On 26/04/19 11:14 AM, dieter wrote:
Arup Rakshit writes:
I am not able to call modules from lib folder in my test folder, but outside of
tests folder I can access them. How should I fix this?
Mocks$ tree .
.
├── lib
│ ├── __init__.py
│ ├── __pycache__
│ │ ├── __init__.cpython-37.pyc
Arup Rakshit writes:
> I am not able to call modules from lib folder in my test folder, but outside
> of tests folder I can access them. How should I fix this?
>
> Mocks$ tree .
> .
> ├── lib
> │ ├── __init__.py
> │ ├── __pycache__
> │ │
I am not able to call modules from lib folder in my test folder, but outside of
tests folder I can access them. How should I fix this?
Mocks$ tree .
.
├── lib
│ ├── __init__.py
│ ├── __pycache__
│ │ ├── __init__.cpython-37.pyc
│ │ └── product.cpython-37.pyc
│ └── product.py
oss-platform) project. On linux system, the imprts work
>> fine, but in windows I get imort error (I have no idea why. I tried searching
>> everywhere, but couldn't get it to work). Anyways, the issue seem to be
>> resolved by adding project directory to sys.path().
>>
&
esolved by adding project directory to sys.path().
>
> I wanted to know that can I use __init__.py file for adding a project
> directory to sys.path (sys.path.insert(0, directory))?
That is the wrong way to fix this problem. It might work, for a little while,
but then something w
ed to know that can I use __init__.py file for adding a project directory
to sys.path (sys.path.insert(0, directory))?
--
https://mail.python.org/mailman/listinfo/python-list
On Sat, Sep 24, 2016 at 9:32 PM, Brendan Abel <007bren...@gmail.com> wrote:
>> Splitting it up would make it slower to load.
>
> It's usually the opposite. When packages are split up, you only have to
> load the specific portions you need. Putting it all in a single module
> forces you to always
> Splitting it up would make it slower to load.
It's usually the opposite. When packages are split up, you only have to
load the specific portions you need. Putting it all in a single module
forces you to always load everything.
On Fri, Sep 23, 2016 at 11:59 PM, Lawrence D’Oliveiro <
lawrenced.
On Sat, 24 Sep 2016 04:59 pm, Lawrence D’Oliveiro wrote:
> On Saturday, September 24, 2016 at 2:11:09 PM UTC+12, Chris Angelico
> wrote:
>> It's a large and complex module, and about at the boundary of being
>> broken up a bit.
>
> Splitting it up would make it slower to load.
Would it? You've b
On Saturday, September 24, 2016 at 2:11:09 PM UTC+12, Chris Angelico wrote:
> It's a large and complex module, and about at the boundary of being
> broken up a bit.
Splitting it up would make it slower to load.
--
https://mail.python.org/mailman/listinfo/python-list
On Sat, Sep 24, 2016 at 11:42 AM, Lawrence D’Oliveiro
wrote:
> On Friday, September 23, 2016 at 4:25:21 AM UTC+12, Chris Angelico wrote:
>> For reference, the Decimal module (ignoring the C accelerator) is over six
>> thousand lines of code, as a single module. Now, that might be pushing the
>> bo
On Friday, September 23, 2016 at 4:25:21 AM UTC+12, Chris Angelico wrote:
> For reference, the Decimal module (ignoring the C accelerator) is over six
> thousand lines of code, as a single module. Now, that might be pushing the
> boundaries a bit ...
What “boundaries” do you think that might be pu
Peng Yu writes:
> Is there such a good automated tool for python refactoring?
This sounds like a job for — Bicycle Repair Man!
Watch him extract jumbled code into well ordered classes.
Gasp, as he renames all occurrences of a method.
Thank You Bicycle Repair Man!
http://bicyc
On Thu, Sep 22, 2016 at 8:35 PM, Ben Finney wrote:
> Peng Yu writes:
>
>> On Wed, Sep 21, 2016 at 11:14 PM, Ben Finney
>> wrote:
>> > [Importing ‘*’ from a module] will also make the names in the code
>> > impossible to automatically match against where they came from.
>> > Explicit is better t
Peng Yu writes:
> On Wed, Sep 21, 2016 at 11:14 PM, Ben Finney
> wrote:
> > [Importing ‘*’ from a module] will also make the names in the code
> > impossible to automatically match against where they came from.
> > Explicit is better than implicit; you are proposing to make an
> > unknown horde
On Fri, Sep 23, 2016 at 1:50 AM, Peng Yu wrote:
>
> This will make refactoring easy. If everything is explicit, when one
> do refactoring, at two places need to be changed which can be a
> burden.
So you want it to be easy to move stuff around between files in a
package? Sounds like you don't act
On Wed, Sep 21, 2016 at 11:14 PM, Ben Finney wrote:
> Peng Yu writes:
>
>> I want to import all the thing (or the ones available in the
>> respective __all__) defined in each of the file by putting the
>> following lines in __init__.py
>>
>> from file1 i
Peng Yu writes:
> I want to import all the thing (or the ones available in the
> respective __all__) defined in each of the file by putting the
> following lines in __init__.py
>
> from file1 import *
>
> from filen import *
>
> However, I don't want to har
Hi,
Suppose that I have file1.py, ..., filen.py in a module directory.
I want to import all the thing (or the ones available in the
respective __all__) defined in each of the file by putting the
following lines in __init__.py
from file1 import *
from filen import *
However, I don't
/python3.2/foo-1.0.0/ on the file-system
> and this is referred to the root of the pkg.
>
> 2. Can, foo-1.0.0 contain __init__.py or do i have to do:
> foo-1.0.0/foo/__init__.py ?
>
>
> Take a look at what this guy is saying on his blog:
> http://blog.habnab.it/blog/2013/07/21/p
is referred to the root of the pkg.
2. Can, foo-1.0.0 contain __init__.py or do i have to do:
foo-1.0.0/foo/__init__.py ?
Take a look at what this guy is saying on his blog:
http://blog.habnab.it/blog/2013/07/21/python-packages-and-you/
---
(bottom of the page)
"Your project
Tamer Higazi wrote:
> Hi people!
>
> I have asked myself a question, if there is a opposite of "__init__.py"
> like "__del__.py" ?!
Others have answered your question, but I wanted to correct a
misunderstanding:
>
> I want, that when the application end
On Mon, 19 Aug 2013 18:48:19 +0200, Tamer Higazi wrote:
> Hi people!
>
> I have asked myself a question, if there is a opposite of "__init__.py"
> like "__del__.py" ?!
No. If you want to run code when your application is shutting down, run
it just befo
Yes, see the atexit module:
http://docs.python.org/3/library/atexit.html
On Mon, Aug 19, 2013 at 10:48 AM, Tamer Higazi wrote:
> Hi people!
>
> I have asked myself a question, if there is a opposite of "__init__.py"
> like "__del__.py" ?!
>
> I want, t
Hi people!
I have asked myself a question, if there is a opposite of "__init__.py"
like "__del__.py" ?!
I want, that when the application ends, certain functions are executed.
I know I could make a constructor and a destructor, but I simply want to
know if there is a o
On Tuesday, October 16, 2012 3:41:55 PM UTC+5:30, Marco Nawijn wrote:
> On Tuesday, October 16, 2012 10:48:17 AM UTC+2, Gaudha wrote:
>
> > my_package/
>
> >
>
> > __init__.py
>
> >
>
> > my_module1.py
>
> &
On Tuesday, October 16, 2012 10:48:17 AM UTC+2, Gaudha wrote:
> my_package/
>
> __init__.py
>
> my_module1.py
>
> my_module2.py
>
> variables.py
>
>
>
> I want to define common variables in __init__.py and use the namespace in
> my_module1
my_package/
__init__.py
my_module1.py
my_module2.py
variables.py
I want to define common variables in __init__.py and use the namespace in
my_module1.py or my_module2.py. Defining it is not a problem. How can call it
from my modules?
If I define them in a module (say, variables.py), I
egbert wrote:
Yes, you are right. And I can reach everything with
modules['some_package']
or variants thereof.
Although note that the usual way to get it would be
to simply do
import some_package
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Mar 25, 2010 at 12:43:13PM -0400, Terry Reedy wrote:
> On 3/25/2010 6:16 AM, egbert wrote:
> >When I do 'from some_package import some_module'
> >the __init__.py of some_package will be run.
> >However, there will not be anything like a package-module,
&g
On 3/25/2010 6:16 AM, egbert wrote:
When I do 'from some_package import some_module'
the __init__.py of some_package will be run.
However, there will not be anything like a package-module,
and the effects of __init__.py seem all to be lost. Is that true ?
No. If you do
from
egbert wrote:
> When I do 'from some_package import some_module'
> the __init__.py of some_package will be run.
> However, there will not be anything like a package-module,
> and the effects of __init__.py seem all to be lost. Is that true ?
> Or can I still do somethin
When I do 'from some_package import some_module'
the __init__.py of some_package will be run.
However, there will not be anything like a package-module,
and the effects of __init__.py seem all to be lost. Is that true ?
Or can I still do something useful with __init__.py ?
e
--
Egbe
For finnished the subject i resolve the problem using the PEP-328, i was
using the old kind of imports :s
On Feb 4, 2010 10:10pm, Hidura wrote:
Thanks i middle resolve the problem, and i going to read the PEP-366 i've
been read the 328, i will kept informed of the progresses.
Thanks again
Thanks i middle resolve the problem, and i going to read the PEP-366 i've
been read the 328, i will kept informed of the progresses.
Thanks again for the help [?]
On Thu, Feb 4, 2010 at 6:47 PM, Ben Finney
> wrote:
> "Gabriel Genellina" writes:
>
> > If you directly run a script from inside a
"Gabriel Genellina" writes:
> If you directly run a script from inside a package, Python does not
> know that it belongs to a package, and treats it as a simple, lonely
> script. In that case, relative imports won't work.
Which I consider to be a bug. Fortunately, it's already addressed in PEP
3
ll glad to read opinions. [?]
You say that Writer is a package, but apparently Python disagrees. A
package is not just "a directory containing an __init__.py file", this is
half the truth. Python must be *aware* of such file, and this happens when
you import the package.
If you d
contains Writer the second package,
>> Writers
>> contain the module tagmanip(What is imported in the best way inside the
>> __init__.py of the Writer), when i make the import inside the writer
>> everything is ok, but from the Utilities package the errors says:
>> &qu
the module tagmanip(What is imported in the best way inside the
__init__.py of the Writer), when i make the import inside the writer
everything is ok, but from the Utilities package the errors says:
"ImportError: No module named tagsmanip".
I don't understand why this is happening, if
__init__.py of the Writer), when i make the import inside the writer
everything is ok, but from the Utilities package the errors says:
"ImportError: No module named tagsmanip".
I don't understand why this is happening, if somebody could help me i will
glad to hear any suggestion.
me’ is a module in that package, the module's namespace is
> available to you via ‘packagename.modulename’.
it looks that one need put the "import modulename" line in __init__.py
or "import packagename.modulename" in the user clent script
explicitly. or else, just '
Phil wrote:
> I wrote my last message late last night. When I said "I am unable to
> import a module from the package without an import error.", I did mean
> the 'modulename' module.
>
> However, I just set up a Debian VM with Python 2.5.2 and what I was
> trying to do works. So it is either some
I wrote my last message late last night. When I said "I am unable to
import a module from the package without an import error.", I did mean
the 'modulename' module.
However, I just set up a Debian VM with Python 2.5.2 and what I was
trying to do works. So it is either something that changed with P
I wrote my last message late last night. When I said "I am unable to
import a module from the package without an import error.", I did mean
the 'modulename' module.
However, I just set up a Debian VM with Python 2.5.2 and what I was
trying to do works. So it is either something that changed with P
x27;, it defines the
'application' class in 'application.py'.
And in web's __init__.py it has...
from application import *
And in whatever app you are creating, it has...
import web
app = web.application(params)
That being said, I can't get similar functi
Phil writes:
> I use distutils / setup.py to install 'packagename', where...
> /packagename
> __init__.py
> modulename.py
>
> modulename.py has a class named 'classname'.
As per PEP 8, it's best if user-defined classes are named with
Titl
I use distutils / setup.py to install 'packagename', where...
/packagename
__init__.py
modulename.py
modulename.py has a class named 'classname'.
>From an arbitrary python module, I 'import packagename'.
In said module, I want to use the 'classna
On Sun, 01 Nov 2009 08:07:37 -0600, Peng Yu wrote:
> It is
> reasonable to assume the log of the number of states of a function or a
> class is proportional to it length. Hence, when a function or a
> class is long, you will never be able to test all its states.
def f(n):
return n + 5
def
On Sun, 01 Nov 2009 13:46:42 -0600, Robert Kern wrote:
> Peng Yu wrote:
>> On Sat, Oct 31, 2009 at 11:40 PM, Steven D'Aprano
>> wrote:
>
>>> Oh wait, I get it... you want to do a global search-and-replace over
>>> the entire file. *face-palm*
>>
>> Yes. You get it.
>
> In any capable programme
Peng Yu wrote:
On Sat, Oct 31, 2009 at 11:43 PM, Steven D'Aprano
wrote:
On Sat, 31 Oct 2009 22:54:47 -0500, Peng Yu wrote:
So python would not be able to accommodate my preference one
class/function per file?
Of course it does! You can do that RIGHT NOW -- just put one class per
file.
I.e.
Peng Yu wrote:
On Sat, Oct 31, 2009 at 11:40 PM, Steven D'Aprano
wrote:
Oh wait, I get it... you want to do a global search-and-replace over the
entire file. *face-palm*
Yes. You get it.
In any capable programmer's editor, it should not be hard to do a local
search-and-replace over just
On Sat, Oct 31, 2009 at 11:40 PM, Steven D'Aprano
wrote:
> On Sat, 31 Oct 2009 22:48:10 -0500, Peng Yu wrote:
>
>>> Variables in a function are already private. How can the names in one
>>> function be affected by other functions in the same module?
>>
>> You misunderstood me.
>>
>> If there are
On Sat, Oct 31, 2009 at 11:43 PM, Steven D'Aprano
wrote:
> On Sat, 31 Oct 2009 22:54:47 -0500, Peng Yu wrote:
>
>> So python would not be able to accommodate my preference one
>> class/function per file?
>
> Of course it does! You can do that RIGHT NOW -- just put one class per
> file.
>
>> I.e.,
>>> feel the existence of module A and B. I want them feel exact like
>>>> class A and B are defined in module 'test' instead of feeling two
>>>> modules A and B are in package 'test'.
>>>
>>>
>>> Inside test/__init__.py:
&g
Robert Kern writes:
> If you are going to expose symbols in your __init__.py, they should
> not have the same name as any of the modules in the package.
Would I be correct in assuming you make an exception for the package
importing one of the modules in the package, and thereby makin
On Sat, 31 Oct 2009 22:54:47 -0500, Peng Yu wrote:
> So python would not be able to accommodate my preference one
> class/function per file?
Of course it does! You can do that RIGHT NOW -- just put one class per
file.
> I.e., I have to use something like 'from spam
> import spam' or 'spam.spam
On Sat, 31 Oct 2009 22:48:10 -0500, Peng Yu wrote:
>> Variables in a function are already private. How can the names in one
>> function be affected by other functions in the same module?
>
> You misunderstood me.
>
> If there are multiple functions or classes in a file, when I change
> variable
;> class A and B are defined in module 'test' instead of feeling two
>>> modules A and B are in package 'test'.
>>
>>
>> Inside test/__init__.py:
>>
>> from A import A # class A from file A.py
>> from B import B # class B from file
something like 'from spam
import spam' or 'spam.spam()', or accept that the filename is not the
same as the class/function name.
Inside test/__init__.py:
from a import A # class A from file a.py
from b import B # class B from file b.py
If you are going to expose symbols in
nction per file? I.e., I have to use something like 'from spam
import spam' or 'spam.spam()', or accept that the filename is not the
same as the class/function name.
Inside test/__init__.py:
from a import A # class A from file a.py
from b import B # class B from file b.py
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, Oct 31, 2009 at 9:18 PM, Dave Angel wrote:
> Peng Yu wrote:
>>
>> On Sat, Oct 31, 2009 at 5:45 PM, Wolodja Wentland
>> wrote:
>>
>>>
>>> On Sat, Oct 31, 2009 at 16:53 -0500, Peng Yu wrote:
>>>
On Sat, Oct 31, 2009 at 4:14 PM, Robert Kern
wrote:
>>>
>>> [ snip ]
>>>
>>
On Sat, Oct 31, 2009 at 9:34 PM, Steven D'Aprano
wrote:
> On Sat, 31 Oct 2009 18:29:35 -0500, Peng Yu wrote:
>
>> If two functions are too long to put in file, I generally put them in
>> two different files.
>
> If two functions are too long for a single file, the functions are too
> big and need
Peng Yu wrote:
I have defined 'long' in one of my previous message. I consider a file
long, when it does not fit in one or two screen. Basically, I want to
get a whole picture of the file after glancing of the file.
I think you are going to have to get used to the fact that you have very stran
parrot():
> spam()
> ham()
> cheeseshop()
>
>
> This is not an advantage!
I would say this is the disadvantage of python, if there is no
walkaround to avoid using 'from spam import spam'. As this can be
handled in C++ with walkaround.
So far the best soluti
B exist just for the sake of
>> implementation. Even if I have module A and B, I don't want the user
>> feel the existence of module A and B. I want them feel exact like class
>> A and B are defined in module 'test' instead of feeling two modules A
>> and B
lass
> A and B are defined in module 'test' instead of feeling two modules A
> and B are in package 'test'.
Inside test/__init__.py:
from A import A # class A from file A.py
from B import B # class B from file B.py
or better still:
from a import A # class A fro
On Sat, 31 Oct 2009 20:03:29 -0500, Peng Yu wrote:
>> If it should ever happen that two functions are too long to put in a
>> single file you should refactor your code. It is usually a good idea of
>> breaking problems down into single steps (ie functions) so you never
>> end up with a 5000 SLOC *
On Sat, 31 Oct 2009 18:29:35 -0500, Peng Yu wrote:
> If two functions are too long to put in file, I generally put them in
> two different files.
If two functions are too long for a single file, the functions are too
big and need to be broken up into ten or thirty sub-functions each!
Ideally, n
Peng Yu wrote:
On Sat, Oct 31, 2009 at 5:45 PM, Wolodja Wentland
wrote:
On Sat, Oct 31, 2009 at 16:53 -0500, Peng Yu wrote:
On Sat, Oct 31, 2009 at 4:14 PM, Robert Kern wrote:
[ snip ]
I know that multiple classes or functions are typically defined in one
file (i.e. mod
On Sat, Oct 31, 2009 at 7:21 PM, Wolodja Wentland
wrote:
> On Sat, Oct 31, 2009 at 18:29 -0500, Peng Yu wrote:
>> On Sat, Oct 31, 2009 at 5:45 PM, Wolodja Wentland
>> wrote:
>> > On Sat, Oct 31, 2009 at 16:53 -0500, Peng Yu wrote:
>
>> > Are you serious? Do you *really* put each function in its o
On 2009-10-31 19:21 PM, Wolodja Wentland wrote:
On Sat, Oct 31, 2009 at 18:29 -0500, Peng Yu wrote:
And I always put a single class in a file.
Why? What do you gain by that?
While it's never a good idea to follow the rule slavishly, it's often a good
idea. Many classes are themselves a se
On Sat, Oct 31, 2009 at 18:29 -0500, Peng Yu wrote:
> On Sat, Oct 31, 2009 at 5:45 PM, Wolodja Wentland
> wrote:
> > On Sat, Oct 31, 2009 at 16:53 -0500, Peng Yu wrote:
> > Are you serious? Do you *really* put each function in its own file? How
> > exactly does this enhance the readability of the
On Sat, Oct 31, 2009 at 5:45 PM, Wolodja Wentland
wrote:
> On Sat, Oct 31, 2009 at 16:53 -0500, Peng Yu wrote:
>> On Sat, Oct 31, 2009 at 4:14 PM, Robert Kern wrote:
>
> [ snip ]
>
>> I know that multiple classes or functions are typically defined in one
>> file (i.e. module in python). However,
d to use different patterns.
Of course, to really take advantage of that feature in C++ requires some careful
coding and use of patterns like pimpl. That often negates any readability benefits.
You could probably hack something (and people have), but it makes your code
harder to understand becaus
On Sat, Oct 31, 2009 at 16:53 -0500, Peng Yu wrote:
> On Sat, Oct 31, 2009 at 4:14 PM, Robert Kern wrote:
[ snip ]
> I know that multiple classes or functions are typically defined in one
> file (i.e. module in python). However, I feel this make the code not
> easy to read. Therefore, I insist o
what I am asking can be easily implemented, because the
namespace and the directory hierachy is not bind to each other.
However, the binding between the namespace and the directory hierachy
make this difficult to implement. I don't know if it is not
impossible, but I'd hope the
from
having to figure out which you are referring to when reading the code.
Personally, I like to keep my __init__.py files empty such that I can import
exactly what I need from the package. This allows me to import exactly the
module that I need. In large packages with extension modules that can be
On Sat, Oct 31, 2009 at 12:47 PM, Duncan Booth
wrote:
> Peng Yu wrote:
>
>> I'm wondering if there is a way to make the following two things hold.
>> Thank you1
>> 1. When I 'import test', I can refer to class A as 'test.A'.
>> 2. When I 'import test.A', I can refer to class A as 'test.A.A' and
>
Peng Yu wrote:
> I'm wondering if there is a way to make the following two things hold.
> Thank you1
> 1. When I 'import test', I can refer to class A as 'test.A'.
> 2. When I 'import test.A', I can refer to class A as 'test.A.A' and
> class B shall not be imported.
>
No. Either import adds the
I have the following files, which are in the directory 'test'. The
parent directory of 'test' is in $PYTHONPATH. I have 'from A import A'
and 'from B import B' in '__init__.py', because I want to use 'test.A'
and 'test.B' to r
On Aug 15, 2:19 pm, Christian Heimes wrote:
> wgw wrote:
> > I don't understand why the __file__ value in my installation of PyQt
> > would not give a proper, full path.
>
> > I'm guessing that I did not install pyqt properly (I'm on Ubuntu
> > Hardy, trying to install QT4.5), but before redoing t
wgw wrote:
I don't understand why the __file__ value in my installation of PyQt
would not give a proper, full path.
I'm guessing that I did not install pyqt properly (I'm on Ubuntu
Hardy, trying to install QT4.5), but before redoing the install, I
want to see if there is a quicker fix.
Some ve
I don't understand why the __file__ value in my installation of PyQt
would not give a proper, full path.
I'm guessing that I did not install pyqt properly (I'm on Ubuntu
Hardy, trying to install QT4.5), but before redoing the install, I
want to see if there is a quicker fix.
Also, though PyQt4/ i
On Feb 23, 5:41 pm, Michael Crute wrote:
> Is it bad form (i.e. non-pythonic) to have code in your __init__.py
> files? I know this is subjective so I'm just looking for the general
> consensus. I've heard both sides of the story and I personally feel
> its okay if the code
On Mon, Feb 23, 2009 at 9:41 PM, Benjamin Peterson wrote:
> Michael Crute gmail.com> writes:
>> On Mon, Feb 23, 2009 at 9:03 PM, Steve Holden holdenweb.com>
>> wrote:
>> > No, it's absolutely fine. One common usage is to import symbols from
>> > sub-modules so that they are available from a sim
convenience
sake (as mentioned by Steve).
I don't expect a class to define its method within its __init__, so
I'd find it unusual for a package to be defining any kind of
functionality within its __init__.py. I wouldn't _not_ use your code,
but I might eye it warily... :)
--
http://mai
Michael Crute writes:
> Is it bad form (i.e. non-pythonic) to have code in your __init__.py
> files?
No, it's good form, but *only* for code that truly pertains to the
entire package. Anything that can reasonably be in a module other than
‘__init__’, should be.
That leaves the follo
Michael Crute gmail.com> writes:
> On Mon, Feb 23, 2009 at 9:03 PM, Steve Holden holdenweb.com>
> wrote:
> > No, it's absolutely fine. One common usage is to import symbols from
> > sub-modules so that they are available from a simple import of the package.
>
> Yeah, I use it often for that I'm
On Mon, Feb 23, 2009 at 9:03 PM, Steve Holden wrote:
> Michael Crute wrote:
>> Is it bad form (i.e. non-pythonic) to have code in your __init__.py
>> files? I know this is subjective so I'm just looking for the general
>> consensus. I've heard both sides of the sto
Michael Crute wrote:
> Is it bad form (i.e. non-pythonic) to have code in your __init__.py
> files? I know this is subjective so I'm just looking for the general
> consensus. I've heard both sides of the story and I personally feel
> its okay if the code pertains to the wh
Is it bad form (i.e. non-pythonic) to have code in your __init__.py
files? I know this is subjective so I'm just looking for the general
consensus. I've heard both sides of the story and I personally feel
its okay if the code pertains to the whole module but have an open
mind about the
>
> > Simple example of what isn't working...
> > Structure-
> >
> > pytest/ Root directory of package
> > __init__.py- code: __all__ = ['folder']
> > folder/ Another folder in the package
> > __init__.py- code: __all
;t working...
> Structure-
>
> pytest/ Root directory of package
> __init__.py- code: __all__ = ['folder']
> folder/ Another folder in the package
> __init__.py- code: __all__ = ['hello']
> hello.py- code: print('He
documents I could find. I am
> running Python 2.6 on windows. The problem I am having with packages
> is that they don't show up!
>
> Simple example of what isn't working...
> Structure-
>
> pytest/ Root directory of package
> __init__.py- code: __all__ = [
Ok I have read all of the tutorials and documents I could find. I am
running Python 2.6 on windows. The problem I am having with packages
is that they don't show up!
Simple example of what isn't working...
Structure-
pytest/ Root directory of package
__init__.py- code: __all__
>>> import xlrd
> > > > >>>> book=xlrd.open_workbook("C:\\a.xls")
>
> > > > > i am getting the following error..
>
> > > > > *Traceback (most recent call last):
> > > > > File "", line 1, in
>
;
> > > > i am getting the following error..
>
> > > > *Traceback (most recent call last):
> > > > File "", line 1, in
> > > > File "C:\Python25\Lib\site-packages\xlrd\__init__.py", line 370, in
> > > > open_w
1 - 100 of 147 matches
Mail list logo