Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
from future import pass_function
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 26 - 50 of 51 - Collapse all  -  Translate all to Translated (View all originals) < Older  Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Devin Jeanpierre  
View profile  
 More options Jul 26 2012, 5:16 am
Newsgroups: comp.lang.python
From: Devin Jeanpierre <jeanpierr...@gmail.com>
Date: Thu, 26 Jul 2012 05:16:17 -0400
Local: Thurs, Jul 26 2012 5:16 am
Subject: Re: from future import pass_function

On Thu, Jul 26, 2012 at 1:20 AM, Michael Hrivnak <mhriv...@hrivnak.org> wrote:
> If we want pass(), then why not break() and continue()?  And also
> def() and class()?  for(), while(), if(), with(), we can make them all
> callable objects!

No, you actually can't.

You omit the one control flow statement that could actually be turned
into a function, raise. None of the rest could in Python (except
class), and one of the rest couldn't in any language (def).

-- Devin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steven D'Aprano  
View profile  
 More options Jul 26 2012, 5:26 am
Newsgroups: comp.lang.python
From: Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info>
Date: 26 Jul 2012 09:26:49 GMT
Local: Thurs, Jul 26 2012 5:26 am
Subject: Re: from future import pass_function

On Thu, 26 Jul 2012 08:59:30 +0200, Ulrich Eckhardt wrote:
> Am 26.07.2012 04:38, schrieb Steven D'Aprano:
>> The examples of pass-as-a-function shown by the Original Poster don't
>> give any clue of what advantage there is to make pass a function.

> Just read the text, it just struck me how similar pass and print are,
> i.e. that neither actually needs to be a keyword. In some cases, I would
> rather use "return" to replace "pass" though.

I did read your text. I was not enlightened.

>> It appears that the only reason for this suggested change is that he
>> would rather write "pass()" instead of "pass", possibly because he
>> thinks it looks cool.

> I have no idea where you got the "cool" from, it is not in my posting.

I didn't say that was what you said. I made it clear that "cool" was *my*
words.

>> (Actually, I reckon that what is driving this idea is that the OP is a
>> beginner, and he's got a syntax error a few times from writing
>> "pass()", and so he thought it would be easier to force other people to
>> change tens or hundreds of thousands of Python programs to use "pass()"
>> instead of "pass" than to just learn to stop putting parentheses after
>> it.

> So, and in order to force people to write parens or break their code I
> have considered the possibility of importing that feature from
> __future__ for those people that want it? Seriously, Steven, as much as
> I like your regular contributions here, this time you had better logged
> off and taken a walk, because you come across as _very_ arrogant here.

*shrug* I'm just being honest. As you admitted, you hadn't really given
the idea a lot of thought. Your examples didn't show any difference
except a pair of parentheses () after the pass. I made two guesses on
what motivated your suggestion, based on the information I had in front
of me at the time.

By the way, you trimmed out my comment where I admit to also having come
up with changes to Python without giving any thought to the consequences.
My guesses as to your motive for wanting to change "pass" were not based
on your thoughts, which are hidden to me, but on the way I used to think.
It took me a long time to learn that, for an established language like
Python, change is nearly always for the worse, and any change that
requires changing existing code better have a very good excuse.

--
Steven


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Angelico  
View profile  
 More options Jul 26 2012, 5:42 am
Newsgroups: comp.lang.python
From: Chris Angelico <ros...@gmail.com>
Date: Thu, 26 Jul 2012 19:42:11 +1000
Local: Thurs, Jul 26 2012 5:42 am
Subject: Re: from future import pass_function
On Thu, Jul 26, 2012 at 7:16 PM, Devin Jeanpierre

<jeanpierr...@gmail.com> wrote:
> On Thu, Jul 26, 2012 at 1:20 AM, Michael Hrivnak <mhriv...@hrivnak.org> wrote:
>> If we want pass(), then why not break() and continue()?  And also
>> def() and class()?  for(), while(), if(), with(), we can make them all
>> callable objects!

> No, you actually can't.

> You omit the one control flow statement that could actually be turned
> into a function, raise. None of the rest could in Python (except
> class), and one of the rest couldn't in any language (def).

Well, if/while/for could be functions. So could with, probably. Now,
def would be a little tricky...

ChrisA


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Devin Jeanpierre  
View profile  
 More options Jul 26 2012, 6:00 am
Newsgroups: comp.lang.python
From: Devin Jeanpierre <jeanpierr...@gmail.com>
Date: Thu, 26 Jul 2012 06:00:53 -0400
Local: Thurs, Jul 26 2012 6:00 am
Subject: Re: from future import pass_function

On Thu, Jul 26, 2012 at 5:42 AM, Chris Angelico <ros...@gmail.com> wrote:
>> You omit the one control flow statement that could actually be turned
>> into a function, raise. None of the rest could in Python (except
>> class), and one of the rest couldn't in any language (def).

> Well, if/while/for could be functions. So could with, probably. Now,
> def would be a little tricky...

In Haskell, sure.

-- Devin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ulrich Eckhardt  
View profile  
 More options Jul 26 2012, 7:45 am
Newsgroups: comp.lang.python
From: Ulrich Eckhardt <ulrich.eckha...@dominolaser.com>
Date: Thu, 26 Jul 2012 13:45:23 +0200
Local: Thurs, Jul 26 2012 7:45 am
Subject: Re: from future import pass_function
Am 26.07.2012 11:26, schrieb Steven D'Aprano:

I didn't say "Pass should be a function!" but asked "What do you
think?". You are assuming lots of things about my goals and jumping to
conclusions like that I'm complaining about the stupid Python syntax,
that I'm a frustrated noob, that I want someone to fix that syntax, but
that is not the case! I'm engaging in a discussion here exactly in order
to test the idea I had.

> It took me a long time to learn that, for an established language like
> Python, change is nearly always for the worse, and any change that
> requires changing existing code better have a very good excuse.

...so what do you do when you have an idea? You think about it on your
own, right? I do so, too, but I also engage in discussions with others.
See? BTW: I think you missed the implications of this thread's topic and
the snide remark about forcing people to change their code, i.e. that no
existing code has to change (apart from the Python implementation, of
course), even if pass was made a function!

Uli


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Terry Reedy  
View profile  
 More options Jul 26 2012, 10:38 am
Newsgroups: comp.lang.python
From: Terry Reedy <tjre...@udel.edu>
Date: Thu, 26 Jul 2012 10:38:28 -0400
Local: Thurs, Jul 26 2012 10:38 am
Subject: Re: from future import pass_function
On 7/26/2012 2:39 AM, Ulrich Eckhardt wrote:

> I have seen code that just created a list comprehension to iterate over
> something but was discarding the results.

If you mean, discard the resulting list, that is probably bad code as it
should not create the list in the first place. A generator expression or
for loop will iterate without creating an unneeded list.

 > That could be a case for a "do nothing" function.

Such code does do something within the comprehension.

> Just having a function that does nothing

Not possible. None is the default return. Python does not have
proceedures, and that is not going to change, especially for a null
proceedure.

--
Terry Jan Reedy


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
rusi  
View profile  
 More options Jul 26 2012, 11:01 am
Newsgroups: comp.lang.python
From: rusi <rustompm...@gmail.com>
Date: Thu, 26 Jul 2012 08:01:56 -0700 (PDT)
Local: Thurs, Jul 26 2012 11:01 am
Subject: Re: from future import pass_function
On Jul 25, 1:40 pm, Ulrich Eckhardt <ulrich.eckha...@dominolaser.com>
wrote:

> Hi!

> I just had an idea, it occurred to me that the pass statement is pretty
> similar to the print statement, and similarly to the print() function,
> there could be a pass() function that does and returns nothing.

> Example:
>     def pass():
>         return

Since many have said NO but I see no good reasons for this no yet,
here's mine:

tl;dr version: Do-nothing statements are easy just do nothing, ie
pass.
Do-nothing expressions are hard. In the fully generic context they are
impossible to implement.

Longer version:

Consider the if expression and the if statement. The if statement can
have its else part elided in which case it defaults to pass.  The if
expression cannot so elide. Why?

Consider the expression: (exp if cond)  # no else
Now in "x + (exp if cond)" if cond is false it should presumably be 0
However in "x * (exp if cond)" it should presumably be 1?
And in the first case if x were a list should it not be [] ?

Now consider your suggestion:
def pass(): return
is identical to
def pass(): return None

So you are saying that None can serve as a "generic zero"?
Of course as you know (no suggestion that you are a noob on my part!!)

Python 2.7.3rc2 (default, Apr 22 2012, 22:35:38)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> 0+3
3
>>> None+3

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
>>> None+[1,2,3]

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'


So now you (may) retort but these have nothing to do with what you
asked.

You see what youve asked for is moving pass from the statement world
to the expression world.
The meaning of a do-nothing statement is easy to give.  The meaning of
a do-nothing expression is hard because we are obliged to specify a
type for expressions and the only value that can possibly belong to
all types is the error-value (what denotational semantics calls bottom
⊥ )

A more laymanish example:
I have a multiplication
I want one of the operands to be a 1, ie the identity
I substitute it with the nearest available value ie 0

And out goes the baby with the bathwater!

So to come back to your proposal:

> there could be a pass() function that does and returns nothing.

does nothing: easy
returns nothing: impossible (None is not "nothing", its more like
"error")

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steven D'Aprano  
View profile  
 More options Jul 26 2012, 11:21 am
Newsgroups: comp.lang.python
From: Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info>
Date: 26 Jul 2012 15:21:17 GMT
Local: Thurs, Jul 26 2012 11:21 am
Subject: Re: from future import pass_function

On Thu, 26 Jul 2012 13:45:23 +0200, Ulrich Eckhardt wrote:
> I didn't say "Pass should be a function!" but asked "What do you
> think?". You are assuming lots of things about my goals and jumping to
> conclusions like that I'm complaining about the stupid Python syntax,
> that I'm a frustrated noob, that I want someone to fix that syntax, but
> that is not the case! I'm engaging in a discussion here exactly in order
> to test the idea I had.

Fair point. I underestimated you. But go back and re-read your first
post, and see if you can understand *why* I underestimated you. You
really didn't give any sign that you had given this question much
detailed thought.

Perhaps if you had mentioned that you had not decided whether this was a
good idea and was looking for arguments both for and against, this tone
of this discussion would have been very different.

>> It took me a long time to learn that, for an established language like
>> Python, change is nearly always for the worse, and any change that
>> requires changing existing code better have a very good excuse.

> ...so what do you do when you have an idea? You think about it on your
> own, right? I do so, too, but I also engage in discussions with others.
> See? BTW: I think you missed the implications of this thread's topic and
> the snide remark about forcing people to change their code, i.e. that no
> existing code has to change (apart from the Python implementation, of
> course), even if pass was made a function!

I think that you misunderstand the purpose of from __future__ import. It
is a *temporary* measure, always. Features which are not backward
compatible are FIRST introduced as __future__ features, and THEN a
release or two later, they become mandatory. (Unless they are dropped,
which has not happened yet.)

There have been seven __future__ features as of Python 3.2:

absolute_import (enabled in 2.5, mandatory in 2.7)
division (enabled in 2.2, mandatory in 3.0)
generators (enabled in 2.2, mandatory in 2.3)
nested_scopes (enabled in 2.1, mandatory in 2.2)
print_function (enabled in 2.6, mandatory in 3.0)
unicode_literals (enabled in 2.6, mandatory in 3.0)
with_statement (enabled in 2.5, mandatory in 2.6)

In any case, I acknowledge that I was wrong about your motivation. I made
a guess based on the limited information I had, and based on my own
history, and you tell me my guess was wrong. I accept that.

--
Steven


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joel Goldstick  
View profile  
 More options Jul 26 2012, 12:55 pm
Newsgroups: comp.lang.python
From: Joel Goldstick <joel.goldst...@gmail.com>
Date: Thu, 26 Jul 2012 12:55:18 -0400
Local: Thurs, Jul 26 2012 12:55 pm
Subject: Re: from future import pass_function
On Thu, Jul 26, 2012 at 11:21 AM, Steven D'Aprano

This is the silliest thread I've ever seen in this group.  I should
abstain, but what the heck:

If you want a function that does nothing, write one.  Maybe like this:

def do_nothing():
    return

Then, where you previous wrote pass in your code you can replace it
with this thing.

But really, not being a language meta-maven myself, somewhere above in
this thread it was pointed out that pass is a syntax construction that
is necessary in the very seldom case where you create a block of code
that has no instructions.  Instead of braces for every block, you get
to skip that in python and just put pass in this extraordinary little
case.

While I've come to the point in my python coding knowledge to get my
day to day work done proficiently, I'm amazed each time I delve deeper
into how profoundly well this language was thought out.  No offence to
all the well meaning participants here, but this looks like trolling
--
Joel Goldstick


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Prasad, Ramit  
View profile  
 More options Jul 26 2012, 1:19 pm
Newsgroups: comp.lang.python
From: "Prasad, Ramit" <ramit.pra...@jpmorgan.com>
Date: Thu, 26 Jul 2012 17:19:37 +0000
Local: Thurs, Jul 26 2012 1:19 pm
Subject: RE: from future import pass_function

> No offence to all the well meaning participants here, but this looks like trolling

I thought Ranting Rick had sole dominion over trolling?

Ramit

This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Angelico  
View profile  
 More options Jul 26 2012, 1:33 pm
Newsgroups: comp.lang.python
From: Chris Angelico <ros...@gmail.com>
Date: Fri, 27 Jul 2012 03:33:56 +1000
Local: Thurs, Jul 26 2012 1:33 pm
Subject: Re: from future import pass_function
On Fri, Jul 27, 2012 at 3:19 AM, Prasad, Ramit

<ramit.pra...@jpmorgan.com> wrote:
>> No offence to all the well meaning participants here, but this looks like trolling

> I thought Ranting Rick had sole dominion over trolling?

Certainly not. We are well endowed with trolls here (Xah Lee isn't
prolific, but is certainly effective), plus we have some regular
posters who'll cover the trolls' tea breaks on occasion (myself,
sometimes, and Steven D'Aprano).

Now where did I put my asbestos suit... the Aprano is going to be at
me pretty hard for this...

*dives for cover without it*

ChrisA


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Angelico  
View profile  
 More options Jul 26 2012, 2:14 pm
Newsgroups: comp.lang.python
From: Chris Angelico <ros...@gmail.com>
Date: Fri, 27 Jul 2012 04:14:17 +1000
Local: Thurs, Jul 26 2012 2:14 pm
Subject: Re: from future import pass_function
On Fri, Jul 27, 2012 at 4:01 AM, Dennis Lee Bieber

<wlfr...@ix.netcom.com> wrote:
> On Thu, 26 Jul 2012 19:42:11 +1000, Chris Angelico <ros...@gmail.com>
> declaimed the following in gmane.comp.python.general:

>> Well, if/while/for could be functions. So could with, probably. Now,
>> def would be a little tricky...

>         And how would a function "if" perform

It'd be much more similar to the ternary operator. Currently there's
no way to pass an unevaluated expression to a Python function, but the
concept isn't impossible. It's just more suited to functional
languages (someone mentioned Haskell) than to imperative ones.

Oh THAT's easily solved. A while loop is an if with a goto!

Okay, was that sufficiently incendiary? Have fun! :)

ChrisA


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Ladasky  
View profile  
 More options Jul 26 2012, 4:48 pm
Newsgroups: comp.lang.python
From: John Ladasky <john_lada...@sbcglobal.net>
Date: Thu, 26 Jul 2012 13:48:07 -0700 (PDT)
Local: Thurs, Jul 26 2012 4:48 pm
Subject: Re: from future import pass_function

On Wednesday, July 25, 2012 1:40:45 AM UTC-7, Ulrich Eckhardt wrote:
> Hi!

> I just had an idea, it occurred to me that the pass statement is pretty
> similar to the print statement, and similarly to the print() function,
> there could be a pass() function that does and returns nothing.

I had very similar thoughts about eight months ago, and posted them here:

https://groups.google.com/forum/?fromgroups#!topic/comp.lang.python/C...

I'm no computer science guru, but the idea that pass should be a function rather than a statement continues to appeal to me.  As you can see, I actually wrote just such a function so that I could use it as an argument in my code.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Ladasky  
View profile  
 More options Jul 26 2012, 4:55 pm
Newsgroups: comp.lang.python
From: John Ladasky <john_lada...@sbcglobal.net>
Date: Thu, 26 Jul 2012 13:55:39 -0700 (PDT)
Local: Thurs, Jul 26 2012 4:55 pm
Subject: Re: from future import pass_function

On Wednesday, July 25, 2012 9:32:33 PM UTC-7, Ethan Furman wrote:
> What code does `pass` run?  When do we pass parameters to `pass`?   When
> do we need to override `pass`?

> Answers:  None.  Never.  Still waiting for a reply from the OP for a use
> case.

When I brought up this same issue some months ago...

https://groups.google.com/forum/?fromgroups#!topic/comp.lang.python/C...

...it wasn't because I wanted to pass parameters to "pass", it was because I wanted to define a do-nothing function as an optional behavior within another function.  In other words, I wanted to pass "pass."


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Hrivnak  
View profile  
 More options Jul 26 2012, 5:15 pm
Newsgroups: comp.lang.python
From: Michael Hrivnak <mhriv...@hrivnak.org>
Date: Thu, 26 Jul 2012 17:15:51 -0400
Local: Thurs, Jul 26 2012 5:15 pm
Subject: Re: from future import pass_function
It's not uncommon for "pass" to be referred to as a control statement,
although I see your point that it isn't exerting as much control over
the flow of execution as others.  As further evidence, this doc
categorizes it as a "statement" within "flow control tools":
http://docs.python.org/tutorial/controlflow.html

Michael

On Thu, Jul 26, 2012 at 2:42 AM, Ulrich Eckhardt


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ian Kelly  
View profile  
 More options Jul 26 2012, 5:18 pm
Newsgroups: comp.lang.python
From: Ian Kelly <ian.g.ke...@gmail.com>
Date: Thu, 26 Jul 2012 15:18:28 -0600
Local: Thurs, Jul 26 2012 5:18 pm
Subject: Re: from future import pass_function
On Thu, Jul 26, 2012 at 2:48 PM, John Ladasky

<john_lada...@sbcglobal.net> wrote:
> On Wednesday, July 25, 2012 1:40:45 AM UTC-7, Ulrich Eckhardt wrote:
>> Hi!

>> I just had an idea, it occurred to me that the pass statement is pretty
>> similar to the print statement, and similarly to the print() function,
>> there could be a pass() function that does and returns nothing.

> I had very similar thoughts about eight months ago, and posted them here:

> https://groups.google.com/forum/?fromgroups#!topic/comp.lang.python/C...

> I'm no computer science guru, but the idea that pass should be a function rather than a statement continues to appeal to me.  As you can see, I actually wrote just such a function so that I could use it as an argument in my code.

As long as 1) the name can't be reassigned (like None) and 2) the
compiler is able to optimize it out when used by itself as a statement
(to avoid incurring the expense of a common but pointless name
lookup), then I kind of agree.  The added complexity of those two
restrictions detracts a bit from the appeal to elegance, though.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Hrivnak  
View profile  
 More options Jul 26 2012, 5:20 pm
Newsgroups: comp.lang.python
From: Michael Hrivnak <mhriv...@hrivnak.org>
Date: Thu, 26 Jul 2012 17:20:32 -0400
Local: Thurs, Jul 26 2012 5:20 pm
Subject: Re: from future import pass_function
In case the rest of the email didn't make it obvious, everything you
quoted me on was sarcasm.  I know those things can't be done, and I
explained why they can't and shouldn't be done.

Michael

On Thu, Jul 26, 2012 at 5:16 AM, Devin Jeanpierre


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ethan Furman  
View profile  
 More options Jul 26 2012, 5:23 pm
Newsgroups: comp.lang.python
From: Ethan Furman <et...@stoneleaf.us>
Date: Thu, 26 Jul 2012 14:23:02 -0700
Local: Thurs, Jul 26 2012 5:23 pm
Subject: Re: from future import pass_function

John Ladasky wrote:
> On Wednesday, July 25, 2012 9:32:33 PM UTC-7, Ethan Furman wrote:

>> What code does `pass` run?  When do we pass parameters to `pass`?   When
>> do we need to override `pass`?

>> Answers:  None.  Never.  Still waiting for a reply from the OP for a use
>> case.

> When I brought up this same issue some months ago...

> https://groups.google.com/forum/?fromgroups#!topic/comp.lang.python/C...

> ...it wasn't because I wanted to pass parameters to "pass", it was because I wanted to define a do-nothing function as an optional behavior within another function.  In other words, I wanted to pass "pass."

That's a reasonable thing to want, and quite easily accomplished by
passing `lambda: None`  or `lambda *args, **kwargs: None` instead.  I
don't think this is difficult to do, nor common enough to justify making
every other `pass` a time-consuming do-nothing operation, instead of
just a do-nothing operation

~Ethan~


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Ladasky  
View profile  
 More options Jul 26 2012, 4:55 pm
Newsgroups: comp.lang.python
From: John Ladasky <john_lada...@sbcglobal.net>
Date: Thu, 26 Jul 2012 13:55:39 -0700 (PDT)
Local: Thurs, Jul 26 2012 4:55 pm
Subject: Re: from future import pass_function

On Wednesday, July 25, 2012 9:32:33 PM UTC-7, Ethan Furman wrote:
> What code does `pass` run?  When do we pass parameters to `pass`?   When
> do we need to override `pass`?

> Answers:  None.  Never.  Still waiting for a reply from the OP for a use
> case.

When I brought up this same issue some months ago...

https://groups.google.com/forum/?fromgroups#!topic/comp.lang.python/C...

...it wasn't because I wanted to pass parameters to "pass", it was because I wanted to define a do-nothing function as an optional behavior within another function.  In other words, I wanted to pass "pass."


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Ladasky  
View profile  
 More options Jul 26 2012, 6:20 pm
Newsgroups: comp.lang.python
From: John Ladasky <john_lada...@sbcglobal.net>
Date: Thu, 26 Jul 2012 15:20:03 -0700 (PDT)
Local: Thurs, Jul 26 2012 6:20 pm
Subject: Re: from future import pass_function

On Thursday, July 26, 2012 2:23:02 PM UTC-7, Ethan Furman wrote:
> That&#39;s a reasonable thing to want, and quite easily accomplished by
> passing `lambda: None`  or `lambda *args, **kwargs: None` instead.

That's the same solution that Steven D'Aprano proposed the last time we had this discussion.  Which, I agree, is reasonable (although I continue to have a certain instinctive aversion to lambda).

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Ladasky  
View profile  
 More options Jul 26 2012, 6:20 pm
Newsgroups: comp.lang.python
From: John Ladasky <john_lada...@sbcglobal.net>
Date: Thu, 26 Jul 2012 15:20:03 -0700 (PDT)
Local: Thurs, Jul 26 2012 6:20 pm
Subject: Re: from future import pass_function

On Thursday, July 26, 2012 2:23:02 PM UTC-7, Ethan Furman wrote:
> That&#39;s a reasonable thing to want, and quite easily accomplished by
> passing `lambda: None`  or `lambda *args, **kwargs: None` instead.

That's the same solution that Steven D'Aprano proposed the last time we had this discussion.  Which, I agree, is reasonable (although I continue to have a certain instinctive aversion to lambda).

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ethan Furman  
View profile  
 More options Jul 26 2012, 6:35 pm
Newsgroups: comp.lang.python
From: Ethan Furman <et...@stoneleaf.us>
Date: Thu, 26 Jul 2012 15:35:51 -0700
Local: Thurs, Jul 26 2012 6:35 pm
Subject: Re: from future import pass_function

John Ladasky wrote:
> I had very similar thoughts about eight months ago, and posted them here:

> https://groups.google.com/forum/?fromgroups#!topic/comp.lang.python/C...

> I'm no computer science guru, but the idea that pass should be a function rather than a statement continues to appeal to me.  As you can see, I actually wrote just such a function so that I could use it as an argument in my code.

I would have called `no_op` or `nop` -- `pass` does just what it says:
it passes and does zero work.  Your _pass does do work, just useless
work.  Sometimes that's necessary, but I wouldn't call it `_pass`.

~Ethan~


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Lawrence  
View profile  
 More options Jul 26 2012, 7:25 pm
Newsgroups: comp.lang.python
From: Mark Lawrence <breamore...@yahoo.co.uk>
Date: Fri, 27 Jul 2012 00:25:01 +0100
Local: Thurs, Jul 26 2012 7:25 pm
Subject: Re: from future import pass_function
On 26/07/2012 18:33, Chris Angelico wrote:

> On Fri, Jul 27, 2012 at 3:19 AM, Prasad, Ramit
> <ramit.pra...@jpmorgan.com> wrote:
>>> No offence to all the well meaning participants here, but this looks like trolling

>> I thought Ranting Rick had sole dominion over trolling?

> Certainly not. We are well endowed with trolls here (Xah Lee isn't
> prolific, but is certainly effective), plus we have some regular
> posters who'll cover the trolls' tea breaks on occasion (myself,
> sometimes, and Steven D'Aprano).

> Now where did I put my asbestos suit... the Aprano is going to be at
> me pretty hard for this...

Are you nuts, asbestos?  My tin hat, camouflage net and trenching tool
are very much safer :)

> *dives for cover without it*

> ChrisA

--
Cheers.

Mark Lawrence.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Lawrence  
View profile  
 More options Jul 26 2012, 7:23 pm
Newsgroups: comp.lang.python
From: Mark Lawrence <breamore...@yahoo.co.uk>
Date: Fri, 27 Jul 2012 00:23:04 +0100
Local: Thurs, Jul 26 2012 7:23 pm
Subject: Re: from future import pass_function
On 26/07/2012 18:19, Prasad, Ramit wrote:

>> No offence to all the well meaning participants here, but this looks like trolling

> I thought Ranting Rick had sole dominion over trolling?

Incorrect.  Yes he can be a PITA but when he writes about tkinter/idle
he appears to know what he's talking about.  I much prefer that to The
World's Leading Expert On Writing Documentation aka Xah Lee who must
spend his entire life sittng down as his voice is so muffled.

> Ramit

> This email is confidential and subject to important disclaimers and
> conditions including on offers for the purchase or sale of
> securities, accuracy and completeness of information, viruses,
> confidentiality, legal privilege, and legal entity disclaimers,
> available at http://www.jpmorgan.com/pages/disclosures/email.

--
Cheers.

Mark Lawrence.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Terry Reedy  
View profile  
 More options Jul 27 2012, 12:21 am
Newsgroups: comp.lang.python
From: Terry Reedy <tjre...@udel.edu>
Date: Fri, 27 Jul 2012 00:21:56 -0400
Local: Fri, Jul 27 2012 12:21 am
Subject: Re: from future import pass_function
On 7/26/2012 4:48 PM, John Ladasky wrote:

> I had very similar thoughts about eight months ago, and posted them
> here:

> https://groups.google.com/forum/?fromgroups#!topic/comp.lang.python/C...

>  I'm no computer science guru, but the idea that pass should be a
> function rather than a statement continues to appeal to me.

A do nothing statement is standard in statement based languages. It is
not going away.

> can see, I actually wrote just such a function so that I could use it
> as an argument in my code.

For one time use: lambda:None

For multiple use: def none: pass  # same as return None in this context

A function needs a lot more meat than that to be added as a builtin.

---
Terry Jan Reedy


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 26 - 50 of 51 < Older  Newer >
« Back to Discussions « Newer topic     Older topic »