[Tutor] ctypes typedef

2007-05-14 Thread Adam Pridgen
Hey everyone, I am messing around with the ctypes package, and I wasn wondering how I go about defining a new type, where I essentially call an int foo. For example in C, I would use the following statement: typedef int foo; Is there an equivalent statement using ctypes, or is there another way

Re: [Tutor] Declaring a Python/C Package and Accessing Python Constants from C API

2007-05-11 Thread Adam Pridgen
I perform: python setup.py install and it compiles and installs without error, but when I try the following: import python_foo from python_foo import foo_interface It says it can not find the module. Thanks for any help in advance, Adam On 5/11/07, Adam Pridgen <[EMAIL PROTECTED]> wrote:

[Tutor] Declaring a Python/C Package and Accessing Python Constants from C API

2007-05-11 Thread Adam Pridgen
Hello everyone, I am trying to create a python package that includes both a native python module and then a python module created using the Python/C API. I have several questions pertaining to this area. First, how do I make the C API module aware of the python module. Specifically, I have dec

Re: [Tutor] How to program to python the right way?

2007-04-21 Thread Adam Pridgen
Disregard this email, gmail mis-fired. On 4/21/07, Adam Pridgen <[EMAIL PROTECTED]> wrote: > I guess the problem I am trying to quell really revolves around style > and the proper way to do application programming with Python. So one > of the things I found out the hard way a

Re: [Tutor] How to program to python the right way?

2007-04-21 Thread Adam Pridgen
process works when a class is instantiated. class Foo: string = "" int = 0 On 4/21/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > Adam Pridgen wrote: > > Hello everyone, > > > > I have pretty much finished hacking on my Thesis and I have come to &g

[Tutor] How to program to python the right way?

2007-04-18 Thread Adam Pridgen
Hello everyone, I have pretty much finished hacking on my Thesis and I have come to the conclusion, I really do not know how to use Python to it "full" extent. Some of the things I have really messed up in my implementation are serialization (specifically sub-classes), classes, and instantiating

[Tutor] python instances and type

2007-04-16 Thread Adam Pridgen
Hello, Sorry for the long email, but thanks in advance. I am not quite sure what is happening, so I have not been able to adequately seek a solution via Google, so if this answer is fairly easy to find on Google, let me know. I am not sure how to produce an example of my problem without using th

[Tutor] kwds

2007-04-10 Thread Adam Pridgen
Hello, I am having a difficult time understanding the whole "def function(*args, **kwds):" business, and I have not really found a clear or concise explanation via Google. My question is pretty much this, is **kwds a dictionary and can I use it like a dictionary, and what is the deal with the * o

[Tutor] executing a string representing python code

2007-03-05 Thread Adam Pridgen
here's the magic you are looking for: func_str = \ ''' def some_func(value): # youwould check value instance here and do something to it print "Hello World", value return "Done" ''' exec(func_str) f = locals()["some_func"] print f("wasn't that cool!") When you exec the str, it will create

Re: [Tutor] wav audio playback

2007-02-25 Thread Adam Pridgen
You are getting these errors because the API for Python varies by release (e.g. 2.4 to 2.5) due to additions, bug fixes, etc.. The warning you are receiving is letting you know that it was compiled and meant to be run on Python 2.4, and also subtly warning that problems may arise when you run or

[Tutor] Dictionaries of Tuples of Strings

2007-02-23 Thread Adam Pridgen
Hello, When I have a tuple with a single string in a dictionary entry and try to iterate over the tuple and it breaks the string into individual characters. Is this supposed to be happening? This problem is a little tricky to explain so I have included the output and the corresponding example c

[Tutor] what instance type is a function object?

2007-02-22 Thread Adam Pridgen
Thanks in advance for your help. I am trying to pickle a class, but I want to exclude function objects for obvious reasons. How do I determine if a python object is a function, specifically when using isinstance()? I am not sure what a type or instance a Python 'function' originates from. The be

[Tutor] Question about local scopes (namespaces)

2007-02-21 Thread Adam Pridgen
Sorry for the long email, and thanks in advance. In the below example, is the list foo supposed to retain the value after the function, Bar(), returns? Is the list foo supposed to reinitialized on each call to Bar(), meaning len(foo) == 0, and when Bar() returns len(foo) (when Bar() is called w/

[Tutor] Unpickling data after passing over the network

2007-02-11 Thread Adam Pridgen
Hello, I am having problems with unpickling data after I pass the data through a socket. Right now, I am pickling a basic string base 64 encoding and sending the data over the network. After the recipient client/server receives the data, it is decoded and then unpickled. The unpickling fai