Re: list/dictionary as case statement ?

2007-01-03 Thread Tom Plunket
Hendrik van Rooyen wrote: It works well - and it is surprisingly fast too... And its easy if the opcodes are all say one byte, else you need an opcode length field too, and fancier parsing. Often (always?) RISC architectures' instruction+operand lengths are fixed to the word size of the

Re: list/dictionary as case statement ?

2007-01-03 Thread Bjoern Schliessmann
Tom Plunket wrote: Often (always?) RISC architectures' instruction+operand lengths are fixed to the word size of the machine. E.g. the MIPS 3000 and 4000 were 32 bits for every instruction, and PC was always a ^^ multiple of four. Intels aren't

Re: list/dictionary as case statement ?

2007-01-03 Thread Tom Plunket
Bjoern Schliessmann wrote: Intels aren't RISC, are they? Not the ones in PCs. The OP didn't specify the CPU that's being used, however. -tom! -- -- http://mail.python.org/mailman/listinfo/python-list

Re: list/dictionary as case statement ?

2007-01-03 Thread MRAB
Bjoern Schliessmann wrote: Tom Plunket wrote: Often (always?) RISC architectures' instruction+operand lengths are fixed to the word size of the machine. E.g. the MIPS 3000 and 4000 were 32 bits for every instruction, and PC was always a ^^

Re: list/dictionary as case statement ?

2007-01-03 Thread Bjoern Schliessmann
MRAB wrote: I think that PC referred to the CPU's Program Counter. Argh, thanks. :) The x86 CPUs if typical Windows PCs aren't RISC but Intel also manufacture X-Scale (ARM core) processors which are. Okay, sorry for lack of precision. I was referring to x86. Regards, Björn -- BOFH

Re: list/dictionary as case statement ?

2007-01-03 Thread Stef Mientki
Tom Plunket wrote: Bjoern Schliessmann wrote: Intels aren't RISC, are they? Not the ones in PCs. The OP didn't specify the CPU that's being used, however. Well it was meant for a small micro-controller, the PIC-14-series, e.g. PIC16F877. I already build a simulator for this device in

list/dictionary as case statement ?

2007-01-02 Thread Stef Mientki
If I'm not mistaken, I read somewhere that you can use function-names/references in lists and/or dictionaries, but now I can't find it anymore. The idea is to build a simulator for some kind of micro controller (just as a general practise, I expect it too be very slow ;-). opcodes ={ 1:

Re: list/dictionary as case statement ?

2007-01-02 Thread Grant Edwards
On 2007-01-02, Stef Mientki [EMAIL PROTECTED] wrote: If I'm not mistaken, I read somewhere that you can use function-names/references in lists and/or dictionaries, but now I can't find it anymore. The idea is to build a simulator for some kind of micro controller (just as a general

Re: list/dictionary as case statement ?

2007-01-02 Thread Gary Herron
Stef Mientki wrote: If I'm not mistaken, I read somewhere that you can use function-names/references in lists and/or dictionaries, but now I can't find it anymore. The idea is to build a simulator for some kind of micro controller (just as a general practise, I expect it too be very slow

Re: list/dictionary as case statement ?

2007-01-02 Thread Stef Mientki
Yes. Functions are (so called) first class objects. You can refer to one by name, and pass that reference around in variables and other data structures. That said, your code above won't work as written because function1 is not in existence when you refer to it. Yes, I just found that

Re: list/dictionary as case statement ?

2007-01-02 Thread Bruno Desthuilliers
Stef Mientki a écrit : If I'm not mistaken, I read somewhere that you can use function-names/references in lists and/or dictionaries, Python's functions are objects too - instances of the (builtin) class 'function'. So yes, you can use them like any other object (store them in containers,

Re: list/dictionary as case statement ?

2007-01-02 Thread Hendrik van Rooyen
Stef Mientki [EMAIL PROTECTED] wrote: If I'm not mistaken, I read somewhere that you can use function-names/references in lists and/or dictionaries, but now I can't find it anymore. The idea is to build a simulator for some kind of micro controller (just as a general practise, I