I'm pleased to announce the release of ZODB 3.5.1 final. This corresponds
to the ZODB that will ship in Zope 3.1.0 final. You can download a source
tarball or Windows installer from:
http://zope.org/Products/ZODB3.5
Note that there are two Windows installers, for Python 2.3 (2.3.5 is
John Bausano [EMAIL PROTECTED] wrote:
Hello all,
I've been using Ansys which is a commercial FEA package which can be
controlled through its own scripting language they call APDL. Now I'm
trying to write some stand alone code in Python to supplement my current
efforts.
In Ansys I can do
On Mon, 26 Sep 2005 21:09:51 -0400, John Bausano [EMAIL PROTECTED] wrote:
Hello all,
...
Funny enough, some people have wanted to substitute a more dynamic character
for me on occasion g.
--
http://mail.python.org/mailman/listinfo/python-list
Do you think of pydoc? Just make comments in your code this way:
def add10(x):
this function adds ten to the given variable
Then save this into add.py and now (in the same directory):
pydoc add
Voila, your documentation.
--
http://mail.python.org/mailman/listinfo/python-list
Kenneth McDonald wrote:
I have a module I'd like to document using the same style...
http://docs.python.org/doc/doc.html
--
Robert Kern
[EMAIL PROTECTED]
In the fields of hell where the grass grows high
Are the graves of dreams allowed to die.
-- Richard Harter
--
thank you very much for your suggestions and links, also slang got my
attention.
thanks.
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 26 Sep 2005 15:35:21 -0700, Micah Elliott [EMAIL PROTECTED] wrote:
Please read/comment/vote. This circulated as a pre-PEP proposal
submitted to c.l.py on August 10, but has changed quite a bit since
then. I'm reposting this since it is now Open (under consideration)
at
[EMAIL PROTECTED] wrote:
Hello,
being an almost complete Python AND programming neophyte I would like to ask
the following - very elementary, as I might suspect - question:
How do I do the following flawed things right:
a1=a2=0
def f(x):
if x == a1:
a1 = a1 + 1
[EMAIL PROTECTED] (Bengt Richter) writes:
2) In general, I think it might be good to meet Paul Rubin half way
re convention vs syntax, but I don't think code tagging should be
part of the language syntax per se. (-*- cookies -*- really are
defacto source syntax that snuck in by disguise IMO)
Hi,
I've a module report.py having a set of funtions to open/close/write
data to a log file. I invoke these functions from another module
script.py.
Whenever I'm changing something in report.py, I'm running the file
(however, it has not effect). After that I'm running script.py again.
However,
LRU caches are nice and simple, but if you want something fancier, with
support for squid-like expiry models (ie, using mtime and atime to
estimate a stale time, and IMS fetches), you can have a look at my
GCache;
http://minkirri.apana.org.au/~abo/projects/GCache
Even if you don't want something
Bruno Desthuilliers wrote:
2/ functional solution:
---
def make_funcs():
x = 0
def _abc():
x = 1
return x + 1
def _abcd():
return x + 1
return _abc, _abcd
abc, abcd = make_funcs()
print abc()
print abcd()
The x in
Gopal wrote:
Hi,
I've a module report.py having a set of funtions to open/close/write
data to a log file. I invoke these functions from another module
script.py.
Whenever I'm changing something in report.py, I'm running the file
(however, it has not effect). After that I'm running
Le 27-09-2005, Paul http nous disait:
Maybe the checking functions don't really belong in the
compiler/interpreter. PyChecker might be a good home for them, if
it's made part of the distro. There could be an interpreter flag to
invoke PyChecker automatically.
Just to make a quick note that
Gopal wrote:
I've a module report.py having a set of funtions to open/close/write
data to a log file. I invoke these functions from another module
script.py.
Whenever I'm changing something in report.py, I'm running the file
(however, it has not effect). After that I'm running script.py
Pierre Barbier de Reuille [EMAIL PROTECTED] wrote:
Now suppose you have two classes A and B, B subclassing A.
If you define :
@method(A)
def myfct(f):
do_something_with_f
Then, you want it to work with any object of type B ... but with either
Guido's or this implementation, it won't !
CheckOn is the working name for my project. Our church
community has many elderly who are at home but close to assisted living
placements. Many do not have family and rely on volunteer caretakers
and lunch providers for their socialization. We are trying to make
phone contact with
How can I write code to take advantage of new decorator syntax, while
allowing backward compatibility?
I almost want a preprocessor.
#if PYTHON_VERSION = 2.4
@staticmethod
...
Since python 2.4 will just choke on @staticmethod, how can I do this?
--
Neal Becker wrote:
How can I write code to take advantage of new decorator syntax, while
allowing backward compatibility?
I almost want a preprocessor.
#if PYTHON_VERSION = 2.4
@staticmethod
...
Since python 2.4 will just choke on @staticmethod, how can I do this?
It seems to me
Neal Becker wrote:
How can I write code to take advantage of new decorator syntax, while
allowing backward compatibility?
I almost want a preprocessor.
#if PYTHON_VERSION = 2.4
@staticmethod
...
Since python 2.4 will just choke on @staticmethod, how can I do this?
Decorators are there
Neal Becker wrote:
How can I write code to take advantage of new decorator syntax, while
allowing backward compatibility?
I almost want a preprocessor.
#if PYTHON_VERSION = 2.4
@staticmethod
...
Since python 2.4 will just choke on @staticmethod, how can I do this?
Here's one
Peter Otten wrote:
Bruno Desthuilliers wrote:
2/ functional solution:
---
def make_funcs():
x = 0
def _abc():
x = 1
return x + 1
def _abcd():
return x + 1
return _abc, _abcd
abc, abcd = make_funcs()
print abc()
print abcd()
The
On Tuesday 27 September 2005 00:22, Michele Simionato wrote:
It is not that easy, but you can leverage on my decorator module
which does exactly what you want:
http://www.phyast.pitt.edu/~micheles/python/decorator.zip
Excellent. Thank you :-).
- Michael
--
QOTW: This is Open Source. If you want an initiative, start
one. -- Rheinold Birkenfeld
I've found jython incredibly helpful in learning java. -- pythonUser_07
The fourth annual Free Software and Open Source Symposium hosted by
Canada's largest college includes a talk on Python Power
Damn this is annoying me.
I have a webpage with a BZ2 compressed text embedded in it looking like:
'BZh91AYSYA\xaf\x82\r\x00\x00\x01\x01\x80\x02\xc0\x02\x00 \x00!\x9ah3M
\x07]\xc9\x14\xe1BA\x06\xbe\x084'
Now, if I simply copy and paste this into Python and decompress it - it
works a treat.
Hi !
I want to write a program that backup some databases in the night.
Pseudo like this:
try:
if cmd('net stop dbservice'):
s=c://backup'+str(time.time())+'.zip'
if cmd('zipit c:\\database '+s):
if cmd('map drive backupdrive\\c$ y -user BACKUP -pwd SECRET'):
if
I need to know how much memory uses child process (after
subprocess.Popen), so I want function:
get_memory_usage(pid)
I found two ways:
- call ps and analyze its output - this is not portable (different
output on Linux, Cygwin and QNX)
- use resource.getrusage - but it works for
You should take a look at the subprocess module
http://www.python.org/dev/doc/devel/lib/module-subprocess.html
-Larry Bates
[EMAIL PROTECTED] wrote:
Hi !
I want to write a program that backup some databases in the night.
Pseudo like this:
try:
if cmd('net stop dbservice'):
Hi,
I'm developing a program that analyzes all the webpages on my
webserver.
I've created one class, Filewalker(), with a function that returns the
paths of all ASP pages of interest as a list, which I then turn into a
tuple.
I then iterate over the tuple, passing each path to my Analyzer()
I haven't been following this whole thread, but it sounds like you want
something like PJE's RuleDispatch package.
There's a Developer Works article about it, put up very recently:
http://www-128.ibm.com/developerworks/linux/library/l-cppeak2/?ca=dgr-
lnxw02aScalingPEAK
PJE (IIRC) based it
linux:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/286222
Martin v. Löwis wrote:
Tarek Ziadé wrote:
I am trying to find a general memory profiler that can measure the
memory usage in Python program
and gather some stats about object usages, and things like that.
As Diez says,
Martin v. Löwis wrote:
Tarek Ziadé wrote:
I am trying to find a general memory profiler that can measure the
memory usage in Python program
and gather some stats about object usages, and things like that.
As Diez says, use gc: gc.getobjects() gives you all container objects.
If you
gene tani wrote:
linux:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/286222
Yes thanks I have found this one, I need to try it out,
but it does not provide a way to refcount,
Another solution could be to use trace maybe
I am going to try things out
Regards
--
wow,
Thanks alex, this rocks really, [ i am new to OOP style in python]
I am trying to implement it on similar lines,
I`ll comeback if I encounter any trouble.
thanks again
-Jiro
Paul McGuire wrote:
[EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hi all
I am a newbie and I just
I was able to do something like this in Python a while back. You'll need one
of:
(a) A telephone line dialer/monitor DTMF I/O board that works through the
serial port, and a phone audio tap that mixes the soundcard I/O to the phone
(b) A TAPI-compliant modem that does everything you need
(c) A
I have wrapped some inhouse libraries for Python. The development team
uses VC6 and DF6.1 for development of these libraries under WinXP. I
would like to wrap the libraries for Python and use the official Win
Python from python.org. Now I get a segmentation fault in (access
violation in
B Mahoney wrote:
Is there a Python 'find' -like utility that will continue the file
search through any zippped directory structure on the find path?
something like this?
# File: zipfind.py
import fnmatch, os, sys, zipfile
program, root, name = sys.argv
for dirpath, dirnames, filenames in
Diez B. Roggisch wrote:
This still seems not quite right to me... Or more likely seems to be
missing something still.
(But it could be this migraine I've had the last couple of days
preventing me from being able to concentrate on things with more than
a few levels of complexity.)
Steven D'Aprano wrote:
On Sun, 25 Sep 2005 14:52:56 +, Ron Adam wrote:
Steven D'Aprano wrote:
Or you could put the method in the class and have all instances recognise
it:
py C.eggs = new.instancemethod(eggs, None, C)
py C().eggs(3)
eggs * 3
Why not just add it to the class directly?
Bryan wrote:
just for fun, i looked at the top linux distros at distrowatch and looked at
what version of python the latest released version is shipping with out of
the box:
1. ubuntu hoary - python 2.4.1
2. mandriva 2005 - python 2.4
3. suse 9.3 - python 2.4
4. fedora core 4 - python
An effbot utility? I'll try that.
Thank you
--
http://mail.python.org/mailman/listinfo/python-list
It will be much easier to use asterisk, there's a win32 version aterisk
available but it does not support hardware phone, voip only.
A clone FXO card only cost $15 on ebay.
Roger [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I'm new to Python and need to do a (low level, I think)
At 03:35 PM 9/26/2005 -0700, Micah Elliott wrote:
Please read/comment/vote. This circulated as a pre-PEP proposal
submitted to c.l.py on August 10, but has changed quite a bit since
then. I'm reposting this since it is now Open (under consideration)
at http://www.python.org/peps/pep-0350.html.
Ron Adam wrote:
What I've noticed is you can block the visibility of a class attribute,
which include methods, by inserting an object in the instance with the
same name.
[snip example of this behavior]
Yes, that's true for non-data descriptors (see last two bullets below)
Raymond
I'm posting this message here, so that someone googling here will be
able to find it.
I was having problems installing cx_Oracle on Solaris. The build would
fail with a message:
ld: fatal: file /apps/oracle/prod/9.2/lib/libclntsh.so: wrong ELF class:
ELFCLASS64
I found the solution on Grig
In message [EMAIL PROTECTED], Tarek
Ziadé [EMAIL PROTECTED] writes
I am trying to find a general memory profiler that can measure the
memory usage in Python program
and gather some stats about object usages, and things like that.
Not a Python module, but Python Memory Validator may fit the bill.
Tarek Ziadé wrote:
If you want a list of all objects (container or not), you have to
compile a debug build of Python.
I am amazed not to find an existing implementation for this.
the debug build is an existing implementation, of course.
/F
--
Using Python on WinXP going against MS SQL 2000 server. Connection is
fine and I have executed several queries successfully. The following
SQL statement however gives me an error and I have tried it several
different ways:
SELECT
Le Tue, 27 Sep 2005 17:48:47 +0200, Berthold Höllmann a écrit :
I have wrapped some inhouse libraries for Python.
How ? Directly coding C code ?
The development team
uses VC6 and DF6.1 for development of these libraries under WinXP.
DF6.1 is Digital FORTRAN 6.1 ?
I
would like to wrap the
On Tue, 27 Sep 2005, Bengt Richter wrote:
5) Sometimes time of day can be handy, so maybe 2005-09-26 12:34:56
could be recognized?
ISO 8601 suggests writing date-and-times like 2005-09-26T12:34:56 - using
a T as the separator between date and time. I don't really like the look
of it, but it
On 9/27/05, Phillip J. Eby [EMAIL PROTECTED] wrote:
At 03:35 PM 9/26/2005 -0700, Micah Elliott wrote:
Please read/comment/vote. This circulated as a pre-PEP proposal
submitted to c.l.py on August 10, but has changed quite a bit since
then. I'm reposting this since it is now Open (under
Actually, after posting this I did some more work on the PQueue modules
I had, implementing both bisect and heapq versions. It turns out the
bisect version is heaps faster if you ever delete or re-set values in
the queue.
The problem is heapq is O(N) for finding a particular entry in the
Queue,
Ivan Shevanski wrote:
Thanks for your quick responce Roy, thats exactly what I needed. =)
No, it isn't! ;)
It might seem like a good idea right now, but it's not
a good choice in the long run. It's like peeing in bed:
Initially it's both a relief and you get warm and cosy,
but you'll end upp
I notice that if I use this syntax:
def classname:
...
##
# closes the database connection and releases the resources.
def close(self):
##
# Returns a list of fields
fields = property()
then doing:
help (classname)
then the text is listed
RHEL isn't really big on Distrowatch because Distrowatch is geared
more towards users.
RHEL 4.1 is using Python 2.3.4 now, btw.
--
http://mail.python.org/mailman/listinfo/python-list
Lasse Vågsæther Karlsen wrote:
So, my question is, is there a way to get __doc__ support for
properties, in effect, use the xxx syntax for documenting properties.
Yes, the property() function accepts a doc argument, as in:
property(fget, fset, fdel, doc)
ex:
MyProp = property(_get, _set,
I'm trying to extract single digit number from a string.
t[1] = '06897'
I want to get the 7, 9,8 6 seperated out to use but can't find a way
to split out the single characters.
Thanks
--
http://mail.python.org/mailman/listinfo/python-list
Paul McNett wrote:
Whatever is preferred, what's the upside/downsides of the two beyond
what I just explained?
Nothing really, but something handy to keep in mind is that the string
literal (x) can be used to block out huge sections of code during
testing, where you'd have to put a # in
Unfortunately, none of the documentation tools that use documentation
strings are suitable for full, serious documentation. There are a
number of reasons for this, and I'll touch on a few.
The obvious one is that there is no standard format for docstrings,
and this creates problems when
You can index into a string:
s = '06897'
s[2]
'8'
You can also turn each character into an integer, in various ways:
[int(c) for c in s]
[0, 6, 8, 9, 7]
map(int, s)
[0, 6, 8, 9, 7]
Jeff
pgpDMq5e3RucB.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
what about:
lst = [digit for digit in '06897']
lst
['0', '6', '8', '9', '7']
Claudio
[EMAIL PROTECTED] schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
I'm trying to extract single digit number from a string.
t[1] = '06897'
I want to get the 7, 9,8 6 seperated out to use but can't find a
Claudio Grondi wrote:
what about:
lst = [digit for digit in '06897']
lst
['0', '6', '8', '9', '7']
Or..
list('06897')
['0', '6', '8', '9', '7']
Will McGugan
--
http://www.willmcgugan.com
.join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in
jvyy*jvyyzpthtna^pbz)
--
Ian Vincent [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
line = line[20:]
line = line[:-1]
please, line = line[20:-1], etc, is easier to read and understand ;-)
tjr
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I can get through about 1750 pages of 5000 before I get a WindowsError:
stack overflow exception. Any ideas how I can keep the program chugging
along?
A typical source of stack overflow is recursion. Without seeing the code
or
Traceback (most recent call last):
File string, line 20, in ?
File c:\Python24\lib\encodings\zlib_codec.py, line 43, in zlib_decode
output = zlib.decompress(input)
zlib.error: Error -5 while decompressing data
The -5 error appears to be a Z_BUF_ERROR from looking at the manual at
Kenneth McDonald wrote:
More seriously, there is a major problem with docstrings in that they
can only document something that has a docstring; classes, functions,
methods, and modules. But what if I have constants that are
important? The only place to document them is in the module
Thanks all! This is just what I needed.
--
http://mail.python.org/mailman/listinfo/python-list
F. Petitjean [EMAIL PROTECTED] writes:
Le Tue, 27 Sep 2005 17:48:47 +0200, Berthold Höllmann a écrit :
I have wrapped some inhouse libraries for Python.
How ? Directly coding C code ?
Depends :-) f2py, directly coding C, SWIG.
The development team
uses VC6 and DF6.1 for development of
Hi
I create a canvas that is to big for the default window-size, so it gets cut
to fit...
How can I increase the window-size to make sure the canvas fits?
regards tores
--
http://mail.python.org/mailman/listinfo/python-list
SELECT
VA_MK_YEAR,VA_MK_DESCRIP,VO_VIN_NO,VO_MODEL,VO_BODY,VO_DESCRIPTION + \
FROM D014800 LEFT OUTER JOIN D014900 ON (VA_MK_NUMBER_VER =
VO_MAKE_NO) AND (VA_MK_YEAR = VO_YEAR) + \
WHERE (((VA_MK_YEAR)=?) AND ((VA_MK_DESCRIP)=?) AND
((VO_MODEL)=?))
Doesn't look like you have a space
Tor Erik Sønvisen wrote:
I create a canvas that is to big for the default window-size, so it gets cut
to fit...
what default window size? what geometry management approach are
you using?
(if you're using pack or grid, your toplevel window should adapt itself
to the canvas size, unless
I'm writing a small project and I decided to try pysqlite. The database
consists of one master table with five columns and two detail tables
with one and two columns each (not counting foreign key columns). The
program scans an input file and inserts data into those three tables.
First I used
You may want to read this scrollbar page:
http://effbot.org/zone/tkinter-scrollbar-patterns.htm
On Tuesday 27 September 2005 12:31, Tor Erik S�nvisen wrote:
Hi
I create a canvas that is to big for the default window-size, so it gets
cut to fit...
How can I increase the window-size to make
Berthold Höllmann wrote:
I'm sure ctypes doesnot work on Linux and Solaris, but my code has
to.
I've used ctypes to great effect on Linux.
--
Benji York
--
http://mail.python.org/mailman/listinfo/python-list
On Linux, this may work for you
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/286222
/Jean Brouwers
Jacek Poplawski wrote:
I need to know how much memory uses child process (after
subprocess.Popen), so I want function:
get_memory_usage(pid)
I found two ways:
- call ps and
Fredrik Lundh wrote:
Kenneth McDonald wrote:
More seriously, there is a major problem with docstrings in that they
can only document something that has a docstring; classes, functions,
methods, and modules. But what if I have constants that are
important? The only place to document them is in
Dear pythonians,
I've been reading/thinking about the famous function call speedup
trick where you use a function in the local context to represent
a remoter function to speed up the 'function lookup'.
This is especially usefull in a loop where you call the function a
zillion time they say.
Phillip J. Eby [EMAIL PROTECTED] wrote:
At 03:35 PM 9/26/2005 -0700, Micah Elliott wrote:
Please read/comment/vote. This circulated as a pre-PEP proposal
submitted to c.l.py on August 10, but has changed quite a bit since
then. I'm reposting this since it is now Open (under consideration)
Lucas Lemmens wrote:
Why isn't the result of the first function-lookup cached so that following
function calls don't need to do the function-lookup at all?
And if the context changes (an import-statement say) reset the
cached 'function-lookups'.
import isn't the only way for the context to
Lucas Lemmens wrote:
Dear pythonians,
I've been reading/thinking about the famous function call speedup
trick where you use a function in the local context to represent
a remoter function to speed up the 'function lookup'.
This is especially usefull in a loop where you call the function
I have a feeling that this is highly unlikely, but does anyone in here
know if it's possible to directly call a module, or will I have to wrap
it up in a class?
i.e.,
import MyMod
MyMod.whatever = Hi?
MyMod(meow mix)
Thanks in advance
-Wes
--
You get to spend all day in ipython?
Can I have your job?
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 27, 2005, at 12:45 PM, Kenneth McDonald wrote:
It's too bad that there is no equivalent of d'oxygen for Python. That
is a _nice_ program.
I've been using epydoc (http://epydoc.sourceforge.net) for a while now,
and it's really nice. The output is very much in the style of Javadoc.
Its
ncf wrote.
I have a feeling that this is highly unlikely, but does anyone in here
know if it's possible to directly call a module
no.
/F
--
http://mail.python.org/mailman/listinfo/python-list
Robert Kern wrote:
The one thing I dislike about PythonDoc is that it puts everything into
comments and thus docstrings are usually neglected.
teaser:
from elementtree import ElementTree
help(ElementTree)
Help on module ElementTree:
NAME
ElementTree
DESCRIPTION
# ElementTree
#
Brett Hoerner wrote:
You get to spend all day in ipython?
Can I have your job?
Well, I use the terms work and day rather loosely. I'm a graduate
student in geophysics. Somehow it rarely happens during daylight hours
and quite possibly wouldn't be called working by an outside observer.
--
I'm setting up a system that consists of several small python
applications that all communicate amongst each other on the same pc.
When running in Windows, launching each application generates a
process, and each of those processes ends up taking up 4MB of system
memory. This memory usage is as
On Tue, 27 Sep 2005 22:41:22 +0200, Fredrik Lundh wrote:
Lucas Lemmens wrote:
Why isn't the result of the first function-lookup cached so that
following function calls don't need to do the function-lookup at all?
And if the context changes (an import-statement say) reset the cached
On Tue, 27 Sep 2005 13:56:53 -0700, Michael Spencer wrote:
Lucas Lemmens wrote:
Dear pythonians,
I've been reading/thinking about the famous function call speedup trick
where you use a function in the local context to represent a remoter
function to speed up the 'function lookup'.
This
At 03:35 PM 9/26/2005 -0700, Micah Elliott wrote:
Please read/comment/vote. This circulated as a pre-PEP proposal
submitted to c.l.py on August 10, but has changed quite a bit since
then. I'm reposting this since it is now Open (under consideration)
at http://www.python.org/peps/pep-0350.html.
Nope - you can't even force it by binding a __call__ method to the
module.
For future reference, you can check to see what things *are* callable
with the built-in function 'callable'.
eg (with sys instead of MyApp):
import sys
callable(sys)
False
Also - a thing you can do to sort of do what
Qopit [EMAIL PROTECTED] writes:
When running in Windows, launching each application generates a
process, and each of those processes ends up taking up 4MB of system
memory. This memory usage is as reported by the Windows Task manager
for the python.exe image name.
The first step is to
On Monday 26 September 2005 10:25 pm, Paul Rubin wrote:
I really doubt you'll find much agreement for this (the compiler
should enforce it) position. The 'fewer conventions are better'
position might enjoy more support, but doesn't strike me as
particularly Pythonic (e.g. compare
On Monday 26 September 2005 10:24 pm, Kenneth McDonald wrote:
I have a module I'd like to document using the same style...
Google for epydoc, pydoc, and happydoc.
You've already received a comment about markup standards,
although you will find more information at the web pages
for the above
On Tuesday 27 September 2005 03:07 am, Paul Rubin wrote:
[EMAIL PROTECTED] (Bengt Richter) writes:
2) In general, I think it might be good to meet Paul Rubin half way
re convention vs syntax, but I don't think code tagging should be
part of the language syntax per se. (-*- cookies -*-
On Tuesday 27 September 2005 08:32 am, Ian Vincent wrote:
I have a webpage with a BZ2 compressed text embedded in it looking like:
'BZh91AYSYA\xaf\x82\r\x00\x00\x01\x01\x80\x02\xc0\x02\x00 \x00!\x9ah3M
\x07]\xc9\x14\xe1BA\x06\xbe\x084'
Now, if I simply copy and paste this into Python and
When reporting file sizes to the user, it's nice to print '16.1 MB',
rather than '16123270 B'. This is the behaviour the command 'df -h'
implements. There's no python function that I could find to perform this
formatting , so I've taken a stab at it:
import math
def human_readable(n, suffix='B',
On Tue, 27 Sep 2005 20:28:53 +, Claudio Grondi wrote:
what about:
lst = [digit for digit in '06897']
lst
['0', '6', '8', '9', '7']
No need to use a list comprehension when this works just as well:
py list('06897')
['0', '6', '8', '9', '7']
--
Steven.
--
On Tue, 27 Sep 2005 14:19:13 -0700, ncf wrote:
I have a feeling that this is highly unlikely, but does anyone in here
know if it's possible to directly call a module, or will I have to wrap
it up in a class?
Why not try it yourself? Write a quick module like this:
Call a module
def
ncf wrote:
I have a feeling that this is highly unlikely, but does anyone in here
know if it's possible to directly call a module, or will I have to wrap
it up in a class?
You could use trickery with sys.modules to automatically wrap it in a class:
import sys
from types import ModuleType
1 - 100 of 139 matches
Mail list logo