Re: [Zope] Styles of import in Zope (2 and 3)

2008-08-31 Thread Marco Bizzarri
On Sun, Aug 31, 2008 at 3:04 AM, Chris McDonough [EMAIL PROTECTED] wrote:
 One goal to shoot for when you do imports is to be able to remove an imported
 name by deleting a line as opposed to editing one (it makes reading diffs a 
 bit
 easier).  E.g. instead of:

  from foo import one, two, three

A lot of this in my code :-(

 I usually either do:

  import foo
  foo.one

Yes, I'm looking into this.

 Or:

  from foo import one
  from foo import two
  from foo import three

Too many of them... maybe an hint I should refactor something :-) ?

 Either way makes diffs cleaner.

 One thing I always avoid is from foo import *.

At least, I've avoided this sin ;)

 - C




-- 
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.com/
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Styles of import in Zope (2 and 3)

2008-08-30 Thread Marco Bizzarri
Please, feel free to point me to The Fine Manual to read, if this has
been answered and written many times.

After reading the article Importing Python Modules
(http://effbot.org/zone/import-confusion.htm), I had many doubts about
the style to use in imports in Zope 2 and Zope 3.

The article points to a style which should be:

from package.subpackage import module

and then use

module.MyClass

Is this the recomended style in Zope2/3 also?

Regards
Marco

-- 
Marco Bizzarri
http://iliveinpisa.blogspot.com/
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Styles of import in Zope (2 and 3)

2008-08-30 Thread Andreas Jung



--On 30. August 2008 14:50:30 +0200 Marco Bizzarri 
[EMAIL PROTECTED] wrote:



Please, feel free to point me to The Fine Manual to read, if this has
been answered and written many times.

After reading the article Importing Python Modules
(http://effbot.org/zone/import-confusion.htm), I had many doubts about
the style to use in imports in Zope 2 and Zope 3.

The article points to a style which should be:

from package.subpackage import module

and then use

module.MyClass

Is this the recomended style in Zope2/3 also?


PEP8 tells you:

http://www.python.org/dev/peps/pep-0008/

-aj

pgpR0u5gNMSCO.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Styles of import in Zope (2 and 3)

2008-08-30 Thread Marco Bizzarri

 Is this the recomended style in Zope2/3 also?

 PEP8 tells you:

 http://www.python.org/dev/peps/pep-0008/

 -aj

Yes, I've read it; but PEP8 seems not to prescribe any particular
style over the other. Is there any other place where the topic is
addressed?

Regards
Marco
-- 
Marco Bizzarri
http://iliveinpisa.blogspot.com/
http://notenotturne.blogspot.com/
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Styles of import in Zope (2 and 3)

2008-08-30 Thread Andreas Jung



--On 30. August 2008 20:01:41 +0200 Marco Bizzarri 
[EMAIL PROTECTED] wrote:




Is this the recomended style in Zope2/3 also?


PEP8 tells you:

http://www.python.org/dev/peps/pep-0008/

-aj


Yes, I've read it; but PEP8 seems not to prescribe any particular
style over the other. Is there any other place where the topic is
addressed?


*shrug* - consider it like preferring white wine or red wine.
Ask ten people and you'll get ten different answers. Fortunately there is 
some freedom beyond PEP8.


Andreas

pgp5GcaQrlEU0.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Styles of import in Zope (2 and 3)

2008-08-30 Thread Chris McDonough
One goal to shoot for when you do imports is to be able to remove an imported
name by deleting a line as opposed to editing one (it makes reading diffs a bit
easier).  E.g. instead of:

  from foo import one, two, three

I usually either do:

  import foo
  foo.one

Or:

  from foo import one
  from foo import two
  from foo import three

Either way makes diffs cleaner.

One thing I always avoid is from foo import *.

- C


Marco Bizzarri wrote:
 Please, feel free to point me to The Fine Manual to read, if this has
 been answered and written many times.
 
 After reading the article Importing Python Modules
 (http://effbot.org/zone/import-confusion.htm), I had many doubts about
 the style to use in imports in Zope 2 and Zope 3.
 
 The article points to a style which should be:
 
 from package.subpackage import module
 
 and then use
 
 module.MyClass
 
 Is this the recomended style in Zope2/3 also?
 
 Regards
 Marco
 

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )