Re: Implement C's Switch in Python 3

2019-02-05 Thread MRAB
On 2019-02-06 00:25, John Sanders wrote: On Saturday, February 2, 2019 at 6:47:49 PM UTC-6, Sayth Renshaw wrote: Hi I am trying to convert a switch statement from C into Python. (why? practising). This is the C code. printf("Dated this %d", day); switch (day) { case 1: case 21: case 3

Re: Implement C's Switch in Python 3

2019-02-05 Thread John Sanders
On Saturday, February 2, 2019 at 6:47:49 PM UTC-6, Sayth Renshaw wrote: > Hi > > I am trying to convert a switch statement from C into Python. (why? > practising). > > This is the C code. > > printf("Dated this %d", day); > switch (day) { > case 1: case 21: case 31: > printf("st"

Re: Loop with Else Clause

2019-02-05 Thread Christman, Roger Graydon
-Original Message- From: Python-list On Behalf Of DL Neil Sent: Monday, February 4, 2019 11:29 PM To: 'Python' Subject: Loop with else clause What is the pythonic way to handle the situation where if a condition exists the loop should be executed, but if it does not something else shoul

RE: Loop with else clause

2019-02-05 Thread Avi Gross
The topic is how to deal with a python loop that may not be run if you want something else to happen in that case. Multiple solutions are presented along with this request: > Is there another, more pythonic, approach to conditional (for/while) > loop processing? Has anyone considered looking at

Re: Loop with else clause

2019-02-05 Thread Adriaan Renting
I don't know if it is very Pythonic, but I would do something like if no_oscar_nominees: print ("Sorry ...") else: print_list_of_oscar_nominees() And yes, that for/else construct can be confusing. Adriaan. >>> On 5-2-2019 at 5:29, DL Neil wrote: > What is the pythonic way to handl

RE: Loop with else clause

2019-02-05 Thread David Raymond
As mentioned somewhere, "readability counts", so why not just go with exactly what you said... if len(nominees) > 0:#if a condition exists for nominee in nominees: #the loop should be executed print(nominee) else:#but if not

Re: Python program to phone?

2019-02-05 Thread Mario R. Osorio
Hi there Steve. Did you check BeeWare? (https://pybee.org/) -- https://mail.python.org/mailman/listinfo/python-list

Re: Python program to phone?

2019-02-05 Thread Rhodri James
On 04/02/2019 23:12, Chris Roy-Smith wrote: On 5/2/19 7:20 am, Steve wrote: P.S.  Yes, I tried to post this about two weeks ago but could not seem to respond to the replies I received.  I could contact one or two individuals but apparently not the masses.  How do I find out how this list works

Re: Python program to phone?

2019-02-05 Thread Abdur-Rahmaan Janhangeer
see pydroid and qpython on play store.2 Abdur-Rahmaan Janhangeer http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ Mauritius -- https://mail.python.org/mailman/listinfo/python-list

Re: python is going to die! =(

2019-02-05 Thread Prahallad Achar
Python is the only immortal On Tue, 5 Feb 2019, 17:01 python is alive > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: python is going to die! =(

2019-02-05 Thread mojimo2000
python is alive -- https://mail.python.org/mailman/listinfo/python-list

Re: Loop with else clause

2019-02-05 Thread Peter Otten
DL Neil wrote: > What is the pythonic way to handle the situation where if a condition > exists the loop should be executed, but if it does not something else > should be done? > Possible solution: > To make anything more than the trivial case readable, I think I'd put > the list processing into

Re: Loop with else clause

2019-02-05 Thread Ben Finney
DL Neil writes: > Possible solution: > To make anything more than the trivial case readable, I think I'd put > the list processing into one function, and the exception into another > (except that this case is so trivial), ie > > if list: > process_list() #the heading and for-l