Hi Smaran,
Am Do, 9. Aug 2012, um 23:52, schrieb Smaran Harihar:
> I am trying to create a simple cgi-script to receive a Ajax
> call, manipulate the string received and send it back as JSON.
I can recommend bottle. The following example manipulates a JSON request
body and returns it. That is *mu
Andrew Cooper於 2012年8月10日星期五UTC+8上午6時03分26秒寫道:
> On 09/08/2012 22:34, Roman Vashkevich wrote:
>
> > Actually, they are different.
>
> > Put a dict.{iter}items() in an O(k^N) algorithm and make it a hundred
> > thousand entries, and you will feel the difference.
>
> > Dict uses hashing to get a
On Fri, Aug 10, 2012 at 10:16 AM, Tim Chase
wrote:
> We apologise for the off-topicness in the thread. Those responsible
> have been sacked...
So if you take every mapping variable in your program and name them
"dFoo", "dBar", "dQuux", etc, for "dict"... would that be a dirty
Hungarian dictionar
On 08/09/2012 08:16 PM, Tim Chase wrote:
> On 08/09/12 18:33, Mark Lawrence wrote:
>> On 10/08/2012 00:24, Roy Smith wrote:
... you mean, Python lets you make a hash of it?
>>> Only if you order it with spam, spam, spam, spam, spam, spam, and spam.
>> Now now gentlemen we're getting slightly o
On 08/09/12 18:33, Mark Lawrence wrote:
> On 10/08/2012 00:24, Roy Smith wrote:
>>> ... you mean, Python lets you make a hash of it?
>>
>> Only if you order it with spam, spam, spam, spam, spam, spam, and spam.
>
> Now now gentlemen we're getting slightly off topic here and wouldn't
> want to ups
On Aug 10, 2012 12:34 AM, "Giuseppe Amatulli"
wrote:
>
> Ciao,
> is 12 minutes for 5000x5000 pixel image. half of the time is for
> reading the arrays.
> and the other half for making the loop.
> I will try again to incorporate the mask action in the loop
> and
> read the image line by line.
> Tha
On 08/09/2012 06:53 PM, Chris Angelico wrote:
> On Fri, Aug 10, 2012 at 8:26 AM, Dave Angel wrote:
>> On 08/09/2012 06:03 PM, Andrew Cooper wrote:
>>> O(n) for all other entries in the dict which suffer a hash collision
>>> with the searched entry.
>>>
>>> True, a sensible choice of hash function
On 08/09/2012 06:54 PM, Andrew Cooper wrote:
> On 09/08/2012 23:26, Dave Angel wrote:
>> On 08/09/2012 06:03 PM, Andrew Cooper wrote:
>>> On 09/08/2012 22:34, Roman Vashkevich wrote:
Actually, they are different.
Put a dict.{iter}items() in an O(k^N) algorithm and make it a hundred
On 10/08/2012 00:24, Roy Smith wrote:
In article ,
Chris Angelico wrote:
On Fri, Aug 10, 2012 at 9:05 AM, Roy Smith wrote:
Python assumes you are a consenting adult. If you wish to engage in
activities which are hazardous to your health, so be it.
... you mean, Python lets you make a ha
In article ,
Chris Angelico wrote:
> On Fri, Aug 10, 2012 at 9:05 AM, Roy Smith wrote:
> > Python assumes you are a consenting adult. If you wish to engage in
> > activities which are hazardous to your health, so be it.
>
> ... you mean, Python lets you make a hash of it?
>
Only if you orde
On Fri, Aug 10, 2012 at 9:05 AM, Roy Smith wrote:
> Python assumes you are a consenting adult. If you wish to engage in
> activities which are hazardous to your health, so be it.
... you mean, Python lets you make a hash of it?
*ducks for cover*
ChrisA
--
http://mail.python.org/mailman/listin
> What do you think? is there a way to speed up the process?
> Thanks
> Giuseppe
Which part is slow? How slow is it?
A simple test to find the slow part of your code is to print messages
between the commands so that you can see how long it takes between each
message.
Oscar.
--
http://mail.pytho
In article ,
Andrew Cooper wrote:
> As for poor implementations,
>
> class Foo(object):
> def __hash__(self):
> return 0
>
> I seriously found that in some older code I had the misfortune of
> reading.
Python assumes you are a consenting adult. If you wish to engage in
activitie
On Fri, Aug 10, 2012 at 8:39 AM, Tim Chase
wrote:
> On 08/09/12 17:26, Dave Angel wrote:
>> On 08/09/2012 06:03 PM, Andrew Cooper wrote:
>> I'm glad you're wrong for CPython's dictionaries. The only time the
>> lookup would degenerate to O[n] would be if the hash table had only one
>> slot. CPyt
On 09/08/2012 23:26, Dave Angel wrote:
> On 08/09/2012 06:03 PM, Andrew Cooper wrote:
>> On 09/08/2012 22:34, Roman Vashkevich wrote:
>>> Actually, they are different.
>>> Put a dict.{iter}items() in an O(k^N) algorithm and make it a hundred
>>> thousand entries, and you will feel the difference.
On Fri, Aug 10, 2012 at 8:26 AM, Dave Angel wrote:
> On 08/09/2012 06:03 PM, Andrew Cooper wrote:
>> O(n) for all other entries in the dict which suffer a hash collision
>> with the searched entry.
>>
>> True, a sensible choice of hash function will reduce n to 1 in common
>> cases, but it becomes
On Thu, Aug 9, 2012 at 3:26 PM, Dave Angel wrote:
> On 08/09/2012 06:03 PM, Andrew Cooper wrote:
>> On 09/08/2012 22:34, Roman Vashkevich wrote:
>>> Actually, they are different.
>>> Put a dict.{iter}items() in an O(k^N) algorithm and make it a hundred
>>> thousand entries, and you will feel the
On 08/09/12 17:26, Dave Angel wrote:
> On 08/09/2012 06:03 PM, Andrew Cooper wrote:
> I'm glad you're wrong for CPython's dictionaries. The only time the
> lookup would degenerate to O[n] would be if the hash table had only one
> slot. CPython sensibly increases the hash table size when it become
On 08/09/2012 06:03 PM, Andrew Cooper wrote:
> On 09/08/2012 22:34, Roman Vashkevich wrote:
>> Actually, they are different.
>> Put a dict.{iter}items() in an O(k^N) algorithm and make it a hundred
>> thousand entries, and you will feel the difference.
>> Dict uses hashing to get a value from the
On 09/08/2012 22:34, Roman Vashkevich wrote:
> Actually, they are different.
> Put a dict.{iter}items() in an O(k^N) algorithm and make it a hundred
> thousand entries, and you will feel the difference.
> Dict uses hashing to get a value from the dict and this is why it's O(1).
>
Sligtly off top
10.08.2012, в 1:47, Dave Angel написал(а):
> On 08/09/2012 05:34 PM, Roman Vashkevich wrote:
>> Actually, they are different.
>> Put a dict.{iter}items() in an O(k^N) algorithm and make it a hundred
>> thousand entries, and you will feel the difference.
>> Dict uses hashing to get a value from th
Thanks a lot for the clarification.
Actually my problem is giving to raster dataset in geo-tif format find out
unique pair combination, count the number of observation
unique combination in rast1, count the number of observation
unique combination in rast2, count the number of observation
I try di
Hi Guys,
I am trying to create a simple cgi-script to receive a Ajax
call, manipulate the string received and send it back as JSON.
Most of the people I have spoken to, seemed to be against using the cgi
script, but most of the documentation and tutorials seem to point to cgi
for AJAX calls. They
On Thu, Aug 9, 2012 at 2:34 PM, Roman Vashkevich wrote:
>
> Actually, they are different.
> Put a dict.{iter}items() in an O(k^N) algorithm and make it a hundred
> thousand entries, and you will feel the difference.
> Dict uses hashing to get a value from the dict and this is why it's O(1).
>
Us
I realized, I should have done 10, 100, 1000 rather than 1, 10, 100
for better results, so here are the results for 1000 items. It still
maintains the same pattern:
>>> timeit.timeit('for i in d: pass', 'd=dict.fromkeys(range(1000))')
10.166595947685153
>>> timeit.timeit('for i in d.iteritems(): p
On 08/09/2012 05:34 PM, Roman Vashkevich wrote:
> Actually, they are different.
> Put a dict.{iter}items() in an O(k^N) algorithm and make it a hundred
> thousand entries, and you will feel the difference.
> Dict uses hashing to get a value from the dict and this is why it's O(1).
Sure, that's wh
On 8/9/2012 5:21 PM, Tim Chase wrote:
On 08/09/12 15:41, Roman Vashkevich wrote:
10.08.2012, в 0:35, Tim Chase написал(а):
On 08/09/12 15:22, Roman Vashkevich wrote:
{(4, 5): 1, (5, 4): 1, (4, 4): 2, (2, 3): 1, (4, 3): 2}
and i want to print to a file without the brackets comas and semicolon i
On 8/9/2012 4:06 PM, giuseppe.amatu...@gmail.com wrote:
Terry and MRAB,
thanks for yours suggestions,
in the end i found this solution
mask=( a != 0 ) & ( b != 0 )
a_mask=a[mask]
b_mask=b[mask]
array2D = np.array(zip(a_mask,b_mask))
unique=dict()
for row in array2D :
row = tuple(row)
Actually, they are different.
Put a dict.{iter}items() in an O(k^N) algorithm and make it a hundred thousand
entries, and you will feel the difference.
Dict uses hashing to get a value from the dict and this is why it's O(1).
10.08.2012, в 1:21, Tim Chase написал(а):
> On 08/09/12 15:41, Roman V
On 08/09/2012 04:06 PM, giuseppe.amatu...@gmail.com wrote:
>
>
> print unique
> {(4, 5): 1, (5, 4): 1, (4, 4): 2, (2, 3): 1, (4, 3): 2}
>
> I choose this solution because i could not install "from collections import
> Counter".
Nothing to install, at least for Python 2.7. collections is in the
On 08/09/12 15:41, Roman Vashkevich wrote:
> 10.08.2012, в 0:35, Tim Chase написал(а):
>> On 08/09/12 15:22, Roman Vashkevich wrote:
{(4, 5): 1, (5, 4): 1, (4, 4): 2, (2, 3): 1, (4, 3): 2}
and i want to print to a file without the brackets comas and semicolon in
order to obtain some
On 09/08/2012 21:41, Roman Vashkevich wrote:
dict.items() is a list - linear access time whereas with 'for key in dict:'
access time is constant:
http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html#use-in-where-possible-1
10.08.2012, в 0:35, Tim Chase написал(а):
On 08/09/1
dict.items() is a list - linear access time whereas with 'for key in dict:'
access time is constant:
http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html#use-in-where-possible-1
10.08.2012, в 0:35, Tim Chase написал(а):
> On 08/09/12 15:22, Roman Vashkevich wrote:
>>> {(4, 5):
On 08/09/2012 10:11 PM, giuseppe.amatu...@gmail.com wrote:
Hi,
I have a dict() unique
like this
{(4, 5): 1, (5, 4): 1, (4, 4): 2, (2, 3): 1, (4, 3): 2}
and i want to print to a file without the brackets comas and semicolon in order
to obtain something like this?
4 5 1
5 4 1
4 4 2
2 3 1
4 3 2
Any
thanks for the fast replies
my testing were very closed to yours but i did not know how to print
the the number after the semicolon!
thanks!
On 9 August 2012 15:25, Oscar Benjamin wrote:
>
> On Aug 9, 2012 9:17 PM, wrote:
>>
>> Hi,
>> I have a dict() unique
>> like this
>> {(4, 5): 1, (5, 4): 1
thanks for the fast replies
my testing were very closed to yours but i did not know how
On 9 August 2012 15:25, Oscar Benjamin wrote:
>
> On Aug 9, 2012 9:17 PM, wrote:
>>
>> Hi,
>> I have a dict() unique
>> like this
>> {(4, 5): 1, (5, 4): 1, (4, 4): 2, (2, 3): 1, (4, 3): 2}
>> and i want to pr
On 08/09/12 15:22, Roman Vashkevich wrote:
>> {(4, 5): 1, (5, 4): 1, (4, 4): 2, (2, 3): 1, (4, 3): 2}
>> and i want to print to a file without the brackets comas and semicolon in
>> order to obtain something like this?
>> 4 5 1
>> 5 4 1
>> 4 4 2
>> 2 3 1
>> 4 3 2
>
> for key in dict:
> prin
On Aug 9, 2012 9:17 PM, wrote:
>
> Hi,
> I have a dict() unique
> like this
> {(4, 5): 1, (5, 4): 1, (4, 4): 2, (2, 3): 1, (4, 3): 2}
> and i want to print to a file without the brackets comas and semicolon in
order to obtain something like this?
> 4 5 1
> 5 4 1
> 4 4 2
> 2 3 1
> 4 3 2
> Any ideas
for key in dict:
print key[0], key[1], dict[key]
10.08.2012, в 0:11, giuseppe.amatu...@gmail.com написал(а):
> Hi,
> I have a dict() unique
> like this
> {(4, 5): 1, (5, 4): 1, (4, 4): 2, (2, 3): 1, (4, 3): 2}
> and i want to print to a file without the brackets comas and semicolon in
> ord
Hi,
I have a dict() unique
like this
{(4, 5): 1, (5, 4): 1, (4, 4): 2, (2, 3): 1, (4, 3): 2}
and i want to print to a file without the brackets comas and semicolon in order
to obtain something like this?
4 5 1
5 4 1
4 4 2
2 3 1
4 3 2
Any ideas?
Thanks in advance
Giuseppe
--
http://mail.python.o
Terry and MRAB,
thanks for yours suggestions,
in the end i found this solution
mask=( a != 0 ) & ( b != 0 )
a_mask=a[mask]
b_mask=b[mask]
array2D = np.array(zip(a_mask,b_mask))
unique=dict()
for row in array2D :
row = tuple(row)
if row in unique:
unique[row] += 1
else:
On 8/9/2012 5:50 AM, Jean-Michel Pichavant wrote:
Chris Angelico wrote:
On Thu, Aug 9, 2012 at 7:05 PM, Jean-Michel Pichavant
wrote:
bruceg113...@gmail.com wrote:
I cannot change the function definition.
or better (imo)
testData(z) and make testData handle a list (8 parameters, that's a
lot
Alister wrote:
[putolin]
> some people read these threads to learn general concepts & not to find
> answers to a single explicit case.
Some people (me) don't know the first thing about python and are in the
learning/exploratory phase.
--
http://mail.python.org/mailman/listinfo/python-list
On 8/9/2012 1:39 PM, Dennis Lee Bieber wrote:
On Thu, 09 Aug 2012 16:15:33 +0100, lipska the kat
declaimed the following in
gmane.comp.python.general:
in the examples in this chapter we see usage examples for
socketserver.BaseRequestHandler
So far as I can tell, all RequestHandler
On 08/09/2012 02:37 PM, lipska the kat wrote:
> On 09/08/12 18:39, Dennis Lee Bieber wrote:
>> On Thu, 09 Aug 2012 16:15:33 +0100, lipska the kat
>> declaimed the following in
>> gmane.comp.python.general:
>>
>>
>>> in the examples in this chapter we see usage examples for
>>> socketserver.BaseRe
On 09/08/12 20:07, Peter Otten wrote:
lipska the kat wrote:
If there isn't how does one go about
contributing to the documentation.
http://docs.python.org/dev/py3k/bugs.html
A similar link should be right there in the footer of the socketserver
documentation.
It is indeed, thank you.
lips
Nobody於 2012年8月7日星期二UTC+8下午11時32分55秒寫道:
> On Mon, 06 Aug 2012 21:02:33 -0700, Larry Hudson wrote:
>
>
>
> >> for i in range(N,N+100):
>
> >> for j in range(M,M+100):
>
> >> do_something(i % 100 ,j % 100)
>
> >>
>
> >> Emile
>
> >
>
> > How about...
>
> >
>
On 09/08/12 19:55, Mark Lawrence wrote:
On 09/08/2012 19:37, lipska the kat wrote:
On 09/08/12 18:39, Dennis Lee Bieber wrote:
On Thu, 09 Aug 2012 16:15:33 +0100, lipska the kat
declaimed the following in
gmane.comp.python.general:
in the examples in this chapter we see usage examples for
s
Nobody於 2012年8月7日星期二UTC+8下午11時32分55秒寫道:
> On Mon, 06 Aug 2012 21:02:33 -0700, Larry Hudson wrote:
>
>
>
> >> for i in range(N,N+100):
>
> >> for j in range(M,M+100):
>
> >> do_something(i % 100 ,j % 100)
>
> >>
>
> >> Emile
>
> >
>
> > How about...
>
> >
>
lipska the kat wrote:
> If there isn't how does one go about
> contributing to the documentation.
http://docs.python.org/dev/py3k/bugs.html
A similar link should be right there in the footer of the socketserver
documentation.
--
http://mail.python.org/mailman/listinfo/python-list
On 09/08/2012 19:37, lipska the kat wrote:
On 09/08/12 18:39, Dennis Lee Bieber wrote:
On Thu, 09 Aug 2012 16:15:33 +0100, lipska the kat
declaimed the following in
gmane.comp.python.general:
in the examples in this chapter we see usage examples for
socketserver.BaseRequestHandler
So
On 09/08/12 18:39, Dennis Lee Bieber wrote:
On Thu, 09 Aug 2012 16:15:33 +0100, lipska the kat
declaimed the following in
gmane.comp.python.general:
in the examples in this chapter we see usage examples for
socketserver.BaseRequestHandler
So far as I can tell, all RequestHandler ob
On 09/08/12 18:39, Dennis Lee Bieber wrote:
On Thu, 09 Aug 2012 16:15:33 +0100, lipska the kat
declaimed the following in
gmane.comp.python.general:
in the examples in this chapter we see usage examples for
socketserver.BaseRequestHandler
So far as I can tell, all RequestHandler ob
On Thu, 09 Aug 2012 19:13:31 +1000, Chris Angelico wrote:
> On Thu, Aug 9, 2012 at 7:05 PM, Jean-Michel Pichavant
> wrote:
>> bruceg113...@gmail.com wrote:
>>>
>>> I cannot change the function definition.
>>
>> or better (imo)
>> testData(z) and make testData handle a list (8 parameters, that's a
On Aug 9, 2012, at 10:38 AM, David Thomas wrote:
> Im looking to upgrade my Mac to 10.8 and I'm worried if Python and IDLE may
> not run on it.
> When I try to run this command in Terminal: python -m idlelib.idle
> I can not launch IDLE which comes bundled on Mac. On Lion it's been fine but
>
First of all sincere apologies if this is blindingly obvious and I just
missed it
In the documentation at
http://docs.python.org/py3k/library/socketserver.html
mention is made more than once of a class
socketserver.StreamRequestHandler
in the examples in this chapter we see usage examples for
Im looking to upgrade my Mac to 10.8 and I'm worried if Python and IDLE may not
run on it.
When I try to run this command in Terminal: python -m idlelib.idle
I can not launch IDLE which comes bundled on Mac. On Lion it's been fine but
I've tried it on my friend's copy of Mountain Lion and it wil
Hello,
on behalf of the PyInstaller development team I'm happy to announce
PyInstaller 2.0.
http://www.pyinstaller.org
Special thanks to Martin Zibricky who did most of the development work for this
release.
=== What it is ===
PyInstaller is a program that converts (packages) Python progra
On Sunday, August 5, 2012 7:46:54 PM UTC-4, PeterSo wrote:
> I am just starting to learn Python, and I like to use the editor
>
> instead of the interactive shell. So I wrote the following little
>
> program in IDLE
>
>
>
> # calculating the mean
>
>
>
> data1=[49, 66, 24, 98, 37, 64, 98, 2
I am looking to monitor print jobs on linux via python.
pycups looks a possibility, but I cannot find any useful tutorial, examples of
how to use it.
Can anyone help?
--
http://mail.python.org/mailman/listinfo/python-list
Chris Angelico wrote:
On Thu, Aug 9, 2012 at 7:05 PM, Jean-Michel Pichavant
wrote:
bruceg113...@gmail.com wrote:
I cannot change the function definition.
or better (imo)
testData(z) and make testData handle a list (8 parameters, that's a lot of
parameters).
He can't chan
On Thu, Aug 9, 2012 at 7:05 PM, Jean-Michel Pichavant
wrote:
> bruceg113...@gmail.com wrote:
>>
>> I cannot change the function definition.
>
> or better (imo)
> testData(z) and make testData handle a list (8 parameters, that's a lot of
> parameters).
He can't change the function definition.
Chr
bruceg113...@gmail.com wrote:
Is there a way in Python to pass arguments without listing each argument?
For example, my program does the following:
testData (z[0], z[1], z[2], z[3], z[4], z[5], z[6], z[7])
Is there a clever way to pass arguments in a single statement knowing that each
argu
On 09/08/12 03:59, Dennis Lee Bieber wrote:
On Wed, 08 Aug 2012 20:31:57 +0100, lipska the kat
declaimed the following in
gmane.comp.python.general:
[snip]
If a "node" is a father or mother, and it takes one of each to
produce a "leaf", your "tree" has just collapsed.
This would
On 09.08.2012 01:58, Tom Russell wrote:
For instance this code below:
soup =
BeautifulSoup(urlopen('http://online.wsj.com/mdc/public/page/2_3021-tradingdiary2.html?mod=mdc_pastcalendar'))
table = soup.find("table",{"class": "mdcTable"})
for row in table.findAll("tr"):
for cell in row.find
65 matches
Mail list logo