Roy Smith wrote:
> I've got a code pattern I use a lot. In each module, I create a logger
> for the entire module and log to it all over:
>
> logger = logging.getLogger('my.module.name')
>
> class Foo:
>def function(self):
> logger.debug('stuff')
> logger.debug('other stuff')
>
Throwing an idea for a PEP out there:
It strikes me that the def func(*args, **kwargs) syntax is rather
unpytonic. It certainly did not have that 'for line in file' pythonic
obviousness for me as a beginner. Plus, asterikses are impossible to
google for, so finding out what exactly they do mor
On Sun, Dec 11, 2011 at 9:49 PM, Eelco Hoogendoorn
wrote:
> Problems im still wrestling with: the same syntax could not be used when
> calling a function; that lack of symmetry would make things more confusing,
> not less.
That symmetry is a large factor, IMHO. I can write a wrapper function like
I got it working by creating a symbolic link to the Python interpreter to
be used in my application package and using this symbolic link to start
the main Python script.
Gregory Ewing wrote:
> Detlev Offenbach wrote:
>> I am fairly new to Mac OS X and would like to know, what I have to do
>> t
Chris Angelico wrote:
> Either way, it's a perfect parallel, and that's very useful for
> noticing errors.
>
> With a keyworded syntax, that's going to be a lot harder.
If it used keywords then you could keep symmetry quite easily:
def anyargs(arglist args, argdict kwargs):
return
On Sun, Dec 11, 2011 at 11:39 PM, Duncan Booth
wrote:
> Chris Angelico wrote:
> If it used keywords then you could keep symmetry quite easily:
>
> def anyargs(arglist args, argdict kwargs):
> return wrappedfunc(arglist args, argdict kwargs)
>
> and you would have the advantage of two ne
Am 11.12.2011 13:39, schrieb Duncan Booth:
>> Another issue: You suggest being able to use "attrdict" or some other
>> dict subclass. This means that, rather than being a language
>> construct, this will involve a name lookup. And what happens if you
>> have a class that subclasses both list and di
Yes, that's just a strict keywordification of the * and ** symbols.
The same argument could be made for eliminating the standard algebraic
+ operator and replacing it with a keyword "__add__". I don't think
that's worthwhile.
Well, its not quite the same in the sense that algebraic operator
As for syntax; what about coopting/integrating with the function
annotation syntax?
so:
def func(args: list, kwargs: attrdict)
and correspondingly in the function call?
a, b:tuple = someiterable?
I guess a rule that interprets every function argument annotated as a
subclass of list or dict a
I have recently upgraded my Snow Leopard to Lion and now I am having all
problems with python on my system e.g.:
I have install PIL with easy_install but when I do
import PIL
Python cannot find the pil library. Installing psycopg2 in the same way was
successful and I can use psycopg2 without a p
Have a look at Markdown + pandoc.
Regards
Johann
--
Because experiencing your loyal love is better than life itself,
my lips will praise you. (Psalm 63:3)
--
http://mail.python.org/mailman/listinfo/python-list
In article
,
Johann Spies wrote:
> I have recently upgraded my Snow Leopard to Lion and now I am having all
> problems with python on my system e.g.:
>
> I have install PIL with easy_install but when I do
>
> import PIL
>
> Python cannot find the pil library. Installing psycopg2 in the same w
Hi,
I'd like to have a custom test loder, which will filter out certain
tests or which just searches tests in certain directories.
I'd like to use regular expresions as include / exclude rules
and I would like to have another filter function, which would check for
the existence of certain metavar
On Sun, 11 Dec 2011 11:49:23 +0100, Eelco Hoogendoorn wrote:
> Throwing an idea for a PEP out there:
>
> It strikes me that the def func(*args, **kwargs) syntax is rather
> unpytonic. It certainly did not have that 'for line in file' pythonic
> obviousness for me as a beginner. Plus, asterikses a
I'm trying to use the python evolution (as in Gnome Evolution) module
but I can't find any documetation beyond the odd trivial example and
the API documentation at http://doc.conduit-project.org/evolution-python/
(or similar places presumably).
The trouble with the API documentation is that it te
On 12/11/2011 5:49 AM, Eelco Hoogendoorn wrote:
Plus, asterikses are impossible to google for, so finding out what exactly
> they do more or less forces you to write a forum post about it.
There are other means of finding information than Google. Really.
1. A couple of years ago, I wrote a ver
Gelonida N writes:
> I'd like to use regular expresions as include / exclude rules
> and I would like to have another filter function, which would check for
> the existence of certain metavariabels in test suite files
Did you have a look at nose? I'm using it and it supports
include/exclude rule
No more so than any other form of punctuation. Plus and minus + - may be
so common that just about everyone knows it, but how about | == @ % and
even . (dot)? None of these things will be obvious to newbies who have
never programmed before. Oh well.
Some things you just have to learn.
Y
There are other means of finding information than Google. Really.
This is really only a very minor point in my argument, so I dont want to
put the focus on this.
But really, no.
Googling 'myprogramminglanguage conceptimtryingtofigureout' is my first,
second and third line of defence. Yes,
I've just started using a Debian system, instead of the usual RedHat
based systems I'm used to, and module.__file__ appears to have
disappeared for some (but not all) modules.
On Fedora:
[steve@orac ~]$ python -E
Python 2.6.2 (r262:71600, Aug 21 2009, 12:22:21)
[GCC 4.4.1 20090818 (Red Hat 4.4
On Mon, Dec 12, 2011 at 10:53 AM, Eelco Hoogendoorn
wrote:
> Googling 'myprogramminglanguage conceptimtryingtofigureout' is my first,
> second and third line of defence. Yes, I could read the reference manual
> from top to bottom, and if I already knew about the existence of your
> article then im
On Mon, Dec 12, 2011 at 9:28 AM, wrote:
> I'm trying to use the python evolution (as in Gnome Evolution) module
> but I can't find any documetation beyond the odd trivial example and
> the API documentation at http://doc.conduit-project.org/evolution-python/
> (or similar places presumably).
One
On Mon, 12 Dec 2011 00:44:38 +0100, Eelco Hoogendoorn wrote:
>> No more so than any other form of punctuation. Plus and minus + - may
>> be so common that just about everyone knows it, but how about | == @ %
>> and even . (dot)? None of these things will be obvious to newbies who
>> have never
On 12/12/2011 00:21, Steven D'Aprano wrote:
I've just started using a Debian system, instead of the usual RedHat
based systems I'm used to, and module.__file__ appears to have
disappeared for some (but not all) modules.
On Fedora:
[steve@orac ~]$ python -E
Python 2.6.2 (r262:71600, Aug 21 2009,
Hi all,
I want to call python (matplotlib) from C++. I use ubuntu linux and
compile with "-lpython2.7". Besides that, I have this line included:
#include
I can then do something like this:
Py_Initialize();
PyRun_SimpleString("print ' '");
PyRun_SimpleString("print ' '");
PyRun_Simpl
On 12/12/2011 12:27 AM, Thomas Bach wrote:
> Gelonida N writes:
>
>> I'd like to use regular expresions as include / exclude rules
>> and I would like to have another filter function, which would check for
>> the existence of certain metavariabels in test suite files
>
> Did you have a look at n
I'm trying to output raw, realtime MIDI data (as in note on, note off,
etc) in Linux from Python, and I want the easiest way to do it. I've
been banging my head on the wall about this for quite some time. The
reason for this is to reinvent the old vkeybd application, but it's
just me screwing aro
On Dec 12, 12:14 pm, Nick Irvine wrote:
> What do people use to output live MIDI on Linux, assuming it's
> possible?
Hey Nick,
I've yet to try this myself although it's long been on my to-do list.
There are a couple of packages on PyPI that emit MIDI:
http://pypi.python.org/pypi?%3Aaction=searc
On Dec 11, 4:42 pm, Nobody wrote:
> If just you're trying to avoid getting a repetitive strain injury in your
> right-hand little finger from typing all the [''], you could turn
> the keys into object attributes, e.g.:
>
> class DictObject:
> def __init__(self, d):
>
Hi guys
Are there any db agnostic admin for Flask/Django?
Imagine you need CRUD lots of data from Mongodb, Redis, ini file or
even remote sources, if such admin allows aggregate data regardless of
DB types or syntax, it would be super useful.
Anything like this exists? or should I start build on
On Dec 9, 8:08 pm, Robert Kern wrote:
> On 12/9/11 5:02 AM, alex23 wrote:
> > The 3rd party 'decorator' module takes care of issues like docstrings
> > & function signatures. I'd really like to see some of that
> > functionality in the stdlib though.
>
> Much of it is:
>
> http://docs.python.o
Hello All,
How do I get the __set__ to work here?
import random
class Die(object):
def __init__(self, sides=6):
self.sides = sides
def __get__(self, instance, owner):
return int(random.random() * self.sides) + 1
def __set__(self, instance, value):
instance._
Wondering if anyone could shed some light on the subprocess module? I'll admit
I'm not that great at the shell.
If I was wanting to get the size of the trash (on OS X), I could use:
>>> os.system('du -sh ~/.Trash/')
11M/Users/jay/.Trash/
0
Which gives me what I want. However, I've been r
alex23 wrote:
On Dec 11, 4:42 pm, Nobody wrote:
If just you're trying to avoid getting a repetitive strain injury in your
right-hand little finger from typing all the [''], you could turn
the keys into object attributes, e.g.:
class DictObject:
def __init__(self, d):
On Sun, Dec 11, 2011 at 9:32 PM, Emeka wrote:
>
> Hello All,
>
> How do I get the __set__ to work here?
>
> import random
>
> class Die(object):
> def __init__(self, sides=6):
> self.sides = sides
>
> def __get__(self, instance, owner):
> return int(random.random() * self.s
On Monday, December 12, 2011 11:36:07 AM UTC+8, alex23 wrote:
> On Dec 9, 8:08 pm, Robert Kern wrote:
> > On 12/9/11 5:02 AM, alex23 wrote:
> > > The 3rd party 'decorator' module takes care of issues like docstrings
> > > & function signatures. I'd really like to see some of that
> > > functional
On 12/11/2011 10:39 PM, jyoun...@kc.rr.com wrote:
> And another question - why can't I use the tilde as a shortcut to the home
> directory?
Because subprocess doesn't use the shell (which is what expands the
tilde to the invoking user's home directory). I recommend using
os.path.join and os.enviro
Andrea Crotti wrote:
> Not sure if it's exactly pure python but Traits can actually do
> thishttps://github.com/enthought/traits
At an attribute level, absolutely, but not at the variable level like
the OP is requesting.
It's a great package, though :)
--
http://mail.python.org/mailman/listinf
On Sun, Dec 11, 2011 at 8:39 PM, wrote:
> Wondering if anyone could shed some light on the subprocess module? I'll
> admit I'm not that great at the shell.
>
> If I was wanting to get the size of the trash (on OS X), I could use:
>
os.system('du -sh ~/.Trash/')
> 11M /Users/jay/.Trash/
On Dec 12, 2:51 pm, 8 Dihedral
wrote:
> To wrap a function properly is different from the 1-line lampda.
>
> This is really functional programming.
>
> Every function can be decorated to change into a different one easily.
>
> There is a method to replace every return action of a python func
Hi All,
I have a file p.zip, there is a __main__.py in it, and the content of
__main__.py is:
from multiprocessing import Process
import os
def f():
print 'in f, pid:', os.getpid()
if __name__ == '__main__':
print 'pid:', os.getpid()
p = Process(target=f)
p.start()
p.join()
On
Hi,
say I have two lists a and b, which are both in two dimensions. I
wanna to plot all curves by using pylab.plot(a[i],b[i]) in a loop for
the range of the length(a).
I got quite a lot of figures, but only the first one with the plot i
want. how to eliminate those blank figures poping out?
Rgds
42 matches
Mail list logo