How do I DRY the following code?
class C():
def f1(self, arg1, arg2=None, globals=None, locals=None):
... unique stuff #1 ...
... some common stuff #1 ...
ret = eval(args, globals, locals)
... more stuff #2 ...
return retval
def f2(self, arg1, arg2=None, *args,
On Dec 29, 7:00 pm, Steven D'Aprano wrote:
> On Mon, 29 Dec 2008 05:31:17 -0800, Aaron Brady wrote:
> > One style of coding I heard about once only permits returns at the end
> > of a function. It claims it makes it easier to see the function as a
> > mathematical object.
>
> That's silly. You tr
thmpsn> 1. Can anyone explain to me what kind of program structuring
thmpsn>technique (which paradigm, etc) CPython uses? How do modules
thmpsn>interact together? What conventions does it use?
it's quite object-oriented once you understand how things are done. Take a
look, f
En Mon, 29 Dec 2008 08:17:42 -0200, k3xji escribió:
On 29 Aralık, 11:52, "Gabriel Genellina"
wrote:
En Mon, 29 Dec 2008 05:56:10 -0200, k3xji escribió:
> I am trying to see on which situations does the Read-Write Lock
> performs better on primitive Lock() itself. Below is the code I am
> u
On Dec 29, 8:02 pm, Steven D'Aprano wrote:
> On Mon, 29 Dec 2008 17:38:36 -0800, Ross wrote:
> > On Dec 29, 8:07 pm, Scott David Daniels wrote:
> >> Ross wrote:
> >> > ... Use get to write histogram more concisely. You should be able to
> >> > eliminate the if statement.
>
> >> > def histogram(s)
On Tue, Dec 30, 2008 at 10:22 AM, wrote:
> I've just downloaded Python's mainstream implementation (CPython),
> which is written in C. Not to my surprise, I feel like I'm looking at
> unstructured spaghetti, and I'm having trouble figuring out how it all
> works together. (Please bear with me; I'
On Dec 29, 7:40 pm, "James Mills"
wrote:
> On Tue, Dec 30, 2008 at 11:34 AM, Aaron Brady wrote:
> > The OP may be interested in Erlang, which Wikipedia (end-all, be-all)
> > claims is a 'distribution oriented language'.
snip
> I'm presently looking at Virtual Synchrony and
> other distributed pro
On Tue, Dec 30, 2008 at 12:52 PM, Aaron Brady wrote:
> On Dec 29, 7:40 pm, "James Mills"
> wrote:
>> On Tue, Dec 30, 2008 at 11:34 AM, Aaron Brady wrote:
>> > The OP may be interested in Erlang, which Wikipedia (end-all, be-all)
>> > claims is a 'distribution oriented language'.
> snip
>> I'm pr
Hi,
While working on some python C extensions, I got curious in how things
work for printing float objects (and C-level objects which inherit
from it). In python 2.6, I understand that the formatting went into
surgery for more consistency across platforms. So for example, on
windows, complex('inf'
En Mon, 29 Dec 2008 19:47:51 -0200, Carl Banks
escribió:
On Dec 29, 10:51 am, Kottiyath wrote:
Module Factory:
A1Factory: {'B1Tag':1.1.B1, 'C1Tag':1.2.C1, 'D1Tag':1.3.D1'}
A2Factory: {'B2Tag':2.1.B2, 'C2Tag':2.2.C2, 'D2Tag':2.3.D2'}
But, since Module requires objects of B1, C1 etc, it has
On Tue, Dec 30, 2008 at 1:19 PM, David Cournapeau wrote:
(... snip ...)
> print '%f' % a # -> print '1.#INF'
Would this not be controlled by:
1. float(a) or a.__float__()
2. tp_print
cheers
James
--
http://mail.python.org/mailman/listinfo/python-list
Gabriel Genellina wrote:
> En Mon, 29 Dec 2008 19:47:51 -0200, Carl Banks
> escribi�:
> > On Dec 29, 10:51�am, Kottiyath wrote:
>
> >> Module Factory:
> >> A1Factory: {'B1Tag':1.1.B1, 'C1Tag':1.2.C1, 'D1Tag':1.3.D1'}
> >> A2Factory: {'B2Tag':2.1.B2, 'C2Tag':2.2.C2, 'D2Tag':2.3.D2'}
> >>
> >> But,
On Tue, Dec 30, 2008 at 12:23 PM, James Mills
wrote:
> On Tue, Dec 30, 2008 at 1:19 PM, David Cournapeau wrote:
> (... snip ...)
>
>> print '%f' % a # -> print '1.#INF'
>
> Would this not be controlled by:
> 1. float(a) or a.__float__()
> 2. tp_print
Bah, I made a mistake in my example: complex(
On Dec 30, 8:24 am, "Gabriel Genellina"
wrote:
> En Mon, 29 Dec 2008 19:47:51 -0200, Carl Banks
> escribió:
>
> > On Dec 29, 10:51 am, Kottiyath wrote:
> >> Module Factory:
> >> A1Factory: {'B1Tag':1.1.B1, 'C1Tag':1.2.C1, 'D1Tag':1.3.D1'}
> >> A2Factory: {'B2Tag':2.1.B2, 'C2Tag':2.2.C2, 'D2Tag
En Tue, 30 Dec 2008 00:32:45 -0200, escribió:
BTW, as a person who hasn't really written a stitch of C++ in about 10
years
I personally find the CPython implementation to be one of the most
well-organized large pieces of code I have ever encountered. It's much
easier to read (to me) than any
On Dec 29, 9:44 pm, Steven D'Aprano wrote:
> How do you lose backward compatibility by *adding* new functionality? The
> old functionality will continue to work as normal.
>
> --
> Steven
AFAIK it still works the old way, but it will be deprecated soon.
--
http://mail.python.org/mailman/listinfo/
On Dec 30, 11:53 am, David Lemper wrote:
> I am trying getch() from msvcrt.
Unfortunately the msvcrt docs have not been 2to3ified:
"""
msvcrt.getch()
Read a keypress and return the resulting character. Nothing is echoed
to the console. This call will block if a keypress is not already
available, b
On Mon, Dec 29, 2008 at 6:13 PM, R. Bernstein wrote:
> How do I DRY the following code?
>
> class C():
>
> def f1(self, arg1, arg2=None, globals=None, locals=None):
> ... unique stuff #1 ...
> ... some common stuff #1 ...
> ret = eval(args, globals, locals)
> ... more stuff #2
Thanks for all your replies, but the thing is I want to get the list of
functions in that file itself, not by importing it as a module. I've decided
to go with a class-based approach due to a number of other reasons, but I'm
still interested in a way to get function name in that file itself.
Thanks
Hi Friends,
My application is written in C/C++ and Python is embed to extend some
functions (several .py files are invoked). But I am confused how to
debug these embed Python? Can I use 'print-debuging'? and where can I
capture the output string?
Or Python can support 'break' debug for such scena
It seems as if the curses module in Python 3.0 isn't respecting the system's
preferred encoding (utf-8) which was set via:
locale.setlocale(locale.LC_ALL, '')
The purpose of this was described at the top of '
http://docs.python.org/dev/3.0/library/curses.html#module-curses'. The
getlocale function
Although this is not what you are asking but I'm wondering why you
need to read CPython implementation.
I have been using Python for 7 or 8 years but I've never encountered
any situations where I need to read CPython implementation.
I needed to read library implementations and installer codes, thou
101 - 122 of 122 matches
Mail list logo