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
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Ethan Furman  
View profile  
 More options Feb 4 2012, 3:53 pm
From: Ethan Furman <et...@stoneleaf.us>
Date: Sat, 04 Feb 2012 12:53:57 -0800
Local: Sat, Feb 4 2012 3:53 pm
Subject: Re: [cython-users] newbie question on function assignment

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']()

>> but this won't compile, because cython tries to convert f1 and f2 in
>> the dictionary to python objects and fails.  Is there a work around
>> for this?

> 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?

~Ethan~


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.