Re: Anything similar to __END__ in perl

2017-12-08 Thread Karsten Hilbert
On Fri, Dec 08, 2017 at 02:19:13AM -0800, Rustom Mody wrote:

> > > Hi, perl has __END__ which ignore all the lines below it.
> > > 
> > > Is there anything similar to __END__ in python? Thanks.
> > 
> > Something similar is:
> > 
> > import sys
> > sys.exit()
> 
> That will give syntax (or something) errors for what follows

True enough, didn't think of that. However, OP asked for
something _similar_ :-)

Which proves that any answer needs a definition of "similar" by OP.

Or at least: how similar is similar _enough_ to __END__ in Perl.

Karsten
-- 
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Anything similar to __END__ in perl

2017-12-08 Thread Rustom Mody
On Friday, December 8, 2017 at 3:13:56 PM UTC+5:30, Karsten Hilbert wrote:
> On Thu, Dec 07, 2017 at 11:55:48PM -0600, Peng Yu wrote:
> 
> > Hi, perl has __END__ which ignore all the lines below it.
> > 
> > Is there anything similar to __END__ in python? Thanks.
> 
> Something similar is:
> 
>   import sys
>   sys.exit()

That will give syntax (or something) errors for what follows

I'd say something similar is """

eg

$ cat xyz.py
def f():
print("hello world")

f()

"""
Tyger Tyger burning bright
In the forests of the night
What immortal hand or eye
Dare frame thy fearful symmetry
"""
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Anything similar to __END__ in perl

2017-12-08 Thread Karsten Hilbert
On Thu, Dec 07, 2017 at 11:55:48PM -0600, Peng Yu wrote:

> Hi, perl has __END__ which ignore all the lines below it.
> 
> Is there anything similar to __END__ in python? Thanks.

Something similar is:

import sys
sys.exit()

Karsten
-- 
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346
-- 
https://mail.python.org/mailman/listinfo/python-list


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