Miki Tebeka wrote:
>> Is there a simpler way to modify all arguments in a function before using
>> the arguments?
> You can use a decorator:
>
> from functools import wraps
>
> def fix_args(fn):
> @wraps(fn)
> def wrapper(*args):
> args = (arg.replace('_', '') for arg in args)
>
Jeff Jeffries wrote:
> Smart people, Is there a way I can add a dictionaries keys to the python
> namespace? It would just be temporary as I am working with a large
> dictionary, and it would speed up work using an IDE. I look and find
> nothing... none of the keys have spaces and none are common
On Sat, Nov 10, 2012 at 3:05 PM, Paul Rubin wrote:
> Chris Angelico writes:
>> Contrived example:
>> def send_email(from, to, subj, body, whatever, other, headers, you, like):
>
> That should be a dictionary with the header names as indexes. In fact
> there are already some email handling module
Le vendredi 9 novembre 2012 18:17:54 UTC+1, danielk a écrit :
> I'm converting an application to Python 3. The app works fine on Python 2.
>
>
>
> Simply put, this simple one-liner:
>
>
>
> print(chr(254))
>
>
>
> errors out with:
>
>
>
> Traceback (most recent call last):
>
> File "
Hello
Lately I have been writing a lot of list join() operations variously including
(and included in) string format() operations.
For example:
temps = [24.369, 24.550, 26.807, 27.531, 28.752]
out = 'Temperatures: {0} Celsius'.format(
', '.join('{0:.1f}'.format(t) for t in temp
On 11/09/2012 11:30 PM, Aahz wrote:
> In article ,
> MRAB wrote:
>>
>>
>> But should they be added together to make mono?
>>
>> Suppose, for example, that both channels have a maximum value. Their
>> sum would be _twice_ the maximum.
>>
>> Therefore, I think that it should probably be the averag
On Friday, November 9, 2012 8:16:12 PM UTC-5, Steven D'Aprano wrote:
> On Fri, 09 Nov 2012 20:05:26 -0500, Roy Smith wrote:
>
>
>
> > In article <18134e77-9b02-4aec-afb0-794ed900d...@googlegroups.com>,
>
> > bruceg113...@gmail.com wrote:
>
> >
>
> >> Is there a simpler way to modify all arg
On Nov 9, 10:41 pm, Peng Yu wrote:
> I have to explicitly specify the modules I want to ignore. Is there a
> way to ignore all the modules by default?
Is this your problem?
http://bugs.python.org/issue10685
--
http://mail.python.org/mailman/listinfo/python-list
In article ,
Peter Otten <__pete...@web.de> wrote:
>Miki Tebeka wrote:
>
>>> Is there a simpler way to modify all arguments in a function before using
>>> the arguments?
>>
>> You can use a decorator:
>>
>> from functools import wraps
>>
>> def fix_args(fn):
>> @wraps(fn)
>> def wrapper(
In article ,
Ian Kelly wrote:
>On Tue, Sep 11, 2012 at 12:45 PM, wrote:
>>
>> Python noob here. Trying to understand a particular syntax:
>>
>> class stuff:
>> def __init__(self):
>> self._bongo = "BongoWorld"
>>
>> What is the significance of the leading underscore in "self._bong
On 9 November 2012 11:08, Helmut Jarausch wrote:
> On Fri, 09 Nov 2012 10:37:11 +0100, Stefan Behnel wrote:
>
>> Helmut Jarausch, 09.11.2012 10:18:
>>> probably I'm missing something.
>>>
>>> Using str(Arg) works just fine if Arg is a list.
>>> But
>>> str([],encoding='latin-1')
>>>
>>> gives
Tobia Conforto writes:
> Now, as much as I appreciate the heritage of Lisp, I won't deny than
> its format string mini-language is EVIL. ... Still, this is the
> grand^n-father of Python's format strings...
Without having yet read the rest of your post carefully, I wonder the
particular historica
On Sat, 10 Nov 2012 02:26:28 -0800, Tobia Conforto wrote:
> Hello
>
> Lately I have been writing a lot of list join() operations variously
> including (and included in) string format() operations.
>
> For example:
>
> temps = [24.369, 24.550, 26.807, 27.531, 28.752]
>
> out = 'Temperatures
On Sat, Nov 10, 2012 at 5:51 PM, Paul Rubin wrote:
> […] Python's format strings are pretty much the same as C's format strings […]
You’re thinking about the old % syntax, 'Hello %s!' % 'world'. The OP
meant the new str.format syntax ('Hello {}!'.format('world')).
---
IMO, the idea is useless.
Hi,
I have Windows XP and Python 2.7.x
I download and install libxml2-python-2.7.7.win32-py2.7.exe, From
here: http://users.skynet.be/sbi/libxml-python/
This file has both libxml2 AND libxslt.
But, I also need libxml2-devel and libxslt-devel for python 2.7. Are
binaries for win32 available for
All,
I never used decorators before. I saw Miki Tebeka's sample code and your
rationale (Aahz) and I like it. For my application problem, decorators seem
like a good solution.
Thanks to all,
Bruce
On Saturday, November 10, 2012 10:35:12 AM UTC-5, Aahz wrote:
> In article ,
>
> Peter Otten
On Sun, Nov 11, 2012 at 12:15 AM, wrote:
> Thanks to all.
> Steve's example is the one I will try next week.
> Passing in lists, will work but it requires extra coding from the calling
> routines to build the list.
Not necessarily! Watch:
def foo(*args):
print(repr(args))
foo("Hello","wor
What is the best solution to solve the following problem in Python 3.3?
import math
>>> class Point:
... def __init__(self, x=0, y=0):
... self.x = x
... self.y = y
... def __sub__(self, other):
... return Point(self.x - other.x, self.y - other.y)
... def dista
On Sun, Nov 11, 2012 at 6:33 AM, Jennie wrote:
> ... def distance(self, point=None):
> ... p = point if point else Point()
I'd go with this one. Definitely not the third one, which mutates the
class according to a current global every time a Point is instantiated
- could be *extremely
On 11/10/2012 2:33 PM, Jennie wrote:
What is the best solution to solve the following problem in Python 3.3?
import math
>>> class Point:
... def __init__(self, x=0, y=0):
... self.x = x
... self.y = y
... def __sub__(self, other):
... return Point(self.x - other
On 11/10/2012 09:29 PM, Terry Reedy wrote:
On 11/10/2012 2:33 PM, Jennie wrote:
I propose three solutions. The first one:
>>> class Point:
... def __init__(self, x=0, y=0):
... self.x = x
... self.y = y
... def __sub__(self, other):
... return Point(self.x - o
Kwpolska wrote:
> > out = 'Temperatures: {0:", ":.1f} Celsius'.format(temps)
>
> [...] your format is cryptic.
Thank you for your criticism, I'll think it over. The reason I find it readable
(-enough) is because even without knowing what format language is supported by
the temps object, you can
Jonathan Hayward pobox.com> writes:
>
> What needs changing here and how should I change it so that handle_signal()
> is called and then things keep on ticking?
So that it is called when exactly? Your message isn't clear as to what isn't
working for you.
Regards
Antoine.
--
http://mail.pyt
On 11/10/2012 03:51 PM, Jennie wrote:
> On 11/10/2012 09:29 PM, Terry Reedy wrote:
>
>> On 11/10/2012 2:33 PM, Jennie wrote:
>>>
>>> I propose three solutions. The first one:
>>>
>>> >>> class Point:
>>> ... def __init__(self, x=0, y=0):
>>> ... self.x = x
>>> ... self.y = y
>>
I'm trying to pull down tweets with one of the many twitter APIs. The
particular one I'm using (python-twitter), has a call:
data = api.GetSearch(term="foo", page=page)
The way it works, you start with page=1. It returns a list of tweets.
If the list is empty, there are no more tweets. If t
On Sat, Nov 10, 2012 at 3:58 PM, Roy Smith wrote:
> I'm trying to pull down tweets with one of the many twitter APIs. The
> particular one I'm using (python-twitter), has a call:
>
> data = api.GetSearch(term="foo", page=page)
>
> The way it works, you start with page=1. It returns a list of twe
On Sat, 10 Nov 2012 17:58:14 -0500, Roy Smith wrote:
> The way it works, you start with page=1. It returns a list of tweets.
> If the list is empty, there are no more tweets. If the list is not
> empty, you can try to get more tweets by asking for page=2, page=3, etc.
> I've got:
>
> page =
On Sat, 10 Nov 2012 20:33:05 +0100, Jennie wrote:
[...]
> I propose three solutions. The first one:
>
> >>> class Point:
> ... def __init__(self, x=0, y=0):
> ... self.x = x
> ... self.y = y
> ... def __sub__(self, other):
> ... return Point(self.x - other.x, self
On 10 November 2012 19:33, Jennie wrote:
> What is the best solution to solve the following problem in Python 3.3?
>
> import math
class Point:
> ... def __init__(self, x=0, y=0):
> ... self.x = x
> ... self.y = y
> ... def __sub__(self, other):
> ... return Po
On Sun, Nov 11, 2012 at 12:13 PM, Steven D'Aprano
wrote:
> Almost but not quite. I assume that, in a full Point class, you would
> want Point(0, 0) to count as false in a boolean context. (A "falsey"
> value, like None, [], 0.0, etc.)
I would not assume that. The origin is a point, just like any
On Sat, Nov 10, 2012 at 7:13 PM, Chris Angelico wrote:
> I would not assume that. The origin is a point, just like any other.
> With a Line class, you could deem a zero-length line to be like a
> zero-element list, but Point(0,0) is more like the tuple (0,0) which
> is definitely True.
It's more
On Sun, Nov 11, 2012 at 1:43 PM, Ian Kelly wrote:
> On Sat, Nov 10, 2012 at 7:13 PM, Chris Angelico wrote:
>> I would not assume that. The origin is a point, just like any other.
>> With a Line class, you could deem a zero-length line to be like a
>> zero-element list, but Point(0,0) is more like
In article ,
Ian Kelly wrote:
> On Sat, Nov 10, 2012 at 7:13 PM, Chris Angelico wrote:
> > I would not assume that. The origin is a point, just like any other.
> > With a Line class, you could deem a zero-length line to be like a
> > zero-element list, but Point(0,0) is more like the tuple (0,0
On Nov 10, 2:58 pm, Roy Smith wrote:
> I'm trying to pull down tweets with one of the many twitter APIs. The
> particular one I'm using (python-twitter), has a call:
>
> data = api.GetSearch(term="foo", page=page)
>
> The way it works, you start with page=1. It returns a list of tweets.
> If the
On Sat, Nov 10, 2012 at 7:53 PM, Roy Smith wrote:
> In article ,
> Ian Kelly wrote:
>
>> On Sat, Nov 10, 2012 at 7:13 PM, Chris Angelico wrote:
>> > I would not assume that. The origin is a point, just like any other.
>> > With a Line class, you could deem a zero-length line to be like a
>> > z
On Sat, Nov 10, 2012 at 11:43 PM, Ian Kelly wrote:
> Where I wrote "(0,0) is the origin" above I was not referring to a
> point, not a tuple, but I can see how that was confusing.
What I meant to say is I *was* referring to a point. Gah!
--
http://mail.python.org/mailman/listinfo/python-list
goldtech, 10.11.2012 18:12:
> I have Windows XP and Python 2.7.x
>
> I download and install libxml2-python-2.7.7.win32-py2.7.exe, From
> here: http://users.skynet.be/sbi/libxml-python/
>
> This file has both libxml2 AND libxslt.
>
> But, I also need libxml2-devel and libxslt-devel for python 2.7
37 matches
Mail list logo