David Shi via Python-list writes:
> I found a Python class within an Open Source software.
> I would like to use it in my own Python script.
> I tried to import it, but I got following message.
Your text is mangled in transit. Please post only plain text messages
(avoid HTML or ot
On Wed, May 4, 2016 at 8:56 AM, David Shi via Python-list
wrote:
> I found a Python class within an Open Source software.
> I would like to use it in my own Python script.
> I tried to import it, but I got following message.
> from intersection import *Traceback (most recent call
I found a Python class within an Open Source software.
I would like to use it in my own Python script.
I tried to import it, but I got following message.
from intersection import *Traceback (most recent call last): File
"", line 1, in from intersection import *ImportError:
bad ma
Barry Scott, 11.03.2014 22:37:
> On 5 Mar 2014, at 00:14, Bill wrote:
>> I can't figure out how to create an instance
>> of a python class from 'C++':
>
> Why not use pycxx from http://sourceforge.net/projects/cxx/?
>
> This lib does all the heavy li
On 5 Mar 2014, at 00:14, Bill wrote:
> Hello:
>
> I can't figure out how to create an instance
> of a python class from 'C++':
>
Why not use pycxx from http://sourceforge.net/projects/cxx/?
This lib does all the heavy lifting for you for both python2 and
On Wednesday 05 March 2014 17:09:53 Grant Edwards did opine:
> On 2014-03-05, Alister wrote:
> >>> Why are you creating an ABC?
> >>
> >> Because it was the first binary computer that did calculations with
> >> electronic switching elements (gates), and it would be really cool to
> >> have one!
On 2014-03-05, Alister wrote:
>>
>>> Why are you creating an ABC?
>>
>> Because it was the first binary computer that did calculations with
>> electronic switching elements (gates), and it would be really cool to
>> have one! The ABC also pioneered the use of capciators as regenerative
>> storage
On Wed, 05 Mar 2014 16:08:00 +, Grant Edwards wrote:
> On 2014-03-05, Ian Kelly wrote:
>> On Tue, Mar 4, 2014 at 5:14 PM, Bill wrote:
>>> Hello:
>>>
>>> I can't figure out how to create an instance of a python class from
>>> 'C++'
On 2014-03-05, Ian Kelly wrote:
> On Tue, Mar 4, 2014 at 5:14 PM, Bill wrote:
>> Hello:
>>
>> I can't figure out how to create an instance
>> of a python class from 'C++':
>>
>> ( I am relatively new to Python so excuse some of the fol
>
> So far, so good. The object that was passed in was the "Derived"
> class object. Since you presumably only want class objects to be
> passed in, you might want to check that here using PyType_Check.
>
Yes. Will do.
>
> > PyTypeObject *typ = class_decl->ob_type;
>
> In Python, y
On Tue, Mar 4, 2014 at 5:14 PM, Bill wrote:
> Hello:
>
> I can't figure out how to create an instance
> of a python class from 'C++':
>
> ( I am relatively new to Python so excuse some of
> the following. )
>
> In a .py file I create an ABC and then s
Hello:
I can't figure out how to create an instance
of a python class from 'C++':
( I am relatively new to Python so excuse some of
the following. )
In a .py file I create an ABC and then specialize it:
from MyMod import *
from abc import ABCMeta, abstractmethod
course python' for taught courses.
> At least 2 of MIT's self-guided OpenCourseWare courses use Python.
Note this subtle distinction. A Python course will (theoretically, at
least!) teach you how to write Python code. A Python class is a
collection of methods and stuff. A trivial
On 9/6/2012 11:08 AM, Yves S. Garret wrote:
I'd like to know if there are any online Python classes offered
online from reliable institutions that you would recommend.
Google 'online programming course python' for taught courses.
At least 2 of MIT's self-guided OpenCourseWare courses use P
Ok, I have it :)
PyImport_Import , PyModule_GetDict, PyDict_GetItemString and
PyObject_CallObject
Need to take a second look at cython when I have a spare cycle or 2.
Thanks for the the tip :)
A+
Dids,
--
http://mail.python.org/mailman/listinfo/python-list
Dids, 14.03.2012 14:46:
> Apologies if this was asked before, I couldn't find anything.
>
> I have a class defined in a python file:
> for example:
>
> class demo:
> [ class definition goes here]
>
> I'm writing a C extension.
> In the first function, I take an instance of the "demo" class
Hi,
Apologies if this was asked before, I couldn't find anything.
I have a class defined in a python file:
for example:
class demo:
[ class definition goes here]
I'm writing a C extension.
In the first function, I take an instance of the "demo" class and do
my magic. It's working, all is
"Carl Banks" wrote in message
news:d50bba1e-b272-4e39-8a58-377531278...@z4g2000prh.googlegroups.com...
On Sep 30, 5:24 am, "lallous" wrote:
Hello
After using the PyCObject, I cannot pickle the class anymore.
Any simple solution to this problem? (or resorting to __reduce__ is the
only
soluti
cator is as reliable as a custom
> type's tp_dealloc.
You are right. I did not look at the PyCObject_* API close enough.
I thought of wrapping the CObject with a Python class, and calling the
destructor from __del__. That would be less reliable.
S.M.
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 29, 11:16 am, sturlamolden wrote:
> On 29 Sep, 19:11, Carl Banks wrote:
>
> > CObjects can be passed a C function as a deallocator; this should work
> > as reliably as a custom class deallocator.
>
> Except that __del__ prevents cyclic GC.
You are mistaken on two counts.
First of all, a
On Sep 30, 5:24 am, "lallous" wrote:
> Hello
>
> After using the PyCObject, I cannot pickle the class anymore.
> Any simple solution to this problem? (or resorting to __reduce__ is the only
> solution?)
You can't pickle a CObject, you'd have to create a custom type (one
that implements one of th
Hello
After using the PyCObject, I cannot pickle the class anymore.
Any simple solution to this problem? (or resorting to __reduce__ is the only
solution?)
Thanks,
Elias
"Falcolas" wrote in message
news:9d3790aa-f7d9-4bb5-a81f-5428b2d60...@v25g2000yqk.googlegroups.com...
On Sep 29, 2:27 am
Thanks everyone.
Finally, I used Falcolas suggestion and took into consideration
sturlamolden's comments.
Regards,
Elias
"lallous" wrote in message news:h9sgcn$iv...@aioe.org...
Hello
From my C extension module I want to store a C pointer in a given
PyObject.
The only way I figure how to
On 29 Sep, 19:11, Carl Banks wrote:
> CObjects can be passed a C function as a deallocator; this should work
> as reliably as a custom class deallocator.
>
> Carl Banks
Except that __del__ prevents cyclic GC.
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 29, 9:42 am, sturlamolden wrote:
> You can use PyCObject, or write your own extension type that wraps the
> pointer (very easy to to with Cython or Pyrex). The advantage of using
> an extension type is you have a guarantee from Python on the
> deallocator method being called (cdef __dealloc
cdef __dealloc__ in Cython). If the
pointer references a resource that needs to be closed, this is safer
than using a __del__ method in a Python class.
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 29, 2:27 am, "lallous" wrote:
> Hello
>
> From my C extension module I want to store a C pointer in a given PyObject.
>
> The only way I figure how to do it is to use Py_BuildValues and store the
> poiner casted to Py_ssize_t, thus:
>
> Py_BuildValues("n", (Py_ssize_t)my_ptr)
>
> Can it be
Hello
From my C extension module I want to store a C pointer in a given PyObject.
The only way I figure how to do it is to use Py_BuildValues and store the
poiner casted to Py_ssize_t, thus:
Py_BuildValues("n", (Py_ssize_t)my_ptr)
Can it be done differently?
Regards,
Elias
--
http://ma
KraftDiner wrote:
> I have a class that is defined in a file called MyClass.py
>
> How do I use that class in another python script..
> import MyClass ? (Does it need to be in a specific location?)
MyClass.py has to be on your "python path". Your python path is a list
of directories python will
KraftDiner wrote:
> I have a class that is defined in a file called MyClass.py
>
> How do I use that class in another python script..
> import MyClass ? (Does it need to be in a specific location?)
Same directory as the script that's importing it, or in the PYTHONPATH.
import sys
print sys.path
I have a class that is defined in a file called MyClass.py
How do I use that class in another python script..
import MyClass ? (Does it need to be in a specific location?)
--
http://mail.python.org/mailman/listinfo/python-list
Daniel Nogradi wrote:
Of course, modern versions of Exuberant Ctags also support Python, too.
>>>
>>>I apt-installed this package but the man page is rather intimidating so
>>>I thought I might as well make sure I was going in the right direction.
>>
>>You will probably want to read the vim doc
> >>Of course, modern versions of Exuberant Ctags also support Python, too.
> >
> > I apt-installed this package but the man page is rather intimidating so
> > I thought I might as well make sure I was going in the right direction.
>
> You will probably want to read the vim documentation on how to
Chris Jones wrote:
> Robert Kern wrote:
>>Of course, modern versions of Exuberant Ctags also support Python, too.
>
> I apt-installed this package but the man page is rather intimidating so
> I thought I might as well make sure I was going in the right direction.
You will probably want to read
Robert Kern wrote:
> Chris Jones wrote:
>
>>I'm trying to make sense of a python program and was wondering if vim
>>has any python-oriented functionalities (apart from syntax highlighting)
>>that would make it somewhat easier to browse the source code.
>>
>>What I had in mind is something that w
Chris Jones wrote:
> I'm trying to make sense of a python program and was wondering if vim
> has any python-oriented functionalities (apart from syntax highlighting)
> that would make it somewhat easier to browse the source code.
>
> What I had in mind is something that would let me use CTRL+] t
I'm trying to make sense of a python program and was wondering if vim
has any python-oriented functionalities (apart from syntax highlighting)
that would make it somewhat easier to browse the source code.
What I had in mind is something that would let me use CTRL+] to
automatically display what
37 matches
Mail list logo