Anything similar to __END__ in perl

2017-12-07 Thread Peng Yu
Hi, perl has __END__ which ignore all the lines below it. Is there anything similar to __END__ in python? Thanks. -- Regards, Peng -- https://mail.python.org/mailman/listinfo/python-list

Re: why won't slicing lists raise IndexError?

2017-12-07 Thread Python
Hi Rick! On Wed, Dec 06, 2017 at 04:05:42PM -0800, Rick Johnson wrote: > Python wrote: > > [...] > > > THIS IS FALSE. CALLING A FUNCTION > > What *FUNCTION*? In this snippet (which again, we agreed was an incomplete academic example): if item: process(item) else: do_w

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Ethan Furman
On 12/07/2017 10:28 AM, Ethan Furman wrote: The simple answer is No, and all the answers agree on that point. It does beg the question of what an identity function is, though. Thankfully, Paul answered that question with a good explanation*. Thanks, everyone, for the discussion. -- ~Ethan~

Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-07 Thread Python
On Thu, Dec 07, 2017 at 01:29:11PM +1100, Steve D'Aprano wrote: > On Thu, 7 Dec 2017 08:22 am, Python wrote: > >> > Linux doesn’t do “OS file associations”. > >> > >> Then how does my Linux box know that when I double-click on a text file, it > >> launches kwrite rather than (say) the Gimp or Libr

Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-07 Thread Rick Johnson
On Wednesday, December 6, 2017 at 8:29:23 PM UTC-6, Steve D'Aprano wrote: [...] > If the term "OS file associations" is ever so slightly > inaccurate (it's not the actual OS kernel that does the > associating, but the desktop environment), well, we can > probably say the same thing about Mac

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Ben Finney
Nathan Ernst writes: > There is a built-in identity function in Python. The function is called > 'id'. It should be clear from the rest of the thread. But, to be explicit: That's not what is meant by “identity function”, and the Python ‘id’ function is not an identity function. The Python ‘id’

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Ben Finney
Ethan Furman writes: > My contention is that an identity function is a do-nothing function > that simply returns what it was given: > > --> identity(1) > 1 > > --> identity('spam') > 'spam' These seem good to me. One argument given, the same result returned. > --> identity('spam', 'eggs', 7) >

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Paul Moore
On 7 December 2017 at 20:35, Chris Angelico wrote: > Because it's impossible to return multiple values. IMO the "identity > function" is defined only in terms of one single argument, so all of > this is meaningless. Indeed, this is the key point. The Python language only allows returning one valu

Re: SystemError: error return without exception set

2017-12-07 Thread Lawrence D’Oliveiro
On Friday, December 8, 2017 at 5:15:35 AM UTC+13, Natalie Leung wrote: > I have emailed the provider but their technical support staff has stated > that they have exhausted of all ideas. If they can’t supply you with a product fit for purpose, time to send it back for a refund. -- https://mail

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Lele Gaifax
Chris Angelico writes: > On Fri, Dec 8, 2017 at 6:29 AM, Lele Gaifax wrote: >> Chris Angelico writes: >> >>> On Fri, Dec 8, 2017 at 5:53 AM, Peter Otten <__pete...@web.de> wrote: Hm, what does -- and what should -- identity(('spam', 'eggs', 7)) produce? >>> >>> The

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Chris Angelico
On Fri, Dec 8, 2017 at 8:30 AM, Lele Gaifax wrote: > Chris Angelico writes: > >> On Fri, Dec 8, 2017 at 6:29 AM, Lele Gaifax wrote: >>> Chris Angelico writes: >>> On Fri, Dec 8, 2017 at 5:53 AM, Peter Otten <__pete...@web.de> wrote: > > Hm, what does -- and what should -- > >>>

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Ethan Furman
On 12/07/2017 12:24 PM, Peter Otten wrote: identity((a, b, c)) calls identity() with one argument whereas identity(a, b, c) calls identity() with three arguments. That's certainly an effect; you just undo it with your test for len(args) == 1. That means that your identity() function throws aw

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Chris Angelico
On Fri, Dec 8, 2017 at 7:25 AM, Ned Batchelder wrote: > On 12/7/17 2:41 PM, Ethan Furman wrote: >> >> On 12/07/2017 11:23 AM, Ned Batchelder wrote: >>> >>> On 12/7/17 1:28 PM, Ethan Furman wrote: >> >> --> identity('spam', 'eggs', 7) ('spam', 'eggs', 7) >>> >>> >>> I don't see why this l

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Ned Batchelder
On 12/7/17 2:41 PM, Ethan Furman wrote: On 12/07/2017 11:23 AM, Ned Batchelder wrote: On 12/7/17 1:28 PM, Ethan Furman wrote: --> identity('spam', 'eggs', 7) ('spam', 'eggs', 7) I don't see why this last case should hold.  Why does the function take more than one argument?  And if it does,

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Peter Otten
Ethan Furman wrote: > On 12/07/2017 10:53 AM, Peter Otten wrote: >> Ethan Furman wrote: >> >>> The simple answer is No, and all the answers agree on that point. >>> >>> It does beg the question of what an identity function is, though. >>> >>> My contention is that an identity function is a do-noth

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Nathan Ernst
There is a built-in identity function in Python. The function is called 'id'. See https://docs.python.org/3/library/functions.html#id Note that this will not behave the same across different Python runtimes. e.g. CPython, IronPython or Jython all implement this differently. An example: Python 3.5

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Ethan Furman
On 12/07/2017 11:46 AM, Paul Moore wrote: On 7 December 2017 at 18:28, Ethan Furman wrote: The simple answer is No, and all the answers agree on that point. It does beg the question of what an identity function is, though. My contention is that an identity function is a do-nothing function th

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Paul Moore
On 7 December 2017 at 18:28, Ethan Furman wrote: > The simple answer is No, and all the answers agree on that point. > > It does beg the question of what an identity function is, though. > > My contention is that an identity function is a do-nothing function that > simply returns what it was given

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Ethan Furman
On 12/07/2017 11:23 AM, Ned Batchelder wrote: On 12/7/17 1:28 PM, Ethan Furman wrote: --> identity('spam', 'eggs', 7) ('spam', 'eggs', 7) I don't see why this last case should hold. Why does the function take more than one argument? And if it does, then why doesn't it work like this?

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Chris Angelico
On Fri, Dec 8, 2017 at 6:29 AM, Lele Gaifax wrote: > Chris Angelico writes: > >> On Fri, Dec 8, 2017 at 5:53 AM, Peter Otten <__pete...@web.de> wrote: >>> >>> Hm, what does -- and what should -- >>> >>> identity(('spam', 'eggs', 7)) >>> >>> produce? >> >> The same thing. And so should identity(((

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Lele Gaifax
Chris Angelico writes: > On Fri, Dec 8, 2017 at 5:53 AM, Peter Otten <__pete...@web.de> wrote: >> >> Hm, what does -- and what should -- >> >> identity(('spam', 'eggs', 7)) >> >> produce? > > The same thing. And so should identity((('spam', 'eggs', 7))) and > identity'spam', 'eggs', 7 and

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Ned Batchelder
On 12/7/17 1:28 PM, Ethan Furman wrote: The simple answer is No, and all the answers agree on that point. It does beg the question of what an identity function is, though. My contention is that an identity function is a do-nothing function that simply returns what it was given: --> identity(

Re: SystemError: error return without exception set

2017-12-07 Thread Lele Gaifax
Chris Angelico writes: > On Fri, Dec 8, 2017 at 5:28 AM, MRAB wrote: >> It's probably that the code is assuming that call somewhere to the Python >> API is returning a reference, but sometimes it isn't. >> >> _All_ such return values should be checked for NULL. > > Mmm true. Forgot about tha

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Ethan Furman
On 12/07/2017 10:53 AM, Peter Otten wrote: Ethan Furman wrote: The simple answer is No, and all the answers agree on that point. It does beg the question of what an identity function is, though. My contention is that an identity function is a do-nothing function that simply returns what it wa

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Chris Angelico
On Fri, Dec 8, 2017 at 5:53 AM, Peter Otten <__pete...@web.de> wrote: > Ethan Furman wrote: > >> The simple answer is No, and all the answers agree on that point. >> >> It does beg the question of what an identity function is, though. >> >> My contention is that an identity function is a do-nothing

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Peter Otten
Ethan Furman wrote: > The simple answer is No, and all the answers agree on that point. > > It does beg the question of what an identity function is, though. > > My contention is that an identity function is a do-nothing function that > simply returns what it was given: > > --> identity(1) > 1

Re: Python installer hangs in Windows 7

2017-12-07 Thread rudplatt
On Monday, December 4, 2017 at 3:44:48 PM UTC-5, christian...@gmail.com wrote: > Same with me, except that I tried to install Python 3.6.3. Unchecking > "Install launcher for all users" helped, however. I'm having the same issue. I need Python to be available for all users. Has anyone found a s

Re: Python script

2017-12-07 Thread breamoreboy
On Thursday, December 7, 2017 at 2:06:46 PM UTC, prvn...@gmail.com wrote: > Hi All, > I am new to python need help to write a script in python > my requirement is :- > write a python script to print sentence from a txt file to another txt file > > Regards, > Praveen Read this https://docs.python.

Re: SystemError: error return without exception set

2017-12-07 Thread Chris Angelico
On Fri, Dec 8, 2017 at 5:28 AM, MRAB wrote: > On 2017-12-07 17:22, Chris Angelico wrote: >> >> On Fri, Dec 8, 2017 at 2:36 AM, Natalie Leung >> wrote: >>> >>> I am trying to use Python to communicate and send commands in MSC Marc. A >>> part of the code looks something like this: >>> >>> from py_

Re: SystemError: error return without exception set

2017-12-07 Thread MRAB
On 2017-12-07 17:22, Chris Angelico wrote: On Fri, Dec 8, 2017 at 2:36 AM, Natalie Leung wrote: I am trying to use Python to communicate and send commands in MSC Marc. A part of the code looks something like this: from py_mentat import* directory = '[specified the file path to my model]' mar

Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Ethan Furman
The simple answer is No, and all the answers agree on that point. It does beg the question of what an identity function is, though. My contention is that an identity function is a do-nothing function that simply returns what it was given: --> identity(1) 1 --> identity('spam') 'spam' --> ide

Re: SystemError: error return without exception set

2017-12-07 Thread Chris Angelico
On Fri, Dec 8, 2017 at 2:36 AM, Natalie Leung wrote: > I am trying to use Python to communicate and send commands in MSC Marc. A > part of the code looks something like this: > > from py_mentat import* > > directory = '[specified the file path to my model]' > marcModel = '[name of my model]' > >

Re: SystemError: error return without exception set

2017-12-07 Thread Thomas Nyberg
On 12/07/2017 05:15 PM, Natalie Leung wrote: > Hi Thomas, > > You are correct in that the software and its packages are close-sourced. I > have emailed the provider but their technical support staff has stated that > they have exhausted of all ideas. > > An interesting thing to note is that th

Re: SystemError: error return without exception set

2017-12-07 Thread MRAB
On 2017-12-07 15:36, Natalie Leung wrote: I am trying to use Python to communicate and send commands in MSC Marc. A part of the code looks something like this: from py_mentat import* directory = '[specified the file path to my model]' marcModel = '[name of my model]' py_echo(0) openModel = '*

Re: SystemError: error return without exception set

2017-12-07 Thread Natalie Leung
On Thursday, December 7, 2017 at 11:00:37 AM UTC-5, Thomas Nyberg wrote: > On 12/07/2017 04:36 PM, Natalie Leung wrote: > > The code stops at "py_send(openModel)" with an error message that reads: > > Traceback (most recent call last): File "[my file path]", line 11, in > > py_send(openModel) > >

Re: SystemError: error return without exception set

2017-12-07 Thread Thomas Nyberg
On 12/07/2017 04:36 PM, Natalie Leung wrote: > The code stops at "py_send(openModel)" with an error message that reads: > Traceback (most recent call last): File "[my file path]", line 11, in > py_send(openModel) > SystemError: error return without exception set > > I tried running the code on d

Re: SystemError: error return without exception set

2017-12-07 Thread Larry Martell
On Thu, Dec 7, 2017 at 10:36 AM, Natalie Leung wrote: > I am trying to use Python to communicate and send commands in MSC Marc. A > part of the code looks something like this: > > from py_mentat import* > > directory = '[specified the file path to my model]' > marcModel = '[name of my model]' > >

SystemError: error return without exception set

2017-12-07 Thread Natalie Leung
I am trying to use Python to communicate and send commands in MSC Marc. A part of the code looks something like this: from py_mentat import* directory = '[specified the file path to my model]' marcModel = '[name of my model]' py_echo(0) openModel = '*new_model yes *open_model "'+ directory +

Re: Python homework

2017-12-07 Thread Rhodri James
On 07/12/17 13:19, Mario R. Osorio wrote: On Tuesday, December 5, 2017 at 8:33:52 PM UTC-5, nick martinez wrote: I have a question on my homework. [snip] Just my 2 cents: Sigh. Please don't do people's homework for them. It doesn't teach them anything. Now Nick had got 90% of the way

Re: Python script

2017-12-07 Thread Joel Goldstick
On Thu, Dec 7, 2017 at 9:06 AM, wrote: > Hi All, > I am new to python need help to write a script in python > my requirement is :- > write a python script to print sentence from a txt file to another txt file > > Regards, > Praveen > -- > https://mail.python.org/mailman/listinfo/python-list > So

Re: Python script

2017-12-07 Thread Christian Gollwitzer
Am 07.12.17 um 15:06 schrieb prvn.m...@gmail.com: Hi All, I am new to python need help to write a script in python my requirement is :- write a python script to print sentence from a txt file to another txt file txt = open("another.txt", "w") print("sentence from txt file", file = txt)

Python script

2017-12-07 Thread prvn . mora
Hi All, I am new to python need help to write a script in python my requirement is :- write a python script to print sentence from a txt file to another txt file Regards, Praveen -- https://mail.python.org/mailman/listinfo/python-list

Re: Python homework

2017-12-07 Thread Mario R. Osorio
On Tuesday, December 5, 2017 at 8:33:52 PM UTC-5, nick martinez wrote: > I have a question on my homework. My homework is to write a program in which > the computer simulates the rolling of a die 50 > times and then prints > (i). the most frequent side of the die > (ii). the average die value o

Re: Python homework

2017-12-07 Thread edmondo . giovannozzi
Il giorno mercoledì 6 dicembre 2017 02:33:52 UTC+1, nick martinez ha scritto: > I have a question on my homework. My homework is to write a program in which > the computer simulates the rolling of a die 50 > times and then prints > (i). the most frequent side of the die > (ii). the average die val

Re: we want python software

2017-12-07 Thread Karsten Hilbert
> > A junior programmer sees the unlimited possibilities of programming. No > > montain is too high to climb. > > > > A seasoned programmer is elated if they can get anything to work at all. Good judgement comes from experience. And a lot of that comes from bad judgement. Karsten -- https://mail

Re: we want python software

2017-12-07 Thread Chris Angelico
On Thu, Dec 7, 2017 at 6:54 PM, Marko Rauhamaa wrote: > Gregory Ewing : > >> Rick Johnson wrote: >>> DOLT: "Programming is easy! Once you learn the langauge, >>> it's just a matter of fill-in-the-blanks." >> >> To be fair to this person, for someone who has a natural aptitude for >> progra