Distinguishing attributes and methods
Hi, With properties, attributes and methods seem very similar. I was wondering what techniques people use to give clues to end users as to which 'things' are methods and which are attributes. With ipython, I use tab completion all the time, but I can rarely tell from the names alone whether it is an attribute or method. Tips? Ideas? Best practices? Here is one idea: Ipython should color-code the tab completion based on attributes and methods. -- http://mail.python.org/mailman/listinfo/python-list
properties give variable docstrings
The topic of docstrings for variables has come up many times before. In fact, a PEP was proposed and rejected on this very topic. http://www.python.org/dev/peps/pep-0224/ When creating classes, I like using properties...and I like even more that these properties have docstrings. This allows one to interactively explore the API and understand (in a limited sense) what the variables mean in the context of the class. I am in a situation where I need to add a large number of properties to a class (the properties are almost identical...differing only by a docstring)... The topic of dynamically generating properties has been discussed here: http://groups.google.com/group/comp.lang.python/browse_thread/thread/3d682513cd7551d8?hl=en The conclusion there seems to suggest that I'd probably be better off using __getattr__. This makes sense, but the downside is that I no longer have docstrings for my attributes. So, I'm wondering what others think...is it worthwhile to define properties just so that I can have docstrings for attributes? Or is creating a bunch of properties overkill in every possible way -- http://mail.python.org/mailman/listinfo/python-list
Imports in Packages
While working within a package...what is the 'best practice' way to do your imports. a/__init__.py a/one.py a/two.py a/b/__init__.py a/b/cat.py a/b/dog.py a/c/cow.py Suppose I am working in a/c/cow.py and I need something from a/b/ dog.py. If a/b/__init__.py contains what I need from dog.py, should I do: "from a.b import desiredfunction" or "from a.b.dog import desiredfunction" What are your reasons for preferring one over the other (performance, readability, portability)? Also, the same can be said of functions from other packages... I know that >>> from math import cos >>> x = cos(3) is preferred for performance reasons over >>> import math >>> x = math.cos(3) because of the required lookup. Does this mean that that I should import as far down as possible as well? For example, "from a.b.c.mod import func" versus "from a import fun". -- http://mail.python.org/mailman/listinfo/python-list
Max Long
How can I figure out the largest long available? I was hoping for something like sys.maxint, but I didn't see it. Also, can someone point me to where I can (concisely) read about size of such types (int, float, long). -- http://mail.python.org/mailman/listinfo/python-list
Re: Max Long
On Jan 21, 3:34 pm, Bjoern Schliessmann wrote: > [EMAIL PROTECTED] wrote: > > How can I figure out the largest long available? > > Why would you? AFAIK, longs are only limited by available memory. Indeed, as the docs pointed out. I guess I was confused by "If pylong is greater than ULONG_MAX, an OverflowError is raised." at http://docs.python.org/api/longObjects.html. -- http://mail.python.org/mailman/listinfo/python-list