Re: Python Magazine

2013-05-24 Thread Chris Angelico
On Sat, May 25, 2013 at 2:22 PM, Carlos Nepomuceno wrote: > Also, comparison of Python flavors (CPython, PyPy, Cython, Stackles, etc.) -- > How do they differ? What's the benefits and hindrances? Good point. Could go even more general than that: Just highlight some lesser-known Python and show i

Re: help how to sort a list in order of 'n' in python without using inbuilt functions??

2013-05-24 Thread Chris Angelico
On Sat, May 25, 2013 at 3:15 PM, wrote: > On Friday, May 24, 2013 1:34:51 PM UTC+5:30, [email protected] wrote: >> i need to write a code which can sort the list in order of 'n' without use >> builtin functions >> >> can anyone help me how to do? > > Note: > the list only contains 0's,1's,2's

Re: help how to sort a list in order of 'n' in python without using inbuilt functions??

2013-05-24 Thread Chris Angelico
On Sat, May 25, 2013 at 3:39 PM, wrote: > On Saturday, May 25, 2013 10:54:01 AM UTC+5:30, Chris Angelico wrote: >> On Sat, May 25, 2013 at 3:15 PM, wrote: >> >> > On Friday, May 24, 2013 1:34:51 PM UTC+5:30, [email protected] wrote: >> >> >> i need

Re: help how to sort a list in order of 'n' in python without using inbuilt functions??

2013-05-24 Thread Chris Angelico
On Sat, May 25, 2013 at 4:05 PM, wrote: > ya steven i had done the similar logic but thats not satisfying my professor > he had given the following constrains > 1. No in-built functions should be used > 2. we are expecting a O(n) solution > 3. Don't use count method And now you finally admit

Re: Python Magazine

2013-05-24 Thread Chris Angelico
On Sat, May 25, 2013 at 4:38 PM, zoom wrote: > But why would anyone want to use IPv6? I hope you're not serious :) ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: help how to sort a list in order of 'n' in python without using inbuilt functions??

2013-05-25 Thread Chris Angelico
On Sat, May 25, 2013 at 5:53 PM, Carlos Nepomuceno wrote: > >> Date: Fri, 24 May 2013 23:05:17 -0700 >> 1. No in-built functions should be used > count[2] = len(l) Fail! :) ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: help how to sort a list in order of 'n' in python without using inbuilt functions??

2013-05-25 Thread Chris Angelico
On Sat, May 25, 2013 at 6:43 PM, Carlos Nepomuceno wrote: > > lol I forgot to include this monkey patch! ;) > > def length(l): > x=0 > y=l[:] > while y: > x+=1 > y.pop() > return x Nice. Now eliminate abs (easy) and range. :

Re: help how to sort a list in order of 'n' in python without using inbuilt functions??

2013-05-25 Thread Chris Angelico
On Sat, May 25, 2013 at 6:54 PM, Carlos Nepomuceno wrote: > lol > > def absolute(x): > return x if x>0 else -x > > def reach(x): > y=[] > z=0 > while z y.append(z) > z+=1 > return y Very good. You are now in a position to get past the limitations of a restricte

Re: help how to sort a list in order of 'n' in python without using inbuilt functions??

2013-05-25 Thread Chris Angelico
On Sat, May 25, 2013 at 7:10 PM, Carlos Nepomuceno wrote: > >> Date: Sat, 25 May 2013 19:01:09 +1000 >> Subject: Re: help how to sort a list in order of 'n' in python without using >> inbuilt functions?? >> From: [email protected] >> To: python-list@python.

Re: Python Magazine

2013-05-25 Thread Chris Angelico
On Sun, May 26, 2013 at 1:24 AM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> > Also, comparison of Python flavors (CPython, PyPy, Cython, Stackles, etc.) > > Stackles? That sounds like breakfast cereal. > > "New all-natural stackles, wit

Re: help how to sort a list in order of 'n' in python without using inbuilt functions??

2013-05-25 Thread Chris Angelico
On Sun, May 26, 2013 at 12:28 AM, Steven D'Aprano wrote: > On Sat, 25 May 2013 19:14:57 +1000, Chris Angelico wrote: > >> def random_number(): >> return 7 > > I call shenanigans! That value isn't generated randomly, you just made it > up! I rolled a die *h

Re: help how to sort a list in order of 'n' in python without using inbuilt functions??

2013-05-25 Thread Chris Angelico
On Sun, May 26, 2013 at 3:17 AM, Carlos Nepomuceno wrote: > def f(x): > return x+1 > > or you can just go: > > f(roll_d6()) Hmm. Interesting. So now we have a question: Does adding 1 to a random number make it less random? It adds determinism to the number; can a number be more deterministic

Re: Newbie question about evaluating raw_input() responses

2013-05-25 Thread Chris Angelico
On Sun, May 26, 2013 at 4:27 AM, Nobody wrote: > On Thu, 23 May 2013 17:20:19 +1000, Chris Angelico wrote: > >> Aside: Why was PHP's /e regexp option ever implemented? > > Because it's a stupid idea, and that's the only requirement for a feature > to be implem

Re: Python Magazine

2013-05-25 Thread Chris Angelico
On Sun, May 26, 2013 at 11:54 AM, Roy Smith wrote: > In article <[email protected]>, > John Ladasky wrote: > >> On Saturday, May 25, 2013 8:30:19 AM UTC-7, Roy Smith wrote: >> > From my phone, I >> > can call any other phone anywhere in the world. But I can't

Re: Python Magazine

2013-05-25 Thread Chris Angelico
On Sun, May 26, 2013 at 1:04 PM, John Ladasky wrote: > A perfectly fair point, Roy. It's just when you started suggesting > connecting to your neighbor's file server -- well, that's not something that > many people would ordinarily do. So, my mind leaped to the possibility of > uninvited conn

Re: help how to sort a list in order of 'n' in python without using inbuilt functions??

2013-05-25 Thread Chris Angelico
On Sun, May 26, 2013 at 1:09 PM, Steven D'Aprano wrote: > You're right, all my dice are eight-sided and complex: > > 1+0i > 1+1i > 1-1i > -1+0i > -1+1i > -1-1i > > > :-) Now THAT is a dice of win! >> Now, I have here with me >> a set used for maths drill (to be entirely accurate, what I have her

Re: help how to sort a list in order of 'n' in python without using inbuilt functions??

2013-05-25 Thread Chris Angelico
On Sun, May 26, 2013 at 1:38 PM, Steven D'Aprano wrote: > On Sun, 26 May 2013 03:23:44 +1000, Chris Angelico wrote: > >> Does adding 1 to a random >> number make it less random? It adds determinism to the number; can a >> number be more deterministic while still no

Re: Python Magazine

2013-05-25 Thread Chris Angelico
On Sun, May 26, 2013 at 2:01 PM, Carlos Nepomuceno wrote: > >> Date: Sat, 25 May 2013 20:04:28 -0700 >> Subject: Re: Python Magazine >> From: [email protected] >> To: [email protected] >> >> A perfectly fair point, Roy. It's just when you star

Re: Python Magazine

2013-05-25 Thread Chris Angelico
On Sun, May 26, 2013 at 2:03 PM, Steven D'Aprano wrote: > On Sun, 26 May 2013 11:58:09 +1000, Chris Angelico wrote: > >> On Sun, May 26, 2013 at 11:54 AM, Roy Smith wrote: > >>> Of course not every IPv6 endpoint will be able to talk to every other >>>

Re: Python Magazine

2013-05-25 Thread Chris Angelico
On Sun, May 26, 2013 at 3:00 PM, Carlos Nepomuceno wrote: > >> Date: Sun, 26 May 2013 14:31:57 +1000 >> Subject: Re: Python Magazine >> From: [email protected] >> To: [email protected] > [...] >> I expect that IP blocks will be upgraded to /64 block blo

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

2013-05-26 Thread 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 later as though you're entitled to a response quicker than that. Plus, the problems you're seeing ought to be solved by the 2to3 utility. Use it.

Re: Output from to_bytes

2013-05-26 Thread Chris Angelico
On Sun, May 26, 2013 at 10:02 PM, Mok-Kong Shen wrote: > I don't understand why with the code: > >for k in range(8,12,1): > print(k.to_bytes(2,byteorder='big')) > > one gets the following output: > >b'\x00\x08' >b'\x00\t' >b'\x00\n' >b'\x00\x0b' > > I mean the 2nd and 3rd

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'r

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: serialize a class to XML and back

2013-05-26 Thread Chris Rebert
-language accessibility); both have more convenient APIs. Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list

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

2013-05-26 Thread Chris Rebert
rams, whereas you /are/ redirecting the stderrs to stdout in the non-shell version of your code. But this is unlikely to be causing the error you're currently seeing. You may also want to provide /dev/null as p1's stdin, out of an abundance of caution. Lastly, you may want to consider

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: 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: 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: 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: 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: Solving the problem of mutual recursion

2013-05-27 Thread Chris Angelico
On Mon, May 27, 2013 at 4:07 PM, Ian Kelly wrote: > 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 crea

Re: Python error codes and messages location

2013-05-27 Thread Chris Angelico
On Mon, May 27, 2013 at 4:11 PM, Cameron Simpson wrote: > On 27May2013 04:49, Carlos Nepomuceno wrote: > | That's bad! I'd like to check all the IOError codes that may be > | raised by a function/method but the information isn't there. > > No, you really don't. Heh. I concur. Opening a file can

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

2013-05-27 Thread Chris Angelico
command line wrong (see the Note box in >> http://docs.python.org/2/library/subprocess.html#subprocess.Popen for some >> relevant advice). >> > Hi Chris, first of all thanks for the help. Unfortunately I can't provide the > actual commands because are tools that are not public

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-27 Thread Chris Angelico
On Tue, May 28, 2013 at 1:37 AM, Νίκος Γκρ33κ wrote: > Τη Δευτέρα, 27 Μαΐου 2013 5:45:25 μ.μ. UTC+3, ο χρήστης Mark Lawrence έγραψε: > >> Sure, all you need do is get your cheque book out. Also have you ever >> heard the expression "patience is a virtue"? > > Well, if i'am gonna pay someone and i

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-27 Thread Chris Angelico
On Tue, May 28, 2013 at 2:56 AM, Νίκος Γκρ33κ wrote: > Τη Δευτέρα, 27 Μαΐου 2013 6:52:32 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε: > >> Oh, and you may want to hire a typist, too. At the moment, your posts >> make you appear not to care about the job. > > I always ma

Re: Future standard GUI library

2013-05-27 Thread Chris Angelico
On Tue, May 28, 2013 at 3:13 AM, Michael Torrie wrote: > On 05/27/2013 09:31 AM, Wolfgang Keller wrote: >>> HTTP handles that just fine, with your choice of XML, >> >> And XML is definitely not suitable as a marshalling format for a RPC >> protocol. >> >> XML-over-HTTP is a true cerebral flatulanc

Re: Future standard GUI library

2013-05-28 Thread Chris Angelico
On Tue, May 28, 2013 at 9:10 AM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> I'll use XML when I have to, but if I'm inventing my own protocol, >> nope. There are just too many quirks with it. How do you represent an >> empty string na

Re: Python error codes and messages location

2013-05-28 Thread Chris Angelico
On Tue, May 28, 2013 at 4:57 PM, Fábio Santos wrote: > > On 28 May 2013 05:17, "Vito De Tullio" wrote: >> I really hope really far... have you never tried to google a localized >> error >> message? :\ > > Never. I don't even try. Same happens when someone pastes an error onto a mailing list like

Re: Python error codes and messages location

2013-05-28 Thread Chris Angelico
ck traces to the user. It could show a shorter > message in the user's language. Sounds like an OpenERP feature request, then. > On 28 May 2013 08:19, "Chris Angelico" wrote: >> Can we internationalize English instead of localizing Python? >> > > That is wors

Re: Making safe file names

2013-05-28 Thread Chris Angelico
On Tue, May 28, 2013 at 11:44 PM, Albert van der Horst wrote: > In article , > Neil Hodgson wrote: >>There's also the Windows device name hole. There may be trouble with >>artists named 'COM4', 'CLOCK$', 'Con', or similar. >> >>http://support.microsoft.com/kb/74496 > > That applies to MS-DOS

Re: Short-circuit Logic

2013-05-28 Thread Chris Angelico
On Tue, May 28, 2013 at 11:48 PM, Steven D'Aprano wrote: > py> y = 1e17 + x # x is not zero, so y should be > 1e17 > py> 1/(1e17 - y) > Traceback (most recent call last): > File "", line 1, in > ZeroDivisionError: float division by zero You don't even need to go for 1e17. By definition: >>>

Re: IndentationError: expected an indented block but it's there

2013-05-28 Thread Chris Angelico
On Wed, May 29, 2013 at 2:19 AM, Peter Otten <[email protected]> wrote: > Solution: configure your editor to use four spaces for indentation. ITYM eight spaces. But the real solution is to not mix tabs and spaces. Stick to one or the other and you're safe. ChrisA -- http://mail.python.org/mailman

Re: Future standard GUI library

2013-05-29 Thread Chris Angelico
On Wed, May 29, 2013 at 3:26 AM, Wolfgang Keller wrote: > I won't give you an example, but just some very basic criteria: > > - It must be very efficient for very small "datagrams" > - It must provide connections > - For asynchronous programming it must provide for callbacks In other words, a TEL

Re: String object has no attribute "append"

2013-05-29 Thread Chris Angelico
On Wed, May 29, 2013 at 4:25 AM, Matt Graves wrote: > I receive this error while toying around with Functions... > > def pulldata(speclist,speccolumn): > (speclist).append(column[('speccolumn')]) > > pulldata(speclist = 'numbers', speccolumn = "0") > > I'm getting the error becaus

Re: IndentationError: expected an indented block but it's there

2013-05-29 Thread Chris Angelico
On Wed, May 29, 2013 at 2:53 AM, Peter Otten <[email protected]> wrote: > Chris Angelico wrote: > >> On Wed, May 29, 2013 at 2:19 AM, Peter Otten <[email protected]> wrote: >>> Solution: configure your editor to use four spaces for indentation. >> >> I

Re: Short-circuit Logic

2013-05-29 Thread Chris Angelico
On Thu, May 30, 2013 at 12:27 AM, Ahmed Abdulshafy wrote: > Well, this is taken from my python shell> > 0.33455857352426283 == 0.33455857352426282 > True >>> 0.33455857352426283,0.33455857352426282 (0.3345585735242628, 0.3345585735242628) They're not representably different. ChrisA -- ht

Re: Python #ifdef

2013-05-29 Thread Chris Angelico
On Thu, May 30, 2013 at 12:55 AM, Grant Edwards wrote: > On 2013-05-29, Dan Stromberg wrote: > >> And in case you still want a preprocessor for Python (you likely don't need >> one this time), here's an example of doing this using the venerable m4: >> https://pypi.python.org/pypi/red-black-tree-m

Re: detect key conflict in a JSON file

2013-05-29 Thread Chris Rebert
on.html#repeated-names-within-an-object http://docs.python.org/2/library/json.html#json.load Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list

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

2013-05-29 Thread Chris Rebert
On Sun, May 26, 2013 at 4:58 PM, Luca Cerone wrote: > Hi Chris, first of all thanks for the help. Unfortunately I can't provide the > actual commands because are tools that are not publicly available. > I think I get the tokenization right, though.. the problem is not that the &g

Re: How clean/elegant is Python's syntax?

2013-05-29 Thread Chris Angelico
On Thu, May 30, 2013 at 4:37 AM, Ma Xiaojun wrote: > Yes, Python has much more libraries. But it seems that Python is more > useful and suitable in CLI and Web applications. People are still > discussing whether to replace tkinter with wxPython or not. VB and VFP > people are never bothered with s

Re: Short-circuit Logic

2013-05-29 Thread Chris Angelico
On Thu, May 30, 2013 at 12:28 PM, Steven D'Aprano wrote: > * de facto exact equality testing, only slower and with the *illusion* of > avoiding equality, e.g. "abs(x-y) < sys.float_info.epsilon" is just a > long and slow way of saying "x == y" when both numbers are sufficiently > large; > The pro

Re: How clean/elegant is Python's syntax?

2013-05-29 Thread Chris Angelico
On Thu, May 30, 2013 at 7:01 AM, Walter Hurry wrote: > On Thu, 30 May 2013 04:54:44 +1000, Chris Angelico wrote: > > >> GUIs and databasing are two of the areas where I >> think Python's standard library could stand to be improved a bit. >> There are definitely s

Re: How clean/elegant is Python's syntax?

2013-05-29 Thread Chris Angelico
On Thu, May 30, 2013 at 10:24 AM, Dan Stromberg wrote: > I'm finding it kind of hard to imagine not finding Python's syntax and > semantics pretty graceful. > > About the only thing I don't like is: > >var = 1, > > That binds var to a tuple (singleton) value, instead of 1. I agree, and would

Re: Short-circuit Logic

2013-05-29 Thread Chris Angelico
On Thu, May 30, 2013 at 3:10 PM, Steven D'Aprano wrote: > # Wrong, don't do this! > x = 0.1 > while x != 17.3: > print(x) > x += 0.1 > Actually, I wouldn't do that with integers either. There are too many ways that a subsequent edit could get it wrong and go infinite, so I'd *always* use

Re: Short-circuit Logic

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 3:42 PM, Steven D'Aprano wrote: > On Thu, 30 May 2013 13:45:13 +1000, Chris Angelico wrote: > >> Let's suppose someone is told to compare floating point numbers by >> seeing if the absolute value of the difference is less than some >>

Re: Can anyone please help me in understanding the following python code

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 7:48 PM, wrote: > Function mergeSort is called only once, but it is getting recursively > executed after the printing the last statement "print("Merging ",alist)". But > don't recursion taking place except at these places "mergeSort(lefthalf), > mergeSort(righthalf)" >

Re: Can anyone please help me in understanding the following python code

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 8:19 PM, wrote: > Thanks for the reply Chris. > > I am newbie to python, so please excuse me if I am asking chilly questions. All questions are welcome! > Can you please explain more about the following sentence. > "When it says "Splitting&qu

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 8:53 PM, wrote: > Good morning Michael, > > I'am afraid as much as you dont want to admin it that the moment i append the > charset directive into the connections tring i receive a huge error which it > can be displayed in: > > http://superhost.gr/cgi-bin/pelatologio.py

Re: User Input

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 9:48 PM, Eternaltheft wrote: > On Thursday, May 30, 2013 7:33:41 PM UTC+8, Eternaltheft wrote: >> Hi, I'm having trouble oh how prompt the user to enter a file name and how >> to set up conditions. For example, if there's no file name input by the >> user, a default is re

Re: Python teaching book recommendations: 3.3+ and with exercises

2013-05-30 Thread Chris Angelico
On Sat, May 4, 2013 at 12:54 AM, TP wrote: > Or maybe Think Python. A *lot* drier presentation than Python for Kids -- > after all, the subtitle which I forgot to mention is "How to Think Like a > Computer Scientist". Newer than Summerfield > , but only 1/3 the length > . Since I've only skimmed b

Re: Is this code correct?

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 10:25 PM, Νίκος Γκρ33κ wrote: > #!/usr/bin/python3 > # coding=utf-8 > (chomp a whole lot of code without any indication of what it ought to do) Why not run it and see? If it does what it ought to, it's correct; if it does something different, it's not. Why do you expect us

Re: User Input

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 10:19 PM, Eternaltheft wrote: > Ok thanks guys. but when i use > > filename = input('file name: ') > if not filename: #i get filename is not defined > return(drawBoard) #possible to return function when no file input from > user? Do you really want to return ther

Re: Can anyone please help me in understanding the following python code

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 10:39 PM, wrote: > Chris, Can you please let me know what makes the control of the program code > go to 2c after the output "Merging". It goes like this: 1. [eight element list] 2a. [eight element list] 2b. 1. [four element list] 2b. 2a. [four

Re: Short-circuit Logic

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 10:40 PM, Roy Smith wrote: > if somebody were to accidentally drop three zeros into the source code: > >> x = 1000 >> while x < 173: >> print(x) >> x += 1 > > should the loop just quietly not execute (which is what it will do > here)? Will that make your program co

Re: Is this code correct?

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 10:31 PM, Νίκος Γκρ33κ wrote: > This is my last question, everythign else is taken care of. > > i cant test thjis coe online because i receive this > > [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] suexec failure: could > not open log file > [Thu May 30 15:29:33

Re: User Input

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 10:37 PM, Eternaltheft wrote: > sorry about that, i got confused xD. yeah it works good now. > what i meant to say was can i return a function that i made, if the user > inputs nothing? Sure! Anything you want to do, you can do :) ChrisA -- http://mail.python.org/mailma

Re: Is this code correct?

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 11:05 PM, Mark Lawrence wrote: > Please ask questions unrelated to Python on a list that is unrelated to > Python. Lemme guess, he's next going to ask on the PostgreSQL mailing list. I mean, that's unrelated to Python, right? ChrisA -- http://mail.python.org/mailman/list

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 12:35 AM, Michael Torrie wrote: > On 05/30/2013 05:47 AM, Νίκος Γκρ33κ wrote: >> The moen i switched "charset = 'utf-8'" => "charset = 'utf8'" all >> started to work properly! > > Glad you have it working. &

Re: Short-circuit Logic

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 1:02 AM, Ethan Furman wrote: > On 05/30/2013 05:58 AM, Chris Angelico wrote: >> If you iterate from 1000 to 173, you get nowhere. This is the expected >> behaviour; this is what a C-style for loop would be written as, it's >> what range() does, it

Re: Future standard GUI library

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 2:40 AM, Wolfgang Keller wrote: > A GUI that can not be used without taking the ten fingers off the > keyboard is indeed entirely unusable for any half-proficient > screenworker. And anyone doing actual productive screenwork every day > for more than just a few months will

Re: Short-circuit Logic

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 2:58 AM, rusi wrote: > On May 30, 5:58 pm, Chris Angelico wrote: >> The alternative would be an infinite number of iterations, which is far far >> worse. > > There was one heavyweight among programming teachers -- E.W. Dijkstra > -- who had some

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 3:12 AM, rusi wrote: > You associate the primal (f)act of thinking about programming with > *doing* the generating. > By contrast the functional programmer thinks about what *is* the > result. I wish you'd explain that to my boss :) He often has trouble understanding why s

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 3:01 AM, Michael Torrie wrote: > On 05/30/2013 08:40 AM, Chris Angelico wrote: >> but if he's actively using the module, he probably knows where to >> find its docs. > > One would hope, but alas one probably hopes in vain. I'm not sure he &g

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 3:46 AM, Ma Xiaojun wrote: > On Fri, May 31, 2013 at 1:28 AM, Chris Angelico wrote: >> for (int i=0;i> { >> //do something with foo[i] >> } > > This is interesting! Yeah, but that's C++. It won't work in Python without this d

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 3:59 AM, rusi wrote: > On May 30, 10:28 pm, Chris Angelico wrote: >> On Fri, May 31, 2013 at 3:12 AM, rusi wrote: >> > You associate the primal (f)act of thinking about programming with >> > *doing* the generating. >> > By contrast th

Re: Python and GIL

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 4:14 AM, Ana Marija Sokovic wrote: > Hi, > > Can somebody explain to me how would you proceed in releasing the GIL and > whether you think it will have consequences? You release the GIL in C-level code when you don't need to work with Python objects for a while. Simple exa

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 4:36 AM, Ian Kelly wrote: > On Wed, May 29, 2013 at 8:49 PM, rusi wrote: >> On May 30, 6:14 am, Ma Xiaojun wrote: >>> What interest me is a one liner: >>> print '\n'.join(['\t'.join(['%d*%d=%d' % (j,i,i*j) for i in >>> range(1,10)]) for j in range(1,10)]) >> >> Ha,Ha! The

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 4:51 AM, Ian Kelly wrote: > On Thu, May 30, 2013 at 12:44 PM, Chris Angelico wrote: >> On Fri, May 31, 2013 at 4:36 AM, Ian Kelly wrote: >>> I don't object to changing the join method (one of the more >>> shoe-horned string methods) back

Re: Short-circuit Logic

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 5:22 AM, Steven D'Aprano wrote: > On Thu, 30 May 2013 16:40:52 +, Steven D'Aprano wrote: > >> On Fri, 31 May 2013 01:56:09 +1000, Chris Angelico wrote: > >>> You're assuming you can casually hit Ctrl-C to stop an infinite loop,

Re: sendmail smtplib.SMTP('localhost') Where is the email?

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 5:48 AM, inq1ltd wrote: > python help, > > I've tried this code which I got from: > > http://www.tutorialspoint.com/python/python_sending_email.htm > > I build this file and run it > > After running the the file and I get > > "Successfully sent email" > > My question is why

Re: Short-circuit Logic

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 10:13 AM, Rick Johnson wrote: > What if you need to perform operations on a sequence (more than once) in a > non-linear fashion? What if you need to modify the sequence whilst looping? > In many cases your simplistic "for loop" will fail miserably. What has this to do w

Re: Short-circuit Logic

2013-05-31 Thread Chris Angelico
On Fri, May 31, 2013 at 3:13 PM, Steven D'Aprano wrote: > What makes you think that the commutative law is relevant here? > Equality should be commutative. If a == b, then b == a. Also, it's generally understood that if a == c and b == c, then a == b, though there are more exceptions to that (esp

Re: Can anyone please help me in understanding the following python code

2013-05-31 Thread Chris Angelico
On Fri, May 31, 2013 at 3:43 PM, Cameron Simpson wrote: > On 30May2013 21:54, [email protected] wrote: > | One final question, Is there a way to edit the message once it has been > posted? > > Essentially, no. If there's some error in a post, reply to it > yourself with a correction. Transparency

Re: Finding Relative Maxima in Python3

2013-05-31 Thread Chris Rebert
te that that function resides in the "signal" submodule of scipy: http://docs.scipy.org/doc/scipy-dev/reference/generated/scipy.signal.argrelmax.html#scipy.signal.argrelmax Hence, it would be sp.signal.argrelmax() as opposed to just sp.argrelmax() Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: Create a file in /etc/ as a non-root user

2013-05-31 Thread Chris Angelico
On Sat, Jun 1, 2013 at 12:02 AM, Alister wrote: > /etc is used to store configuration files for the operating system & if > you inadvertently corrupt the wrong one then you could kill the system. Expanding on this: http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard The FHS applies to Li

Re: How clean/elegant is Python's syntax?

2013-05-31 Thread Chris Angelico
On Sat, Jun 1, 2013 at 1:43 AM, Ian Kelly wrote: > On Thu, May 30, 2013 at 1:38 PM, MRAB wrote: >> And additional argument (pun not intended) for putting sep second is >> that you can give it a default value: >> >>def join(iterable, sep=""): return sep.join(iterable) > > One argument against

Re: Too many python installations. Should i remove them all and install the latest?

2013-05-31 Thread Chris Angelico
On Sat, Jun 1, 2013 at 9:30 AM, Νικόλαος Κούρας wrote: > Still i feel my system is a bit messed p and i just want to leave the > 2.6 installed and remove all the rest python and then yum install > the_latest_one. It's not half as messed up as... uhh, scratch that. It's not half as messed up as th

Re: Too many python installations. Should i remove them all and install the latest?

2013-05-31 Thread Chris Angelico
On Sat, Jun 1, 2013 at 8:50 AM, David wrote: > On 01/06/2013, Νικόλαος Κούρας wrote: >> >> root@nikos [/]# ls -l /usr/bin/python* >> -rwxr-xr-x 3 root root 4864 Feb 22 02:00 /usr/bin/python* >> lrwxrwxrwx 1 root root6 Apr 5 20:34 /usr/bin/python2 -> python* >> -rwxr-xr-x 3 root root 4864 Feb

Re: Too many python installations. Should i remove them all and install the latest?

2013-05-31 Thread Chris Angelico
On Sat, Jun 1, 2013 at 10:08 AM, Νικόλαος Κούρας wrote: > Τη Σάββατο, 1 Ιουνίου 2013 2:55:38 π.μ. UTC+3, ο χρήστης Ian έγραψε: > > [ snip lots of double-spaced quoted text ] > > Do you think that i should have my VPS copmany to install ubuntu for me and > use apt-get install python3 ? > > I think

Re: Too many python installations. Should i remove them all and install the latest?

2013-05-31 Thread Chris Angelico
On Sat, Jun 1, 2013 at 10:18 AM, David wrote: > On 01/06/2013, Chris Angelico wrote: >> On Sat, Jun 1, 2013 at 8:50 AM, David wrote: >>> >>> Apart from the bizarre trailing '*' characters which for which I have >>> no sane explanation... >>

Re: Apache and suexec issue that wont let me run my python script

2013-05-31 Thread Chris Angelico
On Sat, Jun 1, 2013 at 3:30 PM, Νικόλαος Κούρας wrote: > I have asked this in alt.apache.configuration but received no response at all You posted it FIFTEEN HOURS AGO on a low-traffic forum. Sheesh! Learn a little patience. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Too many python installations. Should i remove them all and install the latest?

2013-05-31 Thread Chris Angelico
On Sat, Jun 1, 2013 at 3:35 PM, Νικόλαος Κούρας wrote: > Can you please tell me HOW TO GET RID OF ALL PYTHON SETUPS except 2.6 that is > needed for system core and then just install 3.3.2? Nuke the hard drive from orbit. It's the only way to be sure. > also why cant i install 3.3.2 using yum.

Re: Too many python installations. Should i remove them all and install the latest?

2013-06-01 Thread Chris Angelico
On Sat, Jun 1, 2013 at 5:51 PM, Νικόλαος Κούρας wrote: > Τη Σάββατο, 1 Ιουνίου 2013 9:18:26 π.μ. UTC+3, ο χρήστης Chris Angelico > έγραψε: > >> That would require that the repo have a 3.3.2 build in it. I don't >> know the Red Hat / CentOS policies there, but I know

Re: Apache and suexec issue that wont let me run my python script

2013-06-01 Thread Chris Angelico
On Sat, Jun 1, 2013 at 5:49 PM, Νικόλαος Κούρας wrote: > Τη Σάββατο, 1 Ιουνίου 2013 8:38:17 π.μ. UTC+3, ο χρήστης Chris Angelico > έγραψε: > >> You posted it FIFTEEN HOURS AGO on a low-traffic forum. >> Sheesh! Learn a little patience. > > I think this is enough time f

Re: Future standard GUI library

2013-06-01 Thread Chris Angelico
On Sun, Jun 2, 2013 at 4:18 AM, Wolfgang Keller wrote: >> > A GUI that can not be used without taking the ten fingers off the >> > keyboard is indeed entirely unusable for any half-proficient >> > screenworker. And anyone doing actual productive screenwork every >> > day for more than just a few m

Re: Too many python installations. Should i remove them all and install the latest?

2013-06-01 Thread Chris Angelico
On Sun, Jun 2, 2013 at 2:36 PM, Cameron Simpson wrote: > This is not a recommendation one way or another re CentOS versus > Ubunutu; it is a recommendation not to change without a better reason. Agreed. I happen to like Debian-family Linuxes, having spent most of my Linux time on either Ubuntu or

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-02 Thread Chris Angelico
On Mon, Jun 3, 2013 at 1:04 AM, Νικόλαος Κούρας wrote: > Τη Κυριακή, 2 Ιουνίου 2013 5:51:31 μ.μ. UTC+3, ο χρήστης Mark Lawrence έγραψε: > >> You've obviously arrived very late at the party. > > Apart from the "funny" commenting, can you for once contribute towards to an > actual solution or this

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-02 Thread Chris Angelico
On Mon, Jun 3, 2013 at 2:21 AM, Νικόλαος Κούρας wrote: > Paying for someone to just remove a dash to get the script working is too > much to ask for One dash: 1c Knowing where to remove it: $99.99 Total bill: $100.00 Knowing that it ought really to be "utf8mb4" and giving hints that the docs sh

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-02 Thread Chris Angelico
On Mon, Jun 3, 2013 at 2:44 AM, Νικόλαος Κούρας wrote: > Τη Κυριακή, 2 Ιουνίου 2013 7:31:25 μ.μ. UTC+3, ο χρήστης Chris Angelico > έγραψε: >> On Mon, Jun 3, 2013 at 2:21 AM, Νικόλαος Κούρας >> wrote: >> >> > Paying for someone to just remove a dash to get the

<    1   2   3   4   5   6   7   8   9   10   >