Fabian Steiner wrote:
> What do I have to change in order to make the code work?
I'm afraid to say: your knowledge of C :-)
But don't worry, C is an easy language to learn, and a very valuable
skill to have.
Baalbek
--
http://mail.python.org/mailman/listinfo/python-list
Fabian Steiner wrote:
> Georg Brandl wrote:
>> Fabian Steiner wrote:
>>> [...]
>>> for (i = 0; i <= seqlen; i++) {
>>
>> That is one iteration too much. Use
>>
>> for (i = 0; i < seglen; i++)
>>
>>> item = PySequence_Fast_GET_ITEM(seq, i);
>>
>> Now item is a PyObject*.
Georg Brandl wrote:
> Fabian Steiner wrote:
>> [...]
>> for (i = 0; i <= seqlen; i++) {
>
> That is one iteration too much. Use
>
> for (i = 0; i < seglen; i++)
>
>> item = PySequence_Fast_GET_ITEM(seq, i);
>
> Now item is a PyObject*. You'll have to convert it to an i
Fabian Steiner wrote:
> I recently started learning C since I want to be able to write Python
> extension modules. In fact, there is no need for it, but I simply want
> to try something new ...
>
> I tried to implement the bubblesort algorithm in C and to use it in
> python; bubblesort.c compil
Heikki Salo wrote:
> Heikki Salo wrote:
>> Fabian Steiner wrote:
>>> What did I do wrong? As I am quite new to C, I probably made many
>>> mistakes, so please feel free to correct me.
>>
>> The following line:
>>
>> > for (i = 0; i <= seqlen; i++) {
>>
>> Should be "for (i = 0; i < seqlen; i+
Nick Smallbone wrote:
> Duncan Booth wrote:
>> Heikki Salo wrote:
>>
>> >
>> > And closer look tells that the code should not even compile. Is the
>> > code cut & pasted directly? Line "list[i] = item;" tries to assign a
>> > pointer to an int-array, which should not compile. There are other
>> >
Duncan Booth wrote:
> Heikki Salo wrote:
>
> >
> > And closer look tells that the code should not even compile. Is the
> > code cut & pasted directly? Line "list[i] = item;" tries to assign a
> > pointer to an int-array, which should not compile. There are other
> > similar oddities.
>
> ... such a
Heikki Salo wrote:
>
> And closer look tells that the code should not even compile. Is the
> code cut & pasted directly? Line "list[i] = item;" tries to assign a
> pointer to an int-array, which should not compile. There are other
> similar oddities.
... such as the declaration of list at a poi
Heikki Salo wrote:
> Fabian Steiner wrote:
>> What did I do wrong? As I am quite new to C, I probably made many
>> mistakes, so please feel free to correct me.
>
> The following line:
>
> > for (i = 0; i <= seqlen; i++) {
>
> Should be "for (i = 0; i < seqlen; i++) {". Otherwise the last
Fabian Steiner wrote:
> What did I do wrong? As I am quite new to C, I probably made many
> mistakes, so please feel free to correct me.
The following line:
> for (i = 0; i <= seqlen; i++) {
Should be "for (i = 0; i < seqlen; i++) {". Otherwise the last
assignment will be out of bounds an
I recently started learning C since I want to be able to write Python
extension modules. In fact, there is no need for it, but I simply want
to try something new ...
I tried to implement the bubblesort algorithm in C and to use it in
python; bubblesort.c compiles fine, but whenever I want to im
11 matches
Mail list logo