Re: how to compare two json file line by line using python?

2013-05-26 Thread Avnesh Shakya
Thanks a lot, I got it. On Mon, May 27, 2013 at 11:03 AM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Sun, 26 May 2013 21:32:40 -0700, Avnesh Shakya wrote: > > > But I want to compare line by line and value by value. but i found that > > json data is unordered data, so ho

Re: Solving the problem of mutual recursion

2013-05-26 Thread Ian Kelly
On Sun, May 26, 2013 at 4:16 PM, Chris Angelico wrote: > On Mon, May 27, 2013 at 5:35 AM, Ian Kelly wrote: >> I'm pretty sure that CPython uses the GIL regardless of platform. And >> yes you can have multiple OS-level threads, but because of the GIL >> only one will actually be running at a time

Re: Short-circuit Logic

2013-05-26 Thread Cameron Simpson
On 27May2013 06:59, Vito De Tullio wrote: | Cameron Simpson wrote: | > if s is not None and len(s) > 0: | > ... do something with the non-empty string `s` ... | > | > In this example, None is a sentinel value for "no valid string" and | > calling "len(s)" would raise an exception because No

Re: Python error codes and messages location

2013-05-26 Thread Cameron Simpson
On 27May2013 04:49, Carlos Nepomuceno wrote: | > From: steve+comp.lang.pyt...@pearwood.info | > On Mon, 27 May 2013 02:13:54 +0300, Carlos Nepomuceno wrote: | >> Where can I find all error codes and messages that Python throws (actual | >> codes and messages from exceptions raised by stdlib)? | >

Re: Solving the problem of mutual recursion

2013-05-26 Thread Ian Kelly
On Sun, May 26, 2013 at 10:36 PM, Peter Brooks wrote: > This makes complete sense - any atomic action should be atomic, so two > threads can't be doing it at the same time. They can be doing anything > else though. > > If two threads create a new object at the same time, for example, > there's pot

Re: Ldap module and base64 oncoding

2013-05-26 Thread dieter
"Joseph L. Casale" writes: > ... > After parsing the data for a user I am simply taking a value from the ldif > file and writing > it back out to another which fails, the value parsed is: > > officestreetaddress:: T3R0by1NZcOfbWVyLVN0cmHDn2UgMQ== > > > File "C:\Python27\lib\site-packages\ldif.p

Re: help?? on functions

2013-05-26 Thread Steven D'Aprano
On Sun, 26 May 2013 21:48:34 -0700, lokeshkoppaka wrote: > def shuffle(input, i, j): > pass > input = input[i:j+1] +input[0:i] + input[j+1:] "pass" does nothing. Take it out. > def test_shuffle(): > input = [1, 2, 3, 4, 5, 6] > shuffle(input, 1, 2) > assert [2, 3, 1, 4, 5,

Re: how to compare two json file line by line using python?

2013-05-26 Thread Steven D'Aprano
On Sun, 26 May 2013 21:32:40 -0700, Avnesh Shakya wrote: > But I want to compare line by line and value by value. but i found that > json data is unordered data, so how can i compare them without sorting > it. please give me some idea about it. I am new for it. I want to check > every value line b

RE: Ldap module and base64 oncoding

2013-05-26 Thread Joseph L. Casale
Hi Michael, > Processing LDIF is one thing, doing LDAP operations another. > > LDIF itself is meant to be ASCII-clean. But each attribute value can carry any > byte sequence (e.g. attribute 'jpegPhoto'). There's no further processing by > module LDIF - it simply returns byte sequences. > > The a

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-26 Thread Νίκος Γκρ33κ
But iu have it set up for 'utf-8' as seen in this statement. con = pymysql.connect( db = 'metrites', host = 'localhost', user = 'me', passwd = 'somepass', charset='utf-8', init_command='SET NAMES UTF8' ) Yoiu mean i shoudl chnag eit to greek isoo= (iso-8859-7) but then i store english names an

Re: how to compare two json file line by line using python?

2013-05-26 Thread Avnesh Shakya
Actually, I am extracting data from other site in json format and I want to put it in my database and when I extract data again then I want to compare last json file, if these are same then no issue otherwise i will add new data in database, so here may be every time data can be changed or may be n

Re: This mail never gets delivered. Any ideas why?

2013-05-26 Thread Νίκος Γκρ33κ
else: sp = subprocess.Popen(['mail', '-f', FROM, '-s', 'Mail from Guest', 'supp...@superhost.gr'], sp.stdin=subprocess.PIPE) sp.communicate( input.encode(MESSAGE, 'utf-8') ) status = sp.wait() this gives me an internal server error Cameron, but i g

Re: Short-circuit Logic

2013-05-26 Thread Vito De Tullio
Cameron Simpson wrote: > if s is not None and len(s) > 0: > ... do something with the non-empty string `s` ... > > In this example, None is a sentinel value for "no valid string" and > calling "len(s)" would raise an exception because None doesn't have > a length. obviously in this case an

Re: how to compare two json file line by line using python?

2013-05-26 Thread rusi
On May 27, 9:32 am, Avnesh Shakya wrote: > hi, >    how to compare two json file line by line using python? Actually I am > doing it in this way.. > > import simplejson as json > def compare(): >     newJsonFile= open('newData.json') >     lastJsonFile= open('version1.json') >     newLines = newJ

help?? on functions

2013-05-26 Thread lokeshkoppaka
def shuffle(input, i, j): pass input = input[i:j+1] +input[0:i] + input[j+1:] def test_shuffle(): input = [1, 2, 3, 4, 5, 6] shuffle(input, 1, 2) assert [2, 3, 1, 4, 5, 6] == input i had done the above code but the problem is i had manipulated the "input" in function shuffle(

Re: Short-circuit Logic

2013-05-26 Thread rusi
On May 27, 5:40 am, Steven D'Aprano wrote: > On Sun, 26 May 2013 16:22:26 -0400, Roy Smith wrote: > > In article , > >  Terry Jan Reedy wrote: > > >> On 5/26/2013 7:11 AM, Ahmed Abdulshafy wrote: > > >> >       if not allow_zero and abs(x) < sys.float_info.epsilon: > >> >                  print("

Re: Solving the problem of mutual recursion

2013-05-26 Thread Peter Brooks
On May 27, 12:16 am, Chris Angelico wrote: > On Mon, May 27, 2013 at 5:35 AM, Ian Kelly wrote: > > I'm pretty sure that CPython uses the GIL regardless of platform.  And > > yes you can have multiple OS-level threads, but because of the GIL > > only one will actually be running at a time.  Other

how to compare two json file line by line using python?

2013-05-26 Thread Avnesh Shakya
hi, how to compare two json file line by line using python? Actually I am doing it in this way.. import simplejson as json def compare(): newJsonFile= open('newData.json') lastJsonFile= open('version1.json') newLines = newJsonFile.readlines() print newLines sortedNew = sort

Re: Short-circuit Logic

2013-05-26 Thread Cameron Simpson
On 27May2013 00:40, Steven D'Aprano wrote: | On Sun, 26 May 2013 16:22:26 -0400, Roy Smith wrote: | | > In article , | > Terry Jan Reedy wrote: | > | >> On 5/26/2013 7:11 AM, Ahmed Abdulshafy wrote: | >> | >> > if not allow_zero and abs(x) < sys.float_info.epsilon: | >> >

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-26 Thread Tim Roberts
? ???33? wrote: > >This is the code that although correct becaus it works with englisg(standARD >ASCII letters) it wont with Greek: >... >if( log ): > name = log > # print specific client header info > cur.execute('''SELECT hits, money FROM clients WHERE name = %s''', > (na

Re: Python error codes and messages location

2013-05-26 Thread Cameron Simpson
On 27May2013 00:53, Steven D'Aprano wrote: | On Mon, 27 May 2013 02:13:54 +0300, Carlos Nepomuceno wrote: | > Where can I find all error codes and messages that Python throws (actual | > codes and messages from exceptions raised by stdlib)? | | There is no list. It is subject to change from vers

RE: Python error codes and messages location

2013-05-26 Thread Carlos Nepomuceno
> From: steve+comp.lang.pyt...@pearwood.info > Subject: Re: Python error codes and messages location > Date: Mon, 27 May 2013 00:53:41 + > To: python-list@python.org > > On Mon, 27 May 2013 02:13:54 +0300, Carlos Nepomuceno wrote: > >> Where can I find a

Re: Python error codes and messages location

2013-05-26 Thread Steven D'Aprano
On Mon, 27 May 2013 02:13:54 +0300, Carlos Nepomuceno wrote: > Where can I find all error codes and messages that Python throws (actual > codes and messages from exceptions raised by stdlib)? There is no list. It is subject to change from version to version, including point releases. Many funct

Re: Short-circuit Logic

2013-05-26 Thread Steven D'Aprano
On Sun, 26 May 2013 16:22:26 -0400, Roy Smith wrote: > In article , > Terry Jan Reedy wrote: > >> On 5/26/2013 7:11 AM, Ahmed Abdulshafy wrote: >> >> > if not allow_zero and abs(x) < sys.float_info.epsilon: >> > print("zero is not allowed") >> >> The reason for the orde

Re: serialize a class to XML and back

2013-05-26 Thread Roy Smith
In article <51a28f42$0$15870$e4fe5...@news.xs4all.nl>, Irmen de Jong wrote: > On 26-5-2013 22:48, Roy Smith wrote: > > > The advantage of pickle over json is that pickle can serialize many > > types of objects that json can't. The other side of the coin is that > > pickle is python-specific,

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Cameron Simpson
On 26May2013 17:45, Mark Lawrence wrote: | On 26/05/2013 17:10, Νίκος Γκρ33κ wrote: | >Here is the live error log coming form apacher when i request the webpage form browser: | > | >==> /usr/local/apache/logs/error_log <== | >[Sun May 26 19:07:41 2013] [error] [client 46.12.46.11] suexec failure:

Re: This mail never gets delivered. Any ideas why?

2013-05-26 Thread Cameron Simpson
On 27May2013 10:22, I wrote: | | => 903 self.stdin.write(input) [...] | | self = , self.stdin = <_io.BufferedWriter name=5>, self.stdin.write = , input = 'kdsjfksdjkfjksdjfs\r\n\t' | | TypeError: 'str' does not support the buffer interface | | args = ("'str' does n

Re: This mail never gets delivered. Any ideas why?

2013-05-26 Thread Cameron Simpson
On 26May2013 13:48, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: | I'am receiving this now after some tries: | | A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred. | | /home/nikos/public_html/cgi-bin/metrites.p

RE: Piping processes works with 'shell = True' but not otherwise.

2013-05-26 Thread Carlos Nepomuceno
pipes usually consumes disk storage at '/tmp'. Are you sure you have enough room on that filesystem? Make sure no other processes are competing against for that space. Just my 50c because I don't know what's causing Errno 0. I don't even know what are the possible causes of such error. Good luck

Re: Piping processes works with 'shell = True' but not otherwise.

2013-05-26 Thread Luca Cerone
> Could you provide the *actual* commands you're using, rather than the generic > "program1" and "program2" placeholders? It's *very* common for people to get > the tokenization of a command line wrong (see the Note box in > http://docs.python.org/2/library/subprocess.html#subprocess.Popen for s

Python error codes and messages location

2013-05-26 Thread Carlos Nepomuceno
Where can I find all error codes and messages that Python throws (actual codes and messages from exceptions raised by stdlib)? I've already found the module 'errno' and got a dictionary (errno.errorcode) and some system error messages (os.strerror(errno.ENAMETOOLONG)) but there's more I couldn'

Re: Cutting a deck of cards

2013-05-26 Thread Mark Lawrence
On 26/05/2013 23:42, Chris Angelico wrote: On Mon, May 27, 2013 at 8:30 AM, Carlos Nepomuceno wrote: Thanks guys! I've been delaying my dive into Python 3 (because I don't need it for now) but I'd like to run some code just to learn how different it is from Python 2 and even other Python flav

RE: Cutting a deck of cards

2013-05-26 Thread Carlos Nepomuceno
> Date: Mon, 27 May 2013 08:42:56 +1000 > Subject: Re: Cutting a deck of cards > From: ros...@gmail.com [...] > Easy. Just grab the standard installer and hit it. You'll get two > separate directories (or more; I have \Python26, \Python27, \Python32, > \Pyth

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-26 Thread Mark Lawrence
On 26/05/2013 23:32, Chris Angelico wrote: On Mon, May 27, 2013 at 8:21 AM, Mark Lawrence wrote: On 26/05/2013 22:26, Νίκος Γκρ33κ wrote: No thi is not a mysql issue becaus ei have this line above for storing and retrieval form database. con = pymysql.connect( db = 'metrites', host = 'localh

Re: serialize a class to XML and back

2013-05-26 Thread Irmen de Jong
On 26-5-2013 22:48, Roy Smith wrote: > The advantage of pickle over json is that pickle can serialize many > types of objects that json can't. The other side of the coin is that > pickle is python-specific, so if you think you'll ever need to read your > data from other languages, pickle is ri

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-26 Thread Chris Angelico
On Mon, May 27, 2013 at 8:21 AM, Mark Lawrence wrote: > On 26/05/2013 22:26, Νίκος Γκρ33κ wrote: >> >> No thi is not a mysql issue becaus ei have this line above for storing and >> retrieval form database. >> >> con = pymysql.connect( db = 'metrites', host = 'localhost', user = 'me', >> passwd = '

Re: Cutting a deck of cards

2013-05-26 Thread Chris Angelico
On Mon, May 27, 2013 at 8:30 AM, Carlos Nepomuceno wrote: > Thanks guys! I've been delaying my dive into Python 3 (because I don't need > it for now) but I'd like to run some code just to learn how different it is > from Python 2 and even other Python flavors. > > So, I'd like to know if it's po

RE: Cutting a deck of cards

2013-05-26 Thread Carlos Nepomuceno
> To: python-list@python.org > From: breamore...@yahoo.co.uk [...] > Wrong if you're using Python 3 :( > > -- > If you're using GoogleCrap™ please read this > http://wiki.python.org/moin/GoogleGroupsPython. > > Mark Lawrence Thanks guys! I've been delaying

Re: I want to know how to implement concurrent threads in Python

2013-05-26 Thread Mark Lawrence
On 26/05/2013 20:10, Daniel Gagliardi wrote: I want to know how to implement concurrent threads in Python google, bing, duckduckgo, yahoo... -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/list

RE: Encodign issue in Python 3.3.1 (once again)

2013-05-26 Thread Carlos Nepomuceno
> To: python-list@python.org > From: breamore...@yahoo.co.uk [...] > No wonder the Greek economy is so screwed up. > > -- > If you're using GoogleCrap™ please read this > http://wiki.python.org/moin/GoogleGroupsPython. > > Mark Lawrence LOL LOL LOL LOL LOL

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-26 Thread Mark Lawrence
On 26/05/2013 22:26, Νίκος Γκρ33κ wrote: No thi is not a mysql issue becaus ei have this line above for storing and retrieval form database. con = pymysql.connect( db = 'metrites', host = 'localhost', user = 'me', passwd = 'somepass', init_command='SET NAMES UTF8' ) No wonder the Greek econ

Re: I want to know how to implement concurrent threads in Python

2013-05-26 Thread Mark Lawrence
On 26/05/2013 22:27, Andrew Berg wrote: On 2013.05.26 16:21, Daniel Gagliardi wrote: shutup bitch! i do know python cannot concurrent threads. want a workaround You're a charming fellow. I'm sure everyone will flock to help you. So "How to win friends and influence people" had two authors.

Re: Cutting a deck of cards

2013-05-26 Thread Mark Lawrence
On 26/05/2013 19:16, Carlos Nepomuceno wrote: Date: Sun, 26 May 2013 10:52:14 -0700 Subject: Cutting a deck of cards From: rvinc...@gmail.com To: python-list@python.org Suppose I have a deck of cards, and I shuffle them import random cards = [] decks =

Re: Solving the problem of mutual recursion

2013-05-26 Thread Chris Angelico
On Mon, May 27, 2013 at 5:35 AM, Ian Kelly wrote: > I'm pretty sure that CPython uses the GIL regardless of platform. And > yes you can have multiple OS-level threads, but because of the GIL > only one will actually be running at a time. Other possibilities > include: 6) It's spinning in a func

Re: Future standard GUI library

2013-05-26 Thread Chris Angelico
On Mon, May 27, 2013 at 5:41 AM, Michael Torrie wrote: > Chuckle. Simple CRUD, eh. Almost all apps involve database CRUD > interactions. And often in highly complex ways using business logic. Right. Sturgeon's Law of Applications. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-26 Thread Chris Angelico
On Mon, May 27, 2013 at 7:26 AM, Νίκος Γκρ33κ wrote: > No thi is not a mysql issue becaus ei have this line above for storing and > retrieval form database. > > con = pymysql.connect( db = 'metrites', host = 'localhost', user = 'me', > passwd = 'somepass', init_command='SET NAMES UTF8' ) Resear

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-26 Thread Νίκος Γκρ33κ
No thi is not a mysql issue becaus ei have this line above for storing and retrieval form database. con = pymysql.connect( db = 'metrites', host = 'localhost', user = 'me', passwd = 'somepass', init_command='SET NAMES UTF8' ) -- http://mail.python.org/mailman/listinfo/python-list

Re: Short-circuit Logic

2013-05-26 Thread Terry Jan Reedy
On 5/26/2013 4:22 PM, Roy Smith wrote: In article , Terry Jan Reedy wrote: On 5/26/2013 7:11 AM, Ahmed Abdulshafy wrote: if not allow_zero and abs(x) < sys.float_info.epsilon: print("zero is not allowed") The reason for the order is to do the easy calculation fir

Re: I want to know how to implement concurrent threads in Python

2013-05-26 Thread Andrew Berg
On 2013.05.26 16:21, Daniel Gagliardi wrote: > shutup bitch! i do know python cannot concurrent threads. want a workaround You're a charming fellow. I'm sure everyone will flock to help you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Future standard GUI library

2013-05-26 Thread Michael Torrie
On 05/26/2013 01:45 PM, Roy Smith wrote: > In article , > Michael Torrie wrote: > >> On good thing web development has brought us is the knowledge that >> modularization and layers are a brilliant idea. > > Modularization and layers were a brilliant idea long before the web came > around. Tru

Re: I want to know how to implement concurrent threads in Python

2013-05-26 Thread Andrew Berg
On 2013.05.26 14:10, Daniel Gagliardi wrote: > I want to know how to implement concurrent threads in Python With the threading module in the standard library. http://docs.python.org/3.3/library/threading.html There are plenty of tutorials on this out there; we'll be happy to help if you're stuck

Re: Piping processes works with 'shell = True' but not otherwise.

2013-05-26 Thread Chris Rebert
On May 24, 2013 7:06 AM, "Luca Cerone" wrote: > > Hi everybody, > I am new to the group (and relatively new to Python) > so I am sorry if this issues has been discussed (although searching for topics in the group I couldn't find a solution to my problem). > > I am using Python 2.7.3 to analyse the

Re: Cutting a deck of cards

2013-05-26 Thread Terry Jan Reedy
On 5/26/2013 3:54 PM, Carlos Nepomuceno wrote: From: usenetm...@solar-empire.de [...] Not in Python3.x decks = 6 list(range(13 * 4 * decks)) == range(13 * 4 * decks) False Adiaŭ Marc What does "list(range(13 * 4 * decks))" returns in Python 3?

Re: Future standard GUI library

2013-05-26 Thread Ian Foote
On 26/05/13 20:41, Michael Torrie wrote: On 05/26/2013 11:43 AM, Wolfgang Keller wrote: Maybe it would have been faster to develop, but ultimately less useful and require more development time in the long run. suppose I now want the app natively on my phone (because that's all the rage). It

Re: This mail never gets delivered. Any ideas why?

2013-05-26 Thread Νίκος Γκρ33κ
I'am receiving this now after some tries: A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred. /home/nikos/public_html/cgi-bin/metrites.py in () 139 else: 140 sp = subprocess.Popen(['ma

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-26 Thread Terry Jan Reedy
On 5/26/2013 12:36 PM, Νίκος Γκρ33κ wrote: This is the code that although correct becaus it works with englisg(standARD ASCII letters) it wont with Greek: if( log ): name = log # print specific client header info cur.execute('''SELECT hits, money FROM clients WHERE name

Re: serialize a class to XML and back

2013-05-26 Thread Roy Smith
In article , Chris Rebert wrote: > On May 23, 2013 3:42 AM, "Schneider" wrote: > > > > Hi list, > > > > how can I serialize a python class to XML? Plus a way to get the class > back from the XML? > > There's pyxser: http://pythonhosted.org/pyxser/ > > > My aim is to store instances of this cl

Re: Output from to_bytes

2013-05-26 Thread Terry Jan Reedy
On 5/26/2013 8:02 AM, Mok-Kong Shen wrote: for k in range(8,12,1): print(k.to_bytes(2,byteorder='big')) http://bugs.python.org/issue9951 http://bugs.python.org/issue3532 import binascii as ba for k in range(8,12,1): print(ba.hexlify(k.to_bytes(2,byteorder='big'))) >>> b'0008' b'0

Re: serialize a class to XML and back

2013-05-26 Thread Chris Rebert
On May 23, 2013 3:42 AM, "Schneider" wrote: > > Hi list, > > how can I serialize a python class to XML? Plus a way to get the class back from the XML? There's pyxser: http://pythonhosted.org/pyxser/ > My aim is to store instances of this class in a database. Honestly, I would avoid XML if you c

Re: Cutting a deck of cards

2013-05-26 Thread Marc Christiansen
Carlos Nepomuceno wrote: > >> From: usenetm...@solar-empire.de > [...] >> Not in Python3.x > decks = 6 > list(range(13 * 4 * decks)) == range(13 * 4 * decks) >> False > > What does "list(range(13 * 4 * decks))" returns in Python 3?

Re: Short-circuit Logic

2013-05-26 Thread Roy Smith
In article , Terry Jan Reedy wrote: > On 5/26/2013 7:11 AM, Ahmed Abdulshafy wrote: > > > if not allow_zero and abs(x) < sys.float_info.epsilon: > > print("zero is not allowed") > > The reason for the order is to do the easy calculation first and the > harder one only i

Re: Short-circuit Logic

2013-05-26 Thread Terry Jan Reedy
On 5/26/2013 7:11 AM, Ahmed Abdulshafy wrote: if not allow_zero and abs(x) < sys.float_info.epsilon: print("zero is not allowed") The reason for the order is to do the easy calculation first and the harder one only if the first passes. -- http://mail.python.org/mail

I want to know how to implement concurrent threads in Python

2013-05-26 Thread Daniel Gagliardi
I want to know how to implement concurrent threads in Python -- http://mail.python.org/mailman/listinfo/python-list

RE: Cutting a deck of cards

2013-05-26 Thread Carlos Nepomuceno
> From: usenetm...@solar-empire.de [...] > Not in Python3.x decks = 6 list(range(13 * 4 * decks)) == range(13 * 4 * decks) > False > > Adiaŭ > Marc What does "list(range(13 * 4 * decks))" returns in Python 3?

Re: Ldap module and base64 oncoding

2013-05-26 Thread Michael Ströder
Joseph L. Casale wrote: >> I'm not sure what exactly you're asking for. >> Especially "is not being interpreted as a string requiring base64 encoding" >> is >> written without giving the right context. >> >> So I'm just guessing that this might be the usual misunderstandings with use >> of base64

Re: Future standard GUI library

2013-05-26 Thread Roy Smith
In article , Michael Torrie wrote: > On good thing web development has brought us is the knowledge that > modularization and layers are a brilliant idea. Modularization and layers were a brilliant idea long before the web came around. -- http://mail.python.org/mailman/listinfo/python-list

Re: Cutting a deck of cards

2013-05-26 Thread Marc Christiansen
Carlos Nepomuceno wrote: > >> Date: Sun, 26 May 2013 10:52:14 -0700 >> Subject: Cutting a deck of cards >> From: rvinc...@gmail.com >> To: python-list@python.org >> >> Suppose I have a deck of cards, and I shuffle them >> >> import random >> cards = [] >> d

Re: Future standard GUI library

2013-05-26 Thread Michael Torrie
On 05/26/2013 11:43 AM, Wolfgang Keller wrote: > And just like HTML never was a valid GUI framework and never will be > one, HTTP will never be a suitable transport layer for a RPC protocol. On good thing web development has brought us is the knowledge that modularization and layers are a brillian

Re: Solving the problem of mutual recursion

2013-05-26 Thread Ian Kelly
On Sun, May 26, 2013 at 12:13 PM, Peter Brooks wrote: > No, on a multi-core machine it's normal. The machine shows python > running multiple threads - and the number of threads change as the > program runs. Perhaps the OS/X implementation of python does allow > concurrency when others don't. It ce

Re: Help with implementing callback functions using ctypes

2013-05-26 Thread Dan Stromberg
On Sun, May 26, 2013 at 9:12 AM, Shriramana Sharma wrote: > On Friday, May 24, 2013 8:56:28 AM UTC+5:30, Dan Stromberg wrote: > > Cython is good. So is the new cffi, which might be thought of as a > > safer (API-level) version of ctypes (which is ABI-level). > > Hi -- can you clarify what is this

Re: Solving the problem of mutual recursion

2013-05-26 Thread Peter Brooks
On 26 May, 20:22, Carlos Nepomuceno wrote: > > > > Date: Sun, 26 May 2013 11:13:12 -0700 > > Subject: Re: Solving the problem of mutual recursion > > From: peter.h.m.bro...@gmail.com > > To: python-l...@python.org > [...] > >> How can you get 140% of CPU? I

Re: Future standard GUI library

2013-05-26 Thread Chris Angelico
On Mon, May 27, 2013 at 3:43 AM, Wolfgang Keller wrote: >> For the Yosemite Project, I wanted the networking aspect, so the web >> browser UI was a good one. > > From the description this looks like a simble database CRUD > application. Somethign like that is definitely easier to implement and > t

RE: Help with implementing callback functions using ctypes

2013-05-26 Thread Carlos Nepomuceno
https://cffi.readthedocs.org/en/release-0.6/ > Date: Sun, 26 May 2013 09:12:10 -0700 > Subject: Re: Help with implementing callback functions using ctypes > From: samj...@gmail.com > To: python-list@python.org > > On Friday, May 24, 2013 8:56:28 AM UTC+5:30

RE: Future standard GUI library

2013-05-26 Thread Carlos Nepomuceno
> From: felip...@gmx.net > Subject: Re: Future standard GUI library > Date: Sun, 26 May 2013 19:43:10 +0200 > To: python-list@python.org [...] > one, HTTP will never be a suitable transport layer for a RPC protocol. > > Sincerely, > > Wolfgang Please give

Re: Cutting a deck of cards

2013-05-26 Thread Roy Smith
In article <4d02f46f-8264-41bf-a254-d1c204696...@googlegroups.com>, RVic wrote: > Suppose I have a deck of cards, and I shuffle them > > import random > cards = [] > decks = 6 > cards = list(range(13 * 4 * decks)) > random.shuffle(cards) > > So now I have an array of cards. I would like to cut

RE: Solving the problem of mutual recursion

2013-05-26 Thread Carlos Nepomuceno
> Date: Sun, 26 May 2013 11:13:12 -0700 > Subject: Re: Solving the problem of mutual recursion > From: peter.h.m.bro...@gmail.com > To: python-list@python.org [...] >> How can you get 140% of CPU? IS that a typo?? >> > No, on a multi-core machine it's normal

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-26 Thread Νίκος Γκρ33κ
Any idea how to correct this encoding issue? -- http://mail.python.org/mailman/listinfo/python-list

Re: Cutting a deck of cards

2013-05-26 Thread RVic
Ah, brilliant -- yes, this is so much more elegant in Python: #now cut the cards x = random.randrange(2,range(13 * 4 * decks)) cards = cards[x:]+cards[:x] -- http://mail.python.org/mailman/listinfo/python-list

Re: Future standard GUI library

2013-05-26 Thread Roy Smith
In article <20130526194310.9cdb1be80b42c7fdf0ba5...@gmx.net>, Wolfgang Keller wrote: > HTTP will never be a suitable transport layer for a RPC protocol. What, in particular, is wrong with HTTP for doing RPC? RPC is pretty straight-forward. Take this method, run it over there, with these arg

RE: Cutting a deck of cards

2013-05-26 Thread Carlos Nepomuceno
> Date: Sun, 26 May 2013 10:52:14 -0700 > Subject: Cutting a deck of cards > From: rvinc...@gmail.com > To: python-list@python.org > > Suppose I have a deck of cards, and I shuffle them > > import random > cards = [] > decks = 6 > cards = list(range(13 * 4 *

Re: Solving the problem of mutual recursion

2013-05-26 Thread Peter Brooks
On 26 May, 20:09, Carlos Nepomuceno wrote: > > > > > > > > > > > > Date: Sun, 26 May 2013 10:21:05 -0700 > > Subject: Re: Solving the problem of mutual recursion > > From: peter.h.m.bro...@gmail.com > > To: python-l...@python.org > > > On May 26, 5:09 pm, J

RE: Solving the problem of mutual recursion

2013-05-26 Thread Carlos Nepomuceno
> Date: Sun, 26 May 2013 10:21:05 -0700 > Subject: Re: Solving the problem of mutual recursion > From: peter.h.m.bro...@gmail.com > To: python-list@python.org > > On May 26, 5:09 pm, Jussi Piitulainen > wrote: >> >> A light-weighter way is to have each task

Re: Cutting a deck of cards

2013-05-26 Thread Kamlesh Mutha
I guess, you will have to use list slicing mechanism to achieve the desired result. Hope this helps, Cheers, Kamlesh On Sun, May 26, 2013 at 11:22 PM, RVic wrote: > Suppose I have a deck of cards, and I shuffle them > > import random > cards = [] > decks = 6 > cards = list(range(13 * 4 * d

Re: Cutting a deck of cards

2013-05-26 Thread MRAB
On 26/05/2013 18:52, RVic wrote: Suppose I have a deck of cards, and I shuffle them import random cards = [] decks = 6 cards = list(range(13 * 4 * decks)) random.shuffle(cards) So now I have an array of cards. I would like to cut these cards at some random point (between 1 and 13 * 4 * decks -

Cutting a deck of cards

2013-05-26 Thread RVic
Suppose I have a deck of cards, and I shuffle them import random cards = [] decks = 6 cards = list(range(13 * 4 * decks)) random.shuffle(cards) So now I have an array of cards. I would like to cut these cards at some random point (between 1 and 13 * 4 * decks - 1, moving the lower half of that t

Re: Future standard GUI library

2013-05-26 Thread Wolfgang Keller
> > Both the concept and actually implemented examples of so-called "web > > applications" prove that they are just plain garbage and hopelessly > > unusable for anything remotely resembling actual screenwork. > > > > HTML forms may be at best useful for "web shops", but for actual > > screenwork,

Re: Solving the problem of mutual recursion

2013-05-26 Thread Peter Brooks
On May 26, 5:09 pm, Jussi Piitulainen wrote: > > A light-weighter way is to have each task end by assigning the next > task and returning, instead of calling the next task directly. When a > task returns, a driver loop will call the assigned task, which again > does a bounded amount of work, assig

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Mark Lawrence
On 26/05/2013 17:10, Νίκος Γκρ33κ wrote: Here is the live error log coming form apacher when i request the webpage form browser: ==> /usr/local/apache/logs/error_log <== [Sun May 26 19:07:41 2013] [error] [client 46.12.46.11] suexec failure: could not open log file [Sun May 26 19:07:41 2013] [

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Mark Lawrence
On 26/05/2013 16:24, Chris Angelico wrote: On Mon, May 27, 2013 at 1:00 AM, wrote: Τη Κυριακή, 26 Μαΐου 2013 4:10:02 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε: On Sun, May 26, 2013 at 11:00 PM, Νίκος Γκρ33κ wrote: Anyone seeign somethign wrong? Yes. You're posting requests, then bump

Encodign issue in Python 3.3.1 (once again)

2013-05-26 Thread Νίκος Γκρ33κ
This is the code that although correct becaus it works with englisg(standARD ASCII letters) it wont with Greek: if( log ): name = log # print specific client header info cur.execute('''SELECT hits, money FROM clients WHERE name = %s''', (name,) ) data = cur.fetcho

RE: Ldap module and base64 oncoding

2013-05-26 Thread Joseph L. Casale
> I'm not sure what exactly you're asking for. > Especially "is not being interpreted as a string requiring base64 encoding" is > written without giving the right context. > > So I'm just guessing that this might be the usual misunderstandings with use > of base64 in LDIF. Read more about when LDI

Re: Help with implementing callback functions using ctypes

2013-05-26 Thread Shriramana Sharma
On Friday, May 24, 2013 8:56:28 AM UTC+5:30, Dan Stromberg wrote: > Cython is good. So is the new cffi, which might be thought of as a > safer (API-level) version of ctypes (which is ABI-level). Hi -- can you clarify what is this new CFFI and where I can get it? In the Python 3 library reference

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Νίκος Γκρ33κ
Here is the live error log coming form apacher when i request the webpage form browser: ==> /usr/local/apache/logs/error_log <== [Sun May 26 19:07:41 2013] [error] [client 46.12.46.11] suexec failure: could not open log file [Sun May 26 19:07:41 2013] [error] [client 46.12.46.11] fopen: Permissi

Re: Error when trying to sort and presnt a dictionary in python 3.3.1

2013-05-26 Thread Νίκος Γκρ33κ
Τη Κυριακή, 26 Μαΐου 2013 3:58:12 μ.μ. UTC+3, ο χρήστης Νίκος Γκρ33κ έγραψε: > Τη Κυριακή, 26 Μαΐου 2013 3:20:19 μ.μ. UTC+3, ο χρήστης Peter Otten έγραψε: > > > > > At some point you have to admit that coding isn't your cup of tea. > > > Or Ouzo ;( > > > > And i didn't evne drank anyhting, i

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Νίκος Γκρ33κ
Τη Κυριακή, 26 Μαΐου 2013 6:24:55 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε: > On Mon, May 27, 2013 at 1:00 AM, wrote: > > > Τη Κυριακή, 26 Μαΐου 2013 4:10:02 μ.μ. UTC+3, ο χρήστης Chris Angelico > > έγραψε: > > >> On Sun, May 26, 2013 at 11:00 PM, Νίκος Γκρ33κ > >> wrote: > > >> > > >>

Re: Solving the problem of mutual recursion

2013-05-26 Thread Roy Smith
In article , Jussi Piitulainen wrote: > A light-weighter way is to have each task end by assigning the next > task and returning, instead of calling the next task directly. When a > task returns, a driver loop will call the assigned task, which again > does a bounded amount of work, assigns the

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Chris Angelico
On Mon, May 27, 2013 at 1:00 AM, wrote: > Τη Κυριακή, 26 Μαΐου 2013 4:10:02 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε: >> On Sun, May 26, 2013 at 11:00 PM, Νίκος Γκρ33κ wrote: >> >> > Anyone seeign somethign wrong? >> >> >> >> Yes. You're posting requests, then bumping the thread two hours lat

Re: Ldap module and base64 oncoding

2013-05-26 Thread Michael Ströder
Joseph L. Casale wrote: >> Can you give an example of the code you have? > > I actually just overrode the regex used by the method in the LDIFWriter class > to be far more broad > about what it interprets as a safe string. Are you sure that you fully understood RFC 2849 before doing this? Which

Re: Solving the problem of mutual recursion

2013-05-26 Thread Jussi Piitulainen
Peter Brooks writes: > I'm not sure if this'll interest anybody, but I expect that I'm > going to get some mutual recursion in my simulation, so I needed to ... > returned, then this solution won't help you. Often, though, you're > not interested in what's returned and would just like the routine

Re: Ldap module and base64 oncoding

2013-05-26 Thread Michael Ströder
Joseph L. Casale wrote: > I have some data I am working with that is not being interpreted as a string > requiring > base64 encoding when sent to the ldif module for output. > > The base64 string parsed is ZGV0XDMzMTB3YmJccGc= and the raw string is > det\3310wbb\pg. > I'll admit my understanding

  1   2   >