Re: Is '*args' useful in this example code?

2016-01-04 Thread Arif Khokar

On 01/04/2016 09:16 PM, Robert wrote:

Hi,

I find an example code on wrap at this link:
http://stackoverflow.com/questions/308999/what-does-functools-wraps-do

Here is the code:

def logged(func):
 def with_logging(*args, **kwargs):
 print func.__name__ + " was called"
 return func(*args, **kwargs)
 return with_logging
///

I understand now, but I feel the args usage is weird. I don't see any way
to use *args and **kwargs in above code. What is your opinion on it?


The reason the inner method has *args, and **kwargs as parameters is so 
that it doesn't have to exactly match the signature of func.  If func 
was a method that took 3 parameters, then if you didn't use *args, you 
would have to define the with_logging method to also take 3 parameters. 
 If func takes one or more keyword parameters, then you would have to 
add that to the definition of the with_logging method if you don't use 
**kwargs.


IOW, using *args and **kwargs in the wrapper method definition removes 
the requirement that its parameter list exactly match func's parameter list.

--
https://mail.python.org/mailman/listinfo/python-list


Re: Managing Google Groups headaches

2013-11-28 Thread Arif Khokar

On 11/28/2013 1:50 PM, Michael Torrie wrote:

On 11/28/2013 11:37 AM, rusi wrote:



2. All kinds of people hop onto the list. In addition to genuine ones there are
spammers, trolls, dicks, nuts, philosophers, help-vampires etc etc.


What they have in common is usenet.  Ditching usenet would solve both
problems.


The problem could also be solved through client side filtering (i. e., 
killfiles).  I usually killfile posters who crosspost to unrelated 
groups (which filters 99% of the spam that comes through).  I'm sure 
that the usenet/email gateway could be configured to filter such posts 
on the server side so those who read this list via email won't have 
those problems.


The problem with just using email is that it's a bit more difficult to 
browse archived posts to this group.  After I subscribed to this group 
(comp.lang.python) using my news client, I could immediately browse 
posts made as far back as April.

--
https://mail.python.org/mailman/listinfo/python-list