[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Octave and Database connectivity
From: |
fork |
Subject: |
Re: Octave and Database connectivity |
Date: |
Mon, 24 Sep 2012 17:12:03 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Jordi Gutiérrez Hermoso <jordigh <at> octave.org> writes:
>
> On 22 September 2012 07:01, Sergei Steshenko <sergstesh <at> yahoo.com> wrote:
> > But isn't Octave's struct an equivalent of Python's dict functionality ?
>
> Sort of. You can only use strings as keys in a struct. You can use any
> hashable type in Python as keys.
Also, Python's dict is built into the syntax, which can make certain operations
a lot more elegant. For example, counting words with a dict in python (assuming
words in a list, untested, probably could shorten with ifelse() ):
for word in words:
cdict[word] += 1
Counting words the same in Octave (words in a 1xN cell array, untested):
for word in words
if isfield(cstruct, word)
cstruct = setfield(cstruct, word, getfield(cstruct, word)+1))
else
cstruct = setfield(cstruct, word, 1)
endif
endfor
dicts would go in my list of things for octaveng (ng = next generation), along
with reference syntax for pass by reference, and named parameters, and python
style classes.
- Re: Octave and Database connectivity, (continued)
- Re: Octave and Database connectivity, Jordi Gutiérrez Hermoso, 2012/09/12
- Re: Octave and Database connectivity, Sergei Steshenko, 2012/09/12
- Re: Octave and Database connectivity, Philip Nienhuis, 2012/09/12
- Re: Octave and Database connectivity, Jordi Gutiérrez Hermoso, 2012/09/12
- Re: Octave and Database connectivity, Philip Nienhuis, 2012/09/12
- Re: Octave and Database connectivity, fork, 2012/09/21
- Re: Octave and Database connectivity, Sergei Steshenko, 2012/09/22
- Re: Octave and Database connectivity, Juan Pablo Carbajal, 2012/09/22
- Re: Octave and Database connectivity, Jordi Gutiérrez Hermoso, 2012/09/23
- Re: Octave and Database connectivity, Sergei Steshenko, 2012/09/23
- Re: Octave and Database connectivity,
fork <=
- Re: Octave and Database connectivity, Jordi Gutiérrez Hermoso, 2012/09/24
- Re: Octave and Database connectivity, fork, 2012/09/24
- Re: Octave and Database connectivity, Jordi Gutiérrez Hermoso, 2012/09/24
- Re: Octave and Database connectivity, fork, 2012/09/24
Re: Octave and Database connectivity, richard, 2012/09/12