> Thank-you! It is important for us to avoid potential code
> conflicts and so we'll standardize on the import
> syntax.
>
> On a related note:
> We are using both NumPy and SciPy. Consider the example y = Ax
> where A is a sparse matrix. If A is qualified as a scipy object
> then do y
Dear Users,
How can I add information to an object to explain what it expects as
it's attributes? For instance I may have an object that creates a CAD
file based on a set of default values which are set by the __init__
but can be altered before it runs. for example;
class MakeBasicShape:
def
> How can I add information to an object to explain what it expects as
> it's attributes? For instance I may have an object that creates a CAD
> file based on a set of default values which are set by the __init__
> but can be altered before it runs. for example;
Why don't you specify a doc-string
Thanks for the comments.
>shape0 = BasicShape()
>shape1 = BasicShape('cylinder', [20.,10.,36.])
I like this way of doing things, I could inherit the 3D data object's
class and get it to build on itself. I could for example use a
function definition like the following:
def __init__(*args, **param
Wesley Brooks wrote:
> I do however get a real
> problem when it comes to documenting the expected keywords and running
> into huge doc strings, when I prefer concise documentation.
> Is there an standard way of doing this?
docstrings are the only standard way to document classes and functions.
Wesley Brooks wrote:
> Dear Users,
>
> How can I add information to an object to explain what it expects as
> it's attributes? For instance I may have an object that creates a CAD
> file based on a set of default values which are set by the __init__
> but can be altered before it runs. for example
> Thanks for the comments.
>
>> shape0 = BasicShape()
>> shape1 = BasicShape('cylinder', [20.,10.,36.])
>
> I like this way of doing things, I could inherit the 3D data object's
> class and get it to build on itself. I could for example use a
> function definition like the following:
>
> def __init
I'm debugging a script and want to check the type of an object.
So in the script I write:
print type([object]
This bombs, and I get
"TypeError: 'str' object is not callable'
I've also tried
x = type([object])
print x
Same thing.
In the interactive, 'type([object])' works fine.
What am I missi
Chernev Chernev wrote:
> I'm debugging a script and want to check the type of an object.
>
> So in the script I write:
> print type([object]
>
> This bombs, and I get
> "TypeError: 'str' object is not callable'
>
> What am I missing here?
Probably you have a variable named 'type' in your script
On 9 Nov 2007, at 14:48 , Chernev Chernev wrote:
> I'm debugging a script and want to check the type of an object.
>
> So in the script I write:
> print type([object]
>
> This bombs, and I get
> "TypeError: 'str' object is not callable'
>
> I've also tried
> x = type([object])
> print x
>
> Same
On Nov 9, 2007 10:09 AM, Kent Johnson <[EMAIL PROTECTED]> wrote:
> > So in the script I write:
> > print type([object]
> >
> > This bombs, and I get
> > "TypeError: 'str' object is not callable'
> >
> Probably you have a variable named 'type' in your script that is hiding
> the builtin 'type' objec
Algorithm Education in Python
http://www.ece.uci.edu/~chou/py02/python.html
This article from Pai H. Chou at University of California, Irvine
shows how well the Python programming language maps itself
to the pseudocode used in _Introduction to Algorithms Second Editon_
[Corman, Leiserson, Rivest,
"Chernev Chernev" <[EMAIL PROTECTED]> wrote
> So in the script I write:
> print type([object]
>
> This bombs, and I get
> "TypeError: 'str' object is not callable'
> In the interactive, 'type([object])' works fine.
Looks like you have defined type as a local variable
somewhere in your script
Kent Johnson wrote:
> Marc Tompkins wrote:
>> I'm working with delimited files (ANSI X12 EDI nonsense, to be
>> precise.) First I load the records to a list:
>> tmpSegs = inString.split(self.SegTerm)
>>
>> Now, I want to replace each string in that list with a string:
>>
>> for se
Kent Johnson wrote:
> Bryan Fodness wrote:
>> I would like to have my data in a format so that I can create a contour plot.
>>
>> My data is in a file with a format, where there may be multiple fields
>>
>> field = 1
>>
>> 1a 0
>
> If your data is really this regular, it is pretty easy to parse.
newfile = open('y.txt')
>>> for line in newfile:
... print line.rstrip()
3 5 7
11 8 10
Hi,
I'm trying to parse an array. Now that I can open and read lines in my array,
how can I access individual elements of my multidimensional array? I'd like to
loop through the array and comp
Hey all...
I'm creating a module for my program, and I need to call a function.
Here's how it's set up:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
class DoStuff:
def Thing1(self):
def ThingToCall(self):
print "It worked!"
def Thing2(self):
#Call
Trey Keown wrote:
> Hey all...
> I'm creating a module for my program, and I need to call a function.
> Here's how it's set up:
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> class DoStuff:
> def Thing1(self):
> def ThingToCall(self):
> print "It worked!"
>
* sith . <[EMAIL PROTECTED]> [2007-11-09 17:53:53]:
> newfile = open('y.txt')
> >>> for line in newfile:
> ... print line.rstrip()
>
> 3 5 7
> 11 8 10
This example is different from a array handling one. This is a file handle with
with reading the contents of the file through a loop.
After quizzing newbies in C on swapping without 3rd variable, I found this
to be really *cool* construct to swap :)
x = 10
y = 20
x,y = y,x
--
Aditya
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
I know it can be a FAQ, but still I want ask to clarify my doubts and
assumptions.
I find usually in derived classes, a construct like this:
class Derived(BaseClass):
def __init__(self, *args, **kargs):
BaseClass.__init__(self, *args, **kargs)
- *args, **kargs passes a t
Ricardo Aráoz wrote:
> Kent Johnson wrote:
>> or use slice assignment:
>> tmpSegs[:] = [ seg.split(self.ElemSep) for seg in tmpSegs ]
>
> Won't the slice assignment create a new list and then assign it to the
> old list (which the OP is trying to avoid)?
Yes, it will, thanks! You can assign a gen
hi, and welcome to Python!!
> class Derived(BaseClass):
> def __init__(self, *args, **kargs):
> BaseClass.__init__(self, *args, **kargs)
>
> - *args, **kargs passes a tuple and a dictionary to the BaseClass constructor.
>
> My assumption is the BaseClass will always have a
23 matches
Mail list logo