Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6241241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:43:43+00:00 2026-05-24T11:43:43+00:00

In my Group class, there must be an attribute particles which should be an

  • 0

In my Group class, there must be an attribute particles which should be an array-like but resizable type that can only hold Particle-instances.
Both classes, Group and Particle are declared using cdef.

As Python-lists can carry any Python-object, I thought there might be a more performant way of declaring some kind of C-list that does only accept Particle-instances.
In C it would be something like List<Particle> particle = new List<Particle>(); i think.

Is there any equivalent for Cython or should I just stay with the Python-list ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T11:43:44+00:00Added an answer on May 24, 2026 at 11:43 am

    The question begs to be asked : why do you want this ?

    • is it for efficiency (looping over the array) or to lower memory footprint ?
    • do you need an array or a linked list would be enough ?
    • is your particle class a simple struct or something with behavior/method ?

    Depending on these, the best solution goes from using a python array to numpy or a stl container.

    ( Note, for example, that looping over python list in cython could be quite efficient. )

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are a group of private methods in my class, and I need to
When writing a class do you group members variables of the same type together?
I have a model class that has, among other things: class Group < ActiveRecord::Base
Here's the situation. I have a base class which implements a method that accepts
I have written a variant class, which will be used as the main type
I have this C# class structure that I would like to refactor to use
I'm playing with Hibernate a little bit. I created a Group class and a
I have models (simplified example): class Group(models.Model): name = models.CharField(max_length = 32) class Person(models.Model):
i have class named Group i tried to test configuration: var cfg = new
model.py: class Tribes(Group): members = models.ManyToManyField(User, related_name='tribes', verbose_name=_('members')) i want to store a number

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.