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
Message from discussion newbie question on function assignment

Received: by 10.42.19.73 with SMTP id a9mr10877303icb.0.1328570815281;
        Mon, 06 Feb 2012 15:26:55 -0800 (PST)
X-BeenThere: cython-users@googlegroups.com
Received: by 10.50.207.65 with SMTP id lu1ls8674515igc.0.canary; Mon, 06 Feb
 2012 15:26:53 -0800 (PST)
Received: by 10.50.195.196 with SMTP id ig4mr10394289igc.4.1328570813865;
        Mon, 06 Feb 2012 15:26:53 -0800 (PST)
Received: by 10.50.195.196 with SMTP id ig4mr10394287igc.4.1328570813854;
        Mon, 06 Feb 2012 15:26:53 -0800 (PST)
Return-Path: <et...@stoneleaf.us>
Received: from gateway12.websitewelcome.com ([69.93.154.13])
        by gmr-mx.google.com with ESMTP id wm6si1463797igc.3.2012.02.06.15.26.53;
        Mon, 06 Feb 2012 15:26:53 -0800 (PST)
Received-SPF: pass (google.com: domain of et...@stoneleaf.us designates 69.93.154.13 as permitted sender) client-ip=69.93.154.13;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of et...@stoneleaf.us designates 69.93.154.13 as permitted sender) smtp.mail=et...@stoneleaf.us
Received: by gateway12.websitewelcome.com (Postfix, from userid 5007)
	id 5A762B47ECDA1; Mon,  6 Feb 2012 17:26:52 -0600 (CST)
Received: from gator410.hostgator.com (gator410.hostgator.com [184.172.173.45])
	by gateway12.websitewelcome.com (Postfix) with ESMTP id 4C93EB47ECD67
	for <cython-users@googlegroups.com>; Mon,  6 Feb 2012 17:26:52 -0600 (CST)
Received: from [72.11.125.166] (port=1330 helo=[192.168.10.136])
	by gator410.hostgator.com with esmtpa (Exim 4.69)
	(envelope-from <et...@stoneleaf.us>)
	id 1RuXxT-0006RZ-Tu
	for cython-users@googlegroups.com; Mon, 06 Feb 2012 17:26:52 -0600
Message-ID: <4F306338.3010309@stoneleaf.us>
Date: Mon, 06 Feb 2012 15:33:12 -0800
From: Ethan Furman <et...@stoneleaf.us>
User-Agent: Thunderbird 1.5.0.10 (Windows/20070221)
MIME-Version: 1.0
To: cython-users@googlegroups.com
Subject: Re: [cython-users] newbie question on function assignment
References: <062fea19-e760-4aca-84f4-e2db1e33472d@m2g2000vbc.googlegroups.com>	<CADiQ+QCnr906WPvxt90LSVdhwgP3xAN2tyUm8VNW2ER95r+89w@mail.gmail.com>	<4F2D9AE5.8060...@stoneleaf.us> <CANg26EU5j-ShiuwjWgS1BQqecf64cYcXp2PHJnmu-sG-Rv=...@mail.gmail.com>
In-Reply-To: <CANg26EU5j-ShiuwjWgS1BQqecf64cYcXp2PHJnmu-sG-Rv=...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - gator410.hostgator.com
X-AntiAbuse: Original Domain - googlegroups.com
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - stoneleaf.us
X-BWhitelist: no
X-Source: 
X-Source-Args: 
X-Source-Dir: 
X-Source-Sender: mail.admailinc.com ([192.168.10.136]) [72.11.125.166]:1330
X-Source-Auth: ethan+stoneleaf.us
X-Email-Count: 1
X-Source-Cap: dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ==

mark florisson wrote:
> On 4 February 2012 20:53, Ethan Furman wrote:
>> Robert Bradshaw wrote:
>>> On Tue, Jan 31, 2012 at 1:12 PM, paomo wrote:
>>>> cdef f1():
>>>>  ...
>>>> cdef f2():
>>>>  ...
>>>> my_functions = {'case_1' : f1,
>>>>                'case_2' : f2}   # this won't compile
>>>> my_functions['case_1']()
>>>
>>> Either use standard python "def" functions rather than cdef functions,
>>> or index into an array of function pointers with enums.
>>
>> Apologies for my ignorance, but could you show an example of an array of
>> funtion pointers and their use with enums?
> 
> If you don't know what it means, you probably don't want it :) Is
> there any reason you're not using def functions?

At this point I am still gathering knowledge.  I hope to write a Cython 
version of my dbf module at some point.

~Ethan~