collapse collapse

* Who's Online

  • Dot Guests: 267
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Board Stats

  • stats Total Members: 88
  • stats Total Posts: 11164
  • stats Total Topics: 1700
  • stats Total Categories: 4
  • stats Total Boards: 76
  • stats Most Online: 1470

Author Topic: python pointers ( 2.7)  (Read 3153 times)

0 Members and 1 Guest are viewing this topic.

Offline etopsirhc

  • Newbie
  • *
  • Posts: 30
  • Reputation 60
    • View Profile
python pointers ( 2.7)
« on: July 16, 2011, 01:53:52 pm »
ok i have 2 lists of simmiler classes
( exact same variables and functions with just a slight change )

i'd like to put the items in the lists into 1 list ( temporarily ) and sort it by a var in that class

so for effency i though i'd use pointers , i just dont know how
pushing the limits of my own understanding beyond the limits of my own understanding

You can send a E-MAIL to your self!!! >:( >:( >:(
Hey, if you are that crazy to where you must talk to yourself via email be my guest!

Offline Nathan

  • Administrator
  • Hero Member
  • *
  • Posts: 1437
  • Reputation 1768
  • Gender: Male
  • woof woof
    • View Profile
Re: python pointers ( 2.7)
« Reply #1 on: July 16, 2011, 06:10:24 pm »
ok i have 2 lists of simmiler classes
( exact same variables and functions with just a slight change )

i'd like to put the items in the lists into 1 list ( temporarily ) and sort it by a var in that class

so for effency i though i'd use pointers , i just dont know how

What you need to use is the sorted function.
http://wiki.python.org/moin/HowTo/Sorting/
Projects:
[ Axios Engine ] [ sourcehub ]
Compilers: Microsoft Visual Studio 2008, GNU C++, FASM, MASM, VB 6/.Net.
Languages: C++, PHP, ASM, JS, VB6/.Net, BASIC, HTML, MySQL
Please buy me some books: Amazon Wishlist

Offline rm9402

  • - Secret Permissions Level 1 -
  • Jr. Member
  • **
  • Posts: 67
  • Reputation 117
  • Gender: Male
    • View Profile
Re: python pointers ( 2.7)
« Reply #2 on: July 18, 2011, 06:00:15 pm »
Not sure if this is what you want to do or if this helps, but you could append the elements in one to the other. Then save that in another list or add the two lists, like a union of the two.
“Never trust a computer you can’t throw out a window.”
(Steve Wozniak)

Offline jho

  • The flamboyant FLOSS fanatic
  • Sr. Member
  • *
  • Posts: 352
  • Reputation 1199
  • Gender: Male
    • View Profile
    • http://hajotus.net
Re: python pointers ( 2.7)
« Reply #3 on: July 19, 2011, 08:45:07 pm »
There are no pointers in Python in the way you think of them. Python is a lot more abstract and higher level language when compared to, say, C or C++ where you're probably getting your crazy idea from. One of the most important design goals of high-level languages like Python is that you don't have to deal with low-level memory management, like deciding when to use pointers or not.

But if it makes you feel any happier I'm pretty certain that deep down almost every function call in Python actually passes pointers and not raw data automatically, since pretty much everything, even numbers, are objects and their memory footprints are way bigger than what would be worthwhile to pass as anything else but pointers.
"I'm sorry, I only accept criticism in the form of sed expressions."

 

Donate


* Search


* Recent Posts

I miss the chatbox by Shishka
[August 27, 2019, 11:52:39 pm]


Image Comparison by Shishka
[May 15, 2017, 01:18:02 pm]


Re: srchub - free source code hosting by Nathan
[December 14, 2015, 11:37:02 pm]


Re: srchub - free source code hosting by Celestialkey
[November 27, 2015, 08:51:42 am]


Updates by Nathan
[October 30, 2015, 08:27:36 pm]