There were there two (2) bugs in the code that I posted. Thanks anyway.
A. J. Y.
"Vincent Vande Vyvre" kirjoitti
viestissä:mailman.3596.1352758176.27098.python-l...@python.org...
Le 12/11/12 22:02, Juhani Ylikoski a écrit :
Following comes a working, debugged Python program which computes
Terry Reedy wrote:
> On 11/12/2012 10:52 AM, Johannes Kleese wrote:
>> Tested with Python 3.1.3 and Python 3.1.4.
>
> 3.1 only gets security fixes. Consider upgrading.
Stuck with Debian on a server, thus stuck with 3.1 on development machine.
> exhibits the same behavior in 3.3.0 of printing (
On Tue, 13 Nov 2012 07:54:32 +, Some Developer wrote:
> On 13/11/2012 07:19, Steven D'Aprano wrote:
>> On Tue, 13 Nov 2012 06:38:31 +, Some Developer wrote:
>>
>>> I'm trying to find a way to get a string of the module path of a
>>> class.
>>>
>>> So for instance say I have class Foo and i
Dear Group,
To improve my code writing I am trying to read good codes. Now, I have received
a code,as given below,(apology for slight indentation errors) the code is
running well.
Now to comprehend the code, I am looking to understand it completely.
class Calculate:
def __init__(self):
On 11/12/2012 09:45 PM, Caroline Hou wrote:
>
> Hi Dave!
>
> thank you very much for your quick reply! I did manage to get the program run
> from cmd.exe.
> So does it mean that if I want to use python interactively,I should use the
> interpreter,while if I just want to run a python program,
On 11/13/2012 01:38 AM, Some Developer wrote:
> I'm trying to find a way to get a string of the module path of a class.
>
> So for instance say I have class Foo and it is in a module called
> my.module. I want to be able to get a string that is equal to this:
> "my.module.Foo". I'm aware of the __r
subhabangal...@gmail.com wrote:
> Dear Group,
> To improve my code writing I am trying to read good codes. Now, I have
> received a code,as given below,(apology for slight indentation errors) the
> code is running well. Now to comprehend the code, I am looking to
> understand it completely.
>
> c
Fellows,
I'm having problems understanding an issue with passing function as parameters.
I'm sending some functions to the multiprocessing module (python 2.5 with the
proper backport).
I'm iterating on a list of functions, however it seems that only the last
function implementation is used for
Thanks, I'm starting to plan now, so I'm still confused with the production
code, but what I need is to divide array 2x2 or 3x3.
I still can not!
2012/11/12 Joshua Landau
> On 13 November 2012 01:00, Cleuson Alves wrote:
>
>> Hello, I need to solve an exercise follows, first calculate the inv
On Tuesday, 13 November 2012 08:15:45 UTC+5:30, Caroline Hou wrote:
> On Monday, 12 November 2012 21:25:08 UTC-5, Dave Angel wrote:
>
> > On 11/12/2012 09:02 PM, Caroline Hou wrote:
>
> >
>
> > > Hi all!
>
> >
>
> > >
>
> >
>
> > > I just started learning Python by myself and I have an
On 2012-11-13 12:19, Jean-Michel Pichavant wrote:
Fellows,
I'm having problems understanding an issue with passing function as parameters.
I'm sending some functions to the multiprocessing module (python 2.5 with the
proper backport).
I'm iterating on a list of functions, however it seems that
Jean-Michel Pichavant wrote:
> I'm having problems understanding an issue with passing function as
> parameters.
> Here's a code that triggers the issue:
>
>
> import multiprocessing
>
> def f1():
> print 'I am f1'
> def f2(foo):
> print 'I am f2 %s' % foo
>
> workers = [
> (
On Tue, 13 Nov 2012 03:08:54 +, Mark Lawrence wrote:
> http://stackoverflow.com/questions/tagged/python
>
> "Python has two major versions (2 and 3) in use which have significant
> differences."
>
> I believe that this is incorrect. The warts have been removed, but
> significant differences
Le mardi 13 novembre 2012 06:42:19 UTC+1, Steven D'Aprano a écrit :
> On Tue, 13 Nov 2012 03:08:54 +, Mark Lawrence wrote:
>
>
>
>
> * strings are now proper text strings (Unicode), not byte strings;
>
Let me laugh.
jmf
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, Nov 12, 2012 at 11:41:59PM +, Joshua Landau wrote:
>
> Dict comprehension:
> {i:[] for i in ["Test 1", "Test 2", "Test 3"]}
In Python 2.6 this syntax is not supported. You can achieve the same
there via
dict((i, []) for i in ['Test 1', 'Test 2', 'Test 3'])
Also have a look at ``coll
On Friday, November 9, 2012 12:54:56 PM UTC, Artie Ziff wrote:
> Hello,
>
>
>
> I want to process XML-like data like this:
>
>
>
>
>
>
>
> ACPI (Advanced Control Power & Integration) testscript for 2.5
> kernels.
>
>
>
> <\description>
>
>
>
>
Hi!
At our IT department we've developed a basic templating system for web
apps in the spirit of Meld3 (which appears to have been abandoned some
time ago), based on lxml. Here's what we like about it:
* It's just a library, not a template language
* It uses templates that are valid XHTML
* I
Is there some way to get more informative error messages from the
builtin format?
Most messages are such as:
Traceback (most recent call last):
File "", line 1, in
ValueError: Invalid conversion specification
This example doesn't point to the first invalid case.
[Dbg]>>> format((25, 31),'{0
On 13 November 2012 12:51, Peter Otten <__pete...@web.de> wrote:
> Jean-Michel Pichavant wrote:
>
>> I'm having problems understanding an issue with passing function as
>> parameters.
>
>> Here's a code that triggers the issue:
>>
>>
>> import multiprocessing
>>
>> def f1():
>> print 'I am f1'
On 13/11/2012 13:21, wxjmfa...@gmail.com wrote:
Le mardi 13 novembre 2012 06:42:19 UTC+1, Steven D'Aprano a écrit :
On Tue, 13 Nov 2012 03:08:54 +, Mark Lawrence wrote:
* strings are now proper text strings (Unicode), not byte strings;
Let me laugh.
jmf
Presumably because you'r
On Tue, Nov 13, 2012 at 3:31 AM, andrea crotti
wrote:
> but it's a bit ugly. I wonder if I can use the subprocess PIPEs to do
> the same thing, is it going to be as fast and work in the same way??
It'll look something like this:
>>> p1 = subprocess.Popen(cmd1, shell=True, stdout=subprocess.PIPE
On 13/11/2012 08:49, Steven D'Aprano wrote:
On Tue, 13 Nov 2012 07:54:32 +, Some Developer wrote:
On 13/11/2012 07:19, Steven D'Aprano wrote:
On Tue, 13 Nov 2012 06:38:31 +, Some Developer wrote:
I'm trying to find a way to get a string of the module path of a
class.
So for instance
Oscar Benjamin wrote:
> I don't know if this is to do with the way that the code was
> simplified before posting but this subproc function wrapper does
> nothing (even after Peter fixed it below). This code is needlessly
> complicated for what it does.
Jean-Michel's Post had the following comment
On 13/11/2012 09:36, Dave Angel wrote:
On 11/13/2012 01:38 AM, Some Developer wrote:
I'm trying to find a way to get a string of the module path of a class.
So for instance say I have class Foo and it is in a module called
my.module. I want to be able to get a string that is equal to this:
"my.
On Tue, Nov 13, 2012 at 9:07 AM, Ian Kelly wrote:
> It'll look something like this:
>
p1 = subprocess.Popen(cmd1, shell=True, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
p2 = subprocess.Popen(cmd2, shell=True, stdin=p1.stdout,
stdout=subprocess.PIPE, stderr=subprocess.PIP
On Tue, Nov 13, 2012 at 9:25 AM, Ian Kelly wrote:
> Sorry, the example I gave above is wrong. If you're calling
> p1.communicate(), then you need to first remove the p1.stdout pipe
> from the Popen object. Otherwise, the communicate() call will try to
> read data from it and may "steal" input fr
wxjmfa...@gmail.com wrote:
Le mardi 13 novembre 2012 06:42:19 UTC+1, Steven D'Aprano a écrit :
On Tue, 13 Nov 2012 03:08:54 +, Mark Lawrence wrote:
* strings are now proper text strings (Unicode), not byte strings;
Let me laugh.
*plonk*
--
http://mail.python.org/mailman/listinfo/python-l
On 11/09/2012 07:54 AM, Artie Ziff wrote:
> Hello,
>
> I want to process XML-like data like this:
>
>
>
> ACPI (Advanced Control Power & Integration) testscript for 2.5
> kernels.
>
> <\description>
>
> ltp/testcases/kernel/device-drivers/acpi/ltpacpi.sh
> <\test_
[image: Akiban]
*Upcoming Webinar:*
"SQLAlchemy Creator Mike Bayer on How and Why to Integrate Akiban and
SQLAlchemy"
Hi guys,
I wanted to take a minute and invite you and the Python user group to our
next free webinar on SQLAchemy:
Presented by: Mike Bayer, Creator of SQLAchemy,Ori Herrnstadt,
On 11/06/2012 03:12 PM, iMath wrote:
how to get a list of names of everything in the current directory ?
Start by working through the tutorial to get familiar with python at
http://docs.python.org/2/tutorial/
then for your specific question, review the content at
http://www.diveintopyt
Am 13.11.2012 14:21 schrieb wxjmfa...@gmail.com:
* strings are now proper text strings (Unicode), not byte strings;
Let me laugh.
Do so.
Thomas
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 13 Nov 2012 10:08:59 -0500, Colin J. Williams wrote:
> Is there some way to get more informative error messages from the
> builtin format?
Yes -- post a feature request on the Python bug tracker, then wait until
Python 3.4 comes out in about 16 months.
:(
> Most messages are such as:
- Original Message -
> Oscar Benjamin wrote:
>
> > I don't know if this is to do with the way that the code was
> > simplified before posting but this subproc function wrapper does
> > nothing (even after Peter fixed it below). This code is needlessly
> > complicated for what it does.
>
>
Am 09.11.2012 02:12 schrieb Hans Mulder:
That's what 'xargs' will do for you. All you need to do, is invoke
xargs with arguments containing '{}'. I.e., something like:
cmd1 = ['tar', '-czvf', 'myfile.tgz', '-c', mydir, 'mysubdir']
first_process = subprocess.Popen(cmd1, stdout=subprocess.PIPE)
This site is intended for all horror fans.
The site have been collected and collected links to horror fans
and joining a membership you can add the best moments of
terror. http://horrorhorrorhorror.webs.com/
--
http://mail.python.org/mailman/listinfo/python-list
On 13/11/2012 1:38 PM, Steven D'Aprano wrote:
On Tue, 13 Nov 2012 10:08:59 -0500, Colin J. Williams wrote:
Is there some way to get more informative error messages from the
builtin format?
Yes -- post a feature request on the Python bug tracker, then wait until
Python 3.4 comes out in about 1
On Wed, Nov 14, 2012 at 5:16 AM, emile wrote:
> BTW, googling for "python how to get a list of names of everything in the
> current directory" yields some good information as well. Google is your
> friend for this level of question. Not sure anymore beyond that...
It yields it? You mean Google
In Chris Angelico
writes:
> It yields it? You mean Google is an iterator?
ITYM generator.
--
John Gordon A is for Amy, who fell down the stairs
gor...@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb
On 11/13/2012 03:24 PM, Colin J. Williams wrote:
>
>
> I am working on the assumption that the first argument of the format
> builtin function and be a sequence of values, which can be selected
> with {1:}, {2:}, {0:} etc.
>
> The docs don't make this clear. I would appreciate advice.
>
The buil
On Wed, Nov 14, 2012 at 8:05 AM, John Gordon wrote:
> In Chris Angelico
> writes:
>
>> It yields it? You mean Google is an iterator?
>
> ITYM generator.
Yeah, that thing.
Troll fail.
*whoops*
ChrisA
--
http://mail.python.org/mailman/listinfo/python-list
On 11/13/2012 01:19 PM, Chris Angelico wrote:
Troll fail.
*whoops*
*sigh* mine too.
Emile
--
http://mail.python.org/mailman/listinfo/python-list
Am 12.11.2012 19:30 schrieb Hans Mulder:
This will break if there are spaces in the file name, or other
characters meaningful to the shell. If you change if to
xargsproc.append("test -f '%s/{}'&& md5sum '%s/{}'"
% (mydir, mydir))
, then it will only bre
On 13/11/2012 4:18 PM, Dave Angel
wrote:
On 11/13/2012 03:24 PM, Colin J. Williams wrote:
I am working on the assumption that the first argument of the format
builtin function and be a sequence of values, which can be selected
with {1:}, {2:},
On Tue, Nov 13, 2012 at 1:00 AM, Cleuson Alves wrote:
> Hello, I need to solve an exercise follows, first calculate the inverse
> matrix and then multiply the first matrix.
I would just point out that in most numerical applications, you rarely
need to calculate the intermediate of the matrix inv
On Tue, 13 Nov 2012 15:24:53 -0500, Colin J. Williams wrote:
> On 13/11/2012 1:38 PM, Steven D'Aprano wrote:
>> On Tue, 13 Nov 2012 10:08:59 -0500, Colin J. Williams wrote:
>>
>>> Is there some way to get more informative error messages from the
>>> builtin format?
>>
>> Yes -- post a feature requ
Hello,
I want to create a URL-safe unique ID for URL's.
Currently I use:
url_id = base64.urlsafe_b64encode(url)
>>> base64.urlsafe_b64encode('docs.python.org/library/uuid.html')
'ZG9jcy5weXRob24ub3JnL2xpYnJhcnkvdXVpZC5odG1s'
I would prefer more concise ID's.
What do you recommend? - Compression
In <0692e6a2-343c-4eb0-be57-fe5c815ef...@googlegroups.com> Richard
writes:
> I want to create a URL-safe unique ID for URL's.
> Currently I use:
> url_id = base64.urlsafe_b64encode(url)
> >>> base64.urlsafe_b64encode('docs.python.org/library/uuid.html')
> 'ZG9jcy5weXRob24ub3JnL2xpYnJhcnkvdXVpZC
Hi Guys,
I am trying to create a script which will zip a bunch of files that I have
obtained using the 'glob'
So I have a bunch of files,
glob.glob("shp/file1*)
And I want to zip all the files which are returned by the above command.
How can I do that? Is there a zip library in python?
--
Tha
Good point - one way encoding would be fine.
Also this is performed millions of times so ideally efficient.
On Wednesday, November 14, 2012 10:34:03 AM UTC+11, John Gordon wrote:
> In <0692e6a2-343c-4eb0-be57-fe5c815ef...@googlegroups.com> Richard
> writes:
>
>
>
> > I want to create a URL-
One option would be using a hash. Python's built-in hash, a 32-bit
CRC, 128-bit MD5, 256-bit SHA or one of the many others that exist,
depending on the needs. Higher bit counts will reduce the odds of
accidental collisions; cryptographically secure ones if outside
attacks matter. In such a case, yo
I am trying to open a file in 'w' mode open('file', 'wb'). open() will throw
with IOError with errno 13 if the file is locked by another application or if
user does not have permission to open/write to the file.
How can I distinguish these two cases ? Namely, if some application has the
file o
On 13/11/2012 23:52, Smaran Harihar wrote:
Hi Guys,
I am trying to create a script which will zip a bunch of files that I have
obtained using the 'glob'
So I have a bunch of files,
glob.glob("shp/file1*)
And I want to zip all the files which are returned by the above command.
How can I do tha
I found the MD5 and SHA hashes slow to calculate.
The builtin hash is fast but I was concerned about collisions. What
rate of collisions could I expect?
Outside attacks not an issue and multiple processes would be used.
On Wed, Nov 14, 2012 at 11:26 AM, Chris Kaynor wrote:
> One option would be
Am 14.11.2012 01:26, schrieb Chris Kaynor:
> One option would be using a hash. Python's built-in hash, a 32-bit
> CRC, 128-bit MD5, 256-bit SHA or one of the many others that exist,
> depending on the needs. Higher bit counts will reduce the odds of
> accidental collisions; cryptographically secure
These URL ID's would just be used internally for quick lookups, not exposed
publicly in a web application.
Ideally I would want to avoid collisions altogether. But if that means
significant extra CPU time then 1 collision in 10 million hashes would be
tolerable.
--
http://mail.python.org/mailm
Am 14.11.2012 01:41, schrieb Richard Baron Penman:
> I found the MD5 and SHA hashes slow to calculate.
> The builtin hash is fast but I was concerned about collisions. What
> rate of collisions could I expect?
Seriously? It takes about 1-5msec to sha1() one MB of data on a modern
CPU, 1.5 on my bo
Am 14.11.2012 01:50, schrieb Richard:
> These URL ID's would just be used internally for quick lookups, not exposed
> publicly in a web application.
>
> Ideally I would want to avoid collisions altogether. But if that means
> significant extra CPU time then 1 collision in 10 million hashes would
On 14/11/2012 00:33, Ali Akhavan wrote:
I am trying to open a file in 'w' mode open('file', 'wb'). open() will throw
with IOError with errno 13 if the file is locked by another application or if
user does not have permission to open/write to the file.
How can I distinguish these two cases ? Na
I found md5 / sha 4-5 times slower than hash. And base64 a lot slower.
No database or else I would just use their ID.
On Wednesday, November 14, 2012 11:59:55 AM UTC+11, Christian Heimes wrote:
> Am 14.11.2012 01:41, schrieb Richard Baron Penman:
>
> > I found the MD5 and SHA hashes slow to cal
In article <0692e6a2-343c-4eb0-be57-fe5c815ef...@googlegroups.com>,
Richard wrote:
> Hello,
>
> I want to create a URL-safe unique ID for URL's.
> Currently I use:
> url_id = base64.urlsafe_b64encode(url)
>
> >>> base64.urlsafe_b64encode('docs.python.org/library/uuid.html')
> 'ZG9jcy5weXRob24u
I am dealing with URL's rather than integers
--
http://mail.python.org/mailman/listinfo/python-list
So the use case - I'm storing webpages on disk and want a quick retrieval
system based on URL.
I can't store the files in a single directory because of OS limitations so have
been using a sub folder structure.
For example to store data at URL "abc": a/b/c/index.html
This data is also viewed loca
> The next step is to reduce the number of bits you are encoding. You
>
> said in another post that "1 collision in 10 million hashes would be
>
> tolerable". So you need:
>
>
>
> >>> math.log(10*1000*1000, 2)
>
> 23.25349666421154
I think a difficulty would be finding a hash algorithm
On Tuesday, November 13, 2012 7:35:32 AM UTC-5, Ramchandra Apte wrote:
> On Tuesday, 13 November 2012 08:15:45 UTC+5:30, Caroline Hou wrote:
>
> > On Monday, 12 November 2012 21:25:08 UTC-5, Dave Angel wrote:
>
> >
>
> > > On 11/12/2012 09:02 PM, Caroline Hou wrote:
>
> >
>
> > >
>
> >
In article <1ce88f36-bfc7-4a55-89f8-70d1645d2...@googlegroups.com>,
Richard wrote:
> So the use case - I'm storing webpages on disk and want a quick retrieval
> system based on URL.
> I can't store the files in a single directory because of OS limitations so
> have been using a sub folder str
thanks for pointer to Varnish.
I found MongoDB had a lot of size overhead so that it ended up using 4x the
data stored.
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Nov 14, 2012 at 2:25 PM, Richard wrote:
> So the use case - I'm storing webpages on disk and want a quick retrieval
> system based on URL.
> I can't store the files in a single directory because of OS limitations so
> have been using a sub folder structure.
> For example to store data at
On Wed, Nov 14, 2012 at 2:31 PM, Caroline Hou wrote:
> Thank you Dave and everybody here for your helpful comments!This place is
> awesome! I found this group when I googled python-list. Seems like this is
> not the usual way you guys access the list?
There are several ways to communicate with
yeah good point - I have gone with md5 for now.
On Wednesday, November 14, 2012 3:06:18 PM UTC+11, Chris Angelico wrote:
> On Wed, Nov 14, 2012 at 2:25 PM, Richard wrote:
>
> > So the use case - I'm storing webpages on disk and want a quick retrieval
> > system based on URL.
>
> > I can't sto
I need to time the operation of a command-line utility (specifically nslookup)
from within a python program I'm writing. I don't want to use python's timeit
function because I'd like to avoid python's subprocess creation overhead. That
leads me to the standard UNIX time function. So for examp
In article ,
w...@mac.com wrote:
> I need to time the operation of a command-line utility (specifically
> nslookup) from within a python program I'm writing.
Ugh. Why are you doing this? Shelling out to nslookup is an incredibly
slow and clumsy way of doing name translation. What you really
On 11/13/2012 09:10 PM, Chris Angelico wrote:
> On Wed, Nov 14, 2012 at 2:31 PM, Caroline Hou wrote:
>> Thank you Dave and everybody here for your helpful comments!This
>> place is awesome! I found this group when I googled python-list.
>> Seems like this is not the usual way you guys access the li
On Wed, Nov 14, 2012 at 4:08 PM, wrote:
> On 11/13/2012 09:10 PM, Chris Angelico wrote:
>> * Use a news-to-web gateway such as Google Groups. That
>> specific one is deprecated on this list, as there's more
>> noise than signal from Google Groups.
>
> Caroline, Chris is mistaken about this, if fo
On Nov 13, 2012, at 11:41 PM, Roy Smith wrote:
> In article ,
> w...@mac.com wrote:
>
>> I need to time the operation of a command-line utility (specifically
>> nslookup) from within a python program I'm writing.
>
> Ugh. Why are you doing this? Shelling out to nslookup is an incredibly
> s
Ian Kelly writes:
> On Tue, Nov 13, 2012 at 3:31 AM, andrea crotti
> wrote:
>> but it's a bit ugly. I wonder if I can use the subprocess PIPEs to do
>> the same thing, is it going to be as fast and work in the same way??
>
> It'll look something like this:
>
p1 = subprocess.Popen(cmd1, she
w...@mac.com writes:
> I need to time the operation of a command-line utility (specifically
> nslookup) from within a python program I'm writing. I don't want to use
> python's timeit function because I'd like to avoid python's subprocess
> creation overhead. That leads me to the standard UNI
On 14/11/2012 06:35, Amit Agrawal wrote:
my problem is, i want to access data in spreadsheet to python code manualy
My data is
1/1982 8:00:00 0
Please tell us your spreadsheet (CSV file, M$ Excel, OS X Numbers,
what?), your OS and Python version, and what exactly you're trying to
achieve, t
On 11/13/2012 11:02 PM, Chris Angelico wrote:
> On Wed, Nov 14, 2012 at 4:08 PM, rurpy wrote:
>> On 11/13/2012 09:10 PM, Chris Angelico wrote:
>>> * Use a news-to-web gateway such as Google Groups. That
>>> specific one is deprecated on this list, as there's more
>>> noise than signal from Google G
w...@mac.com wrote:
>...
>However, if I try the same operation in the python interpreter using
>subprocess.Popen like so:
>
import subprocess
result = subprocess.Popen(['time', 'nslookup', 'www.es.net', '8.8.4.4'],
shell = False, stdout = subprocess.PIPE, stderr =
subprocess.
On Tue, Nov 13, 2012 at 11:05 PM, Kushal Kumaran
wrote:
> Or, you could just change the p1's stderr to an io.BytesIO instance.
> Then call p2.communicate *first*.
This doesn't seem to work.
>>> b = io.BytesIO()
>>> p = subprocess.Popen(["ls", "-l"], stdout=b)
Traceback (most recent call last):
On Nov 14, 12:02 pm, ru...@yahoo.com wrote:
>
> ==
> [*] Actually, now that I think about it, IIRC one can sign
> up for python-list email, and go into the mailman settings
> and disable mail delivery, allowing one to post to the list
> via email yet read the list via GG, Gmane or whatever.
> Howev
81 matches
Mail list logo