Watching serial port activity.

2006-05-29 Thread xkenneth
Hi,

   I'm writing a couple python applications that use the serial port
(RS-232) quite extensively. Is there any way I can monitor all activity
on the serial port and have it printed as the transactions occur? I'm
trying to reverse engineer a microcontroller serial routine and I'd
like to see any response the chip sends back.

Regards,
Ken

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Watching serial port activity.

2006-05-29 Thread xkenneth
I'm using linux.

-- 
http://mail.python.org/mailman/listinfo/python-list


Quick Question

2006-06-22 Thread xkenneth
I want to be able to cycle through an array and print something in
hexadecimal. Such as this
thisArray = ["AF","0F","5F"]
for x in range(len(thisArray)):
   print "\x" + thisArray[x]

However python chokes on the escaped identifier, how can I get around
this?

Thanks!
Regards,
Ken

-- 
http://mail.python.org/mailman/listinfo/python-list


Sort of an odd way to debug...

2007-09-04 Thread xkenneth
All,

Sorry for the vague topic, but I really didn't know how to
describe what I want to do. I'd like to almost do a traceback of my
code for debugging and I thought this would be a really cool way to do
it if possible.

What I'd like to do, is define a base class. This base class would
have a function, that gets called every time another function is
called (regardless of whether in the base class or a derived class),
and prints the doc string of each function whenever it's called. I'd
like to be able to do this without explicitly specifying the function
inside all of the other functions of a base class or derived class.

Here's what I think it would look like:

class Base:
 __init__(self,debug=False):
if debug:
self.debug = debug

 def functionThatAlwaysGetsCalled(self):
   print self.__docstring__

class Derived(Base):
"""This function prints something"""
def printSometing(something)
 #ghost function get's called here
 print something

Output would be:
This function prints something
something

Thanks for any help!

-- 
http://mail.python.org/mailman/listinfo/python-list


Organizing Code - Packages

2007-09-07 Thread xkenneth
All,

I apologize if this is a commonly asked question, but I didn't
find anything that answered my question while searching.

So what I have right now is a few packages that contain some commonly
used functions and another package that contains all of my custom
error classes. I want these error classes available to me in all of
the other packages in my library. Currently to achieve this at the top
of every module file I have the line "from My.Library.Errors import
*", my problem with this is that it manages to import the Errors into
every scope that they are used. I'm still pretty new to Python, and my
approachs are probably very rooted in C/C++ (I've had the hardest time
getting over not being able to overload functions), but am I doing
this correctly?

   Also, are there any good tutorials/examples out there of how to
organize your python code into packges?

Thanks for all the help!

Regards,
Ken

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Organizing Code - Packages

2007-09-07 Thread xkenneth

> Ah, yes, a couple of things:
> - avoid the 'one-class-per-file' syndrom. It's perfectly ok to have tens

Yes but i find it hard to edit classes easily when I have more than
one class per file.

Regards,
Ken

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Organizing Code - Packages

2007-09-08 Thread xkenneth
On Sep 7, 2:04 pm, Wildemar Wildenburger
<[EMAIL PROTECTED]> wrote:
> Paul Rudin wrote:
> > xkenneth <[EMAIL PROTECTED]> writes:
>
> >>> Ah, yes, a couple of things:
> >>> - avoid the 'one-class-per-file' syndrom. It's perfectly ok to have tens
> >> Yes but i find it hard to edit classes easily when I have more than
> >> one class per file.
>
> > Why?
>
> Scroll-Blindness would be a good reason.
>
> It would however be completely rediculous to create a file for every
> 10-liner class you have (and I have found that Python classes tend to be
> rather short).
>
> /

Yes I agree, "Scroll-Blindness" it just gets long and confusing.
Navigating isn't so bad (emacs) here. I have another question for
something I don't quite understand.

How do import statements that are declared at the top of a python
module work?

for instance

from MyModule.Objects import *

class Class:
  def function:
   #here i cannot access the things that should have been
imported from the above statement
   #i printed the dir() function to verify this

This happens when I'm using the Class i just defined from another
python script. I can understand if that statement at the top if not
being executed when I import the above defined class, if so, I need to
access the classes from the other modules, so where do I put the
import statement? Is it proper to put import statements inside of
class function definitions? This solves my problem but seems VERY
incorrect coming from my old C/C++ ways.

Thanks Again!

Regards,
Ken


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Organizing Code - Packages

2007-09-08 Thread xkenneth
On Sep 8, 3:35 pm, David <[EMAIL PROTECTED]> wrote:
> > How do import statements that are declared at the top of a python
> > module work?
>
> http://docs.python.org/tut/node8.html

On Sat, 08 Sep 2007 12:42:19 -0700, xkenneth wrote:
> How do import statements that are declared at the top of a python
> module work?

They import the module.  ;-)
> for instance
> from MyModule.Objects import *

> class Class:
>   def function:
>#here i cannot access the things that should have been
> imported from the above statement
>#i printed the dir() function to verify this


Sorry I don't believe this.  This doesn't even compile because the
method
`function()` lacks the arguments in the definition.  Please post
actual
code and actual tracebacks you get.
And `MyModule` is a bad name for a package.

Ciao,
Marc 'BlackJack' Rintsch

Code doesn't compile in python. This is pseudo code anyways.
Can't post actual code and tracebacks because the code is proprietary.
"MyModule" is pseudo code, and i forgot the arguments, the actual code
and errors are unimportant for this question.

-- 
http://mail.python.org/mailman/listinfo/python-list


xmlrpclib and SimpleXMLRPCServer questions

2007-09-12 Thread xkenneth
So i've been trying to set up a simple server and client through
XMLRPC in python.

Here's my code:

SERVER

import SimpleXMLRPCServer


class DataServer:
def __init__(self):
pass

def test(self,test):
self.this = test

def show(self):
print self.this

server = SimpleXMLRPCServer.SimpleXMLRPCServer(("localhost", 8005))
server.register_instance(DataServer())
server.serve_forever()

CLIENT
import xmlrpclib
server = xmlrpclib.Server('http://localhost:8005')
server.test(5)
server.show()


Now, I'm getting the most odd callback from the client side:

>>> server.show()
Traceback (most recent call last):
  File "", line 1, in ?
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/
lib/python2.4/xmlrpclib.py", line 1096, in __call__
return self.__send(self.__name, args)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/
lib/python2.4/xmlrpclib.py", line 1383, in __request
verbose=self.__verbose
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/
lib/python2.4/xmlrpclib.py", line 1147, in request
return self._parse_response(h.getfile(), sock)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/
lib/python2.4/xmlrpclib.py", line 1286, in _parse_response
return u.close()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/
lib/python2.4/xmlrpclib.py", line 744, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault: 

What is causing this? The server recieves the data and seems to
respond properly regardless of this error, so by all means i can
always catch it, but that sounds stupid.

Here I can verify the server process is indeed recieving the data
(calling the client with two different values):

localhost - - [12/Sep/2007 14:35:18] "POST /RPC2 HTTP/1.0" 200 -
5
localhost - - [12/Sep/2007 14:35:41] "POST /RPC2 HTTP/1.0" 200 -
10

Looking at the documentation:

class SimpleXMLRPCServer(   addr[, requestHandler[,
logRequests[allow_none[, encoding)

I'm not sure how to specify the allow_none value or it's type, how can
i find out more?

Thanks for the help!

Regards,
Ken

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: xml question

2007-09-12 Thread xkenneth
There are built in tools for the DOM in Python. Also I'm using OSX to
do XML parsing but I'm using the tools available from 4suite.

On Sep 12, 2:21 pm, [EMAIL PROTECTED] wrote:
> Just curious if there's any python xml parsing tools built into the Mac (OS 
> 10.4.10 Tiger)?  If so,
> could anyone
> share some simple code (or maybe point me to a web-site) of how to parse xml 
> data from a
> file?  For example,  if I
> had a file that contained this:
>
> 
> 
>  base="Separation">Black
> Light Blue
> Green
> 
>
> I'd want to look in the 'colors' xml element, then look at each 'color' xml 
> element inside and
> pull any that have
> values (which would be Black, Light Blue and Green).  I'd like to know how to 
> pull 'attributes'
> too.
>
> Thanks very much for your help.
>
> Jay


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can I overload the compare (cmp()) function for a Lists ([]) index function?

2007-09-28 Thread xkenneth
On Sep 28, 12:30 pm, xkenneth <[EMAIL PROTECTED]> wrote:
> Looking to do something similair. I'm working with alot of timestamps
> and if they're within a couple seconds I need them to be indexed and
> removed from a list.
> Is there any possible way to index with a custom cmp() function?
>
> I assume it would be something like...
>
> list.index(something,mycmp)
>
> Thanks!

or can i just say

list.index.__cmp__ = mycmp

and do it that way? I just want to make sure I'm not doing anything
evil.

-- 
http://mail.python.org/mailman/listinfo/python-list


Can I overload the compare (cmp()) function for a Lists ([]) index function?

2007-09-28 Thread xkenneth
Looking to do something similair. I'm working with alot of timestamps
and if they're within a couple seconds I need them to be indexed and
removed from a list.
Is there any possible way to index with a custom cmp() function?

I assume it would be something like...

list.index(something,mycmp)

Thanks!

-- 
http://mail.python.org/mailman/listinfo/python-list


View XMLRPC Requests/Responses?

2007-10-15 Thread xkenneth
Hi,

I'm working on developing an XML-RPC interface from LabVIEW to
python and I would really like to see how python is forming it's XML-
RPC requests/responses. Is there any way I can force these to a log or
print them to the screen? Thanks.

Regards,
Ken

-- 
http://mail.python.org/mailman/listinfo/python-list


Organizing Sequential Data (TimeStamps) Overthinking?

2007-10-19 Thread xkenneth
All,

   Just a quick question. I want to be able to have a data structure
that organizes data (timestamps I'm working with) sequentially, so
that i can easily retrieve the first x amount of timeStamps without
iterating over a list. My thought was to use a binary tree, am i
overthinking the problem to try and implement this structure inside of
python? I was also hoping this would already be done for me.

Regards,
Ken

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Securely distributing python source code as an application?

2007-12-07 Thread xkenneth
Message should have read:
Hi All,

 I'll shortly be distributing a number of python applications that
use proprietary source code. The software is part of a much larger
system and it
will need to be distributed securely. How can i achieve this?

Regards,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Securely distributing python source code as an application?

2007-12-07 Thread xkenneth
Hi All,

 I'll shortly be distributing a number of python applications that
use proprietary. The software is part of a much larger system and it
will need to be distributed securely. How can i achieve this?

Regards,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Tab indentions on different platforms?

2007-12-28 Thread xkenneth
All,


I seem to be having problems with running my python code, written
on a Mac, on Linux and Windows boxes. It seems like the problem has to
do with tab indention, particularly I've noticed that my code will
completely ignore try statements. Has anyone had a similar problem?

Regards,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Optional code segment delimiter?

2007-12-29 Thread xkenneth
Is it possible to use optional delimiters other than tab and colons?

For example:

 if this==1 {
  print this
 }

And is there an alternate delimiter for statements other than the
newline?

print this;print that; #for example


I know I'll probably get yelled at for this question, but I would just
like to know.

Regards,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


XML-XSD Processing/Creation.

2008-01-02 Thread xkenneth
Hi All,

  So i'm working with the WITSML standard, which is a pretty
massive standard defined in XML for the transfer of oilfield data.
There are a ton of XSD files for defining and checking all data in the
WITSML format. I'd like to be able to easily create XML based on the
types defined by the WITSML XSD files. Is there any way to create a
basic XML object based on an XSD file and then populate it with data.
Can i create python classes based off the XSD files? What else can I
do with the XSD files? I'm looking for a really simplistic way to work
with WITSML in python.

Regards,
Kenneth Miller

Thanks a ton!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: XML-XSD Processing/Creation.

2008-01-03 Thread xkenneth
On Jan 3, 1:55 am, Stefan Behnel <[EMAIL PROTECTED]> wrote:
> paul wrote:
> >> Can i create python classes based off the XSD files? What else can I
> >> do with the XSD files?
> > This might be worth looking at:http://www.rexx.com/~dkuhlman/#generateDS
>
> If it's really such a complex XML language, the tool above might or might not
> be of any help, as it doesn't support the whole XSD standard (and XML Schema
> is very complex). It's worth a try, but don't expect too much.
>
> The lxml way of dealing with XML languages is namespace implementation:
>
> http://codespeak.net/lxml/dev/element_classes.html#id1
>
> However, there isn't currently a way to automatically bootstrap an
> implementation, especially not in XSD, so it depends on the language how much
> work it will be to get this to a usable state.
>
> Stefan

Just a bump in an attempt to get some more help.
-- 
http://mail.python.org/mailman/listinfo/python-list


What is the most simple, quicket, yet most powerful python Web-Framework?

2008-02-05 Thread xkenneth
All,

  I'm trying to build a simple web application, but i still need
things like sessions and Ajax. I tried to create a Zope product, but I
honestly can't think of anything more cryptic. I really don't enjoy
learning all of the "magic code" and debugging an environment I have
to study to know the slightest thing about.

  I'm looking for simple, fast, and easy. I'm both a manager and a
developer, so I don't have a lot of time to try things out and see
what fits best. I need a solution i can implement well and with a
great deal of speed.

  My project is going to be rather simple, just some simple forms
for setup/configuration, user management, I assume I'll need
templates, I'd like to use Ajax or  a similar technology to display
orthogonal and polar graphs that automatically update. For the DB
backend I'm planning on using ZODB. ZODB is actually quite amazing,
and after using it, I honestly can't think of a reason for using a SQL
database.

  All help is appreciated! Let me know if you have any questions.

Regards,
Kenneth Miller

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is the most simple, quicket, yet most powerful python Web-Framework?

2008-02-05 Thread xkenneth
> My question is: "What makes you think that there is a royal road to web
> development?"
I don't, I was just hoping there was something I was missing, or more
simple than anything I'd experienced.

>
> You have already chosen some technology (Ajax and ZODB) without any
> apparent justification.
I've chosen Ajax for it's asynchronous nature. Alot of the data I'm
going to be displayed needs to be updated immediately as it comes in.
I've chosen ZODB because of the way it operates. I really enjoy the
flexibility of an object-oriented database as well as the ZEO server,
which will allow me to exactly what I need to do.

Why not just consult your prejudices for the
> others as well.
I haven't made any decisions as to the technology I'm going to use
with prejudice, I simply failed to explain properly why I chose those
technologies.

> Come to that, why is it even necessary to select a
> Python-based solution?
Most of my codebase is currently in python. I use python to do things
like data acquisiton and signal processing. I'm very familiar with
python, and I enjoy developing in it. Python has the technologies
available to it that allow to do what I want to do.
>
> I could say "Django can do everything you need from your description of
> your requirements", but then you'd be disappointed that it does in fact
> take time to learn how to do things in Django. Just like it does in any
> other complex framework.
Thanks.
>
> regards
>   Steve
> --
> Steve Holden+1 571 484 6266   +1 800 494 3119
> Holden Web LLC  http://www.holdenweb.com/

Regards,
Kenneth Miller
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is the most simple, quicket, yet most powerful python Web-Framework?

2008-02-05 Thread xkenneth
On Feb 5, 9:33 pm, xkenneth <[EMAIL PROTECTED]> wrote:
> > My question is: "What makes you think that there is a royal road to web
> > development?"
>
> I don't, I was just hoping there was something I was missing, or more
> simple than anything I'd experienced.
>
>
>
> > You have already chosen some technology (Ajax and ZODB) without any
> > apparent justification.
>
> I've chosen Ajax for it's asynchronous nature. Alot of the data I'm
> going to be displayed needs to be updated immediately as it comes in.
> I've chosen ZODB because of the way it operates. I really enjoy the
> flexibility of an object-oriented database as well as the ZEO server,
> which will allow me to exactly what I need to do.
>
> Why not just consult your prejudices for the> others as well.
>
> I haven't made any decisions as to the technology I'm going to use
> with prejudice, I simply failed to explain properly why I chose those
> technologies.
>
> > Come to that, why is it even necessary to select a
> > Python-based solution?
>
> Most of my codebase is currently in python. I use python to do things
> like data acquisiton and signal processing. I'm very familiar with
> python, and I enjoy developing in it. Python has the technologies
> available to it that allow to do what I want to do.
>
>
By the way, thanks to all who replied!

>
> > I could say "Django can do everything you need from your description of
> > your requirements", but then you'd be disappointed that it does in fact
> > take time to learn how to do things in Django. Just like it does in any
> > other complex framework.
> Thanks.
>
> > regards
> >   Steve
> > --
> > Steve Holden+1 571 484 6266   +1 800 494 3119
> > Holden Web LLC  http://www.holdenweb.com/
>
> Regards,
> Kenneth Miller

-- 
http://mail.python.org/mailman/listinfo/python-list


Intra-Package References

2008-03-08 Thread xkenneth
Does your python module have to exist in the path in order for intra-
package references to work?

Regards,
Kenneth Miller
-- 
http://mail.python.org/mailman/listinfo/python-list


Logically/Selectively Sub Class?

2008-03-09 Thread xkenneth
Might be a silly question, but is it possible to selectively subclass,
IE subclass is a supporting module is present and not otherwise.

Regards,
Kenneth Miller
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Logically/Selectively Sub Class?

2008-03-09 Thread xkenneth
On Mar 9, 4:38 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> xkenneth schrieb:
>
> > Might be a silly question, but is it possible to selectively subclass,
> > IE subclass is a supporting module is present and not otherwise.
>
> Yes, something like this should work
>
> class Foo(some, base, classes)
>     pass
>
> if condition:
>     Temp = Foo
>     class Foo(Temp, otherclass): pass
>
> Alternatively, you can use the type-function to create classes explicit
> with a list of base-classes.
>
> However it smells after bad design... what's your actual usecase?
>
> Diez

Yeah, it's really a non-issue, just more a curiosity. I'm using ZODB
for a lot of my stuff now, and I need my objects to be persistent,
however there might be a case where my classes could be used in a non-
persistent manner. I'll just have ZODB as a requirement for my
package.

Regards,
Kenneth Miller
-- 
http://mail.python.org/mailman/listinfo/python-list


Max File Size

2008-03-11 Thread xkenneth
Is the max file size a relevant issue in python anymore? I know OS X
has a max file size of 8 exabytes and I'm not sure about the latest
version of Ubuntu. Does python have an independent file size limit, or
is it dependent upon the OS it was compiled on?

Regards,
Kenneth Miller
-- 
http://mail.python.org/mailman/listinfo/python-list


Python - CGI - XML - XSD

2008-03-11 Thread xkenneth
Hi All,

   Quick question. I've got an XML schema file (XSD) that I've
written, that works fine when my data is present as an XML file.
(Served out by apache2.) Now when I call python as a cgi script, and
tell it print out all of the same XML, also served up by apache2, the
XSD is not applied. Does this have to do with which content type i
defined when printing the xml to stdout?

Regards,
Kenneth Miller
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python - CGI - XML - XSD

2008-03-12 Thread xkenneth
On Mar 12, 6:32 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> xkenneth wrote:
> > Hi All,
>
> >    Quick question. I've got an XML schema file (XSD) that I've
> > written, that works fine when my data is present as an XML file.
> > (Served out by apache2.) Now when I call python as a cgi script, and
> > tell it print out all of the same XML, also served up by apache2, the
> > XSD is not applied. Does this have to do with which content type i
> > defined when printing the xml to stdout?
>
> Who's applying the stylesheet? The browser, some application like XmlSpy or
> what?
>
> Diez

The browser.

Regards,
Kenneth Miller
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python - CGI - XML - XSD

2008-03-12 Thread xkenneth
On Mar 12, 11:58 am, Stefan Behnel <[EMAIL PROTECTED]> wrote:
> xkenneth wrote:
> > On Mar 12, 6:32 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> >> xkenneth wrote:
> >>> Hi All,
> >>>    Quick question. I've got an XML schema file (XSD) that I've
> >>> written, that works fine when my data is present as an XML file.
> >>> (Served out by apache2.) Now when I callpythonas a cgi script, and
> >>> tell it print out all of the same XML, also served up by apache2, the
> >>>XSDis not applied. Does this have to do with which content type i
> >>> defined when printing the xml to stdout?
> >> Who's applying the stylesheet? The browser, some application like XmlSpy or
> >> what?
>
> > The browser.
>
> Well, why should it validate your file? Browsers don't do that just for fun.
>
> Stefan

Sorry, it was really late when i wrote this post. The file is an XSL
file. It defines HTML depending on what appears in the XML document.

Regards,
Kenneth Miller
-- 
http://mail.python.org/mailman/listinfo/python-list


xml.etree.ElementTree and XPath

2008-10-18 Thread xkenneth
All,

Can I execute XPath queries on ElementTree objects ignoring the
namespace? IE './node' instead of './{http://namespace.com}node'.

Is there any support for XPath and Minidom?

Regards,
Ken
--
http://mail.python.org/mailman/listinfo/python-list


Anyone in the Houston / College Station / Austin area? Looking to do some sprints / joint projects.

2008-11-01 Thread xkenneth
All,

   I'm in Houston/College Station/Austin quite often and I'm looking
for other coders to do some joint projects with, share experiences, or
do some sprints. Let me know if you're interested.

Regards,
Ken
--
http://mail.python.org/mailman/listinfo/python-list


Design principles and architecture of an information transfer standard based on XML and SOAP

2008-06-26 Thread xkenneth
All,

   So i'm just about to undertake my first real open source project,
and I'm looking for a bit of advice. There's an oilfield standard
called WITSML (Wellsite Information Transfer Standard Markup Language
- witsml.org), it's basically a collection of XML schemas and a spec
for an client-server based communication standard based on SOAP and
WSDL. I'm looking for advice and past experience on how to architect
this project and implement it properly. I'm fairly new with concepts
such as threading, ORM, etc in a server/client context. If anyone has
any past experience they'd like to contribute, architecture theory,
documentation, anything at all, I'd be very grateful.

You can find our project here:
(also feel more than welcome to join and help!)
http://www.openplans.org/projects/openwitsml/summary

Regards,
Kenneth Miller
[EMAIL PROTECTED]

--
http://mail.python.org/mailman/listinfo/python-list


Standard Equation Description Language?

2008-07-07 Thread xkenneth
Does anyone know of a standard inter-language syntax for describing
scientific/mathematical equations? Preferably something with parsers
in multiple libraries.

Regards,
Kenneth Miller
--
http://mail.python.org/mailman/listinfo/python-list


Emacs/Python Essentials?

2008-07-07 Thread xkenneth
What does everyone consider essential for emacs python dev?

Regards,
Ken
--
http://mail.python.org/mailman/listinfo/python-list


Newbie Question - Overloading ==

2008-03-31 Thread xkenneth
So i generally write quite a few classes, and in most I need to
overload the == operator.

If i have two classes, like below:

Class A:
attribute a
attribute b

Class B:
attribute a
attribute c

So if I've overloaded their respective __eq__ functions, and I want to
test whether or not the individual classes attributes are equal, the
code might look something like this:

class A:
def __eq__(self,other):
 return self.a == other.a and self.b == other.b

class B:
def __eq__(self,other):
return self.a == other.a and self.c == other.c

Now obviously, if I test an instance of either class equal to each
other, an attribute error will be thrown, how do I handle this? I
could rewrite every __eq__ function and catch attribute errors, but
that's tedious, and seemingly unpythonic. Also, I don't want an
attribute error thrown whenever two classes are compared that don't
have the same attributes.

I have a sneaky feeling I'm doing something completely unpythonic
here.

Thanks!

Regards,
Kenneth Miller

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie Question - Overloading ==

2008-03-31 Thread xkenneth
Yeah, this is what I'm talking about:

> def __eq__(self, other) :
>   try :
>      return <>
>   except AttributeError:
>      return False

That seems a bit nasty to me.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie Question - Overloading ==

2008-03-31 Thread xkenneth
On Mar 31, 3:42 pm, Amit Gupta <[EMAIL PROTECTED]> wrote:
> On Mar 31, 11:00 am, xkenneth <[EMAIL PROTECTED]> wrote:
>
> > Yeah, this is what I'm talking about:
>
> > > def __eq__(self, other) :
> > >   try :
> > >      return <>
> > >   except AttributeError:
> > >      return False
>
> > That seems a bit nasty to me.
>
> One thing about python (IMO); you can't just say this doesn't look
> good. You need to say: why do you think this is not good.
> To me, it appears a concise and local solution to your problem.

Yes it is, but it's also tedious and lengthy for should-be simple
statements.
-- 
http://mail.python.org/mailman/listinfo/python-list


Oilfield Applications: WITS AND WITSML

2008-04-25 Thread xkenneth
All,

If anyone has any interest in developing a bit of code for
generating WITS and WITSML in python, then drop me a line. I've
started a project on google apps, "PyWITS", and I plan to support both
WITS and WITSML through a set of standard libraries. I would really
appreciate help from other developers or input from anyone.

Drop me a line if you're interested.

Regards,
Kenneth Miller
--
http://mail.python.org/mailman/listinfo/python-list


Python Wiimote

2008-08-20 Thread xkenneth
All,

I've just recently started fiddling with my Wiimote using python
and PyBluez. I'm interested particular in getting the position IR
sensor data out of the Wiimote, but I'd like to develop a library that
let's you access all of it easily in an OO manner.  If anyone has any
interest in exploring this area please let me know.

Regards,
Ken
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list


Simple GUI design in Python

2008-10-05 Thread xkenneth
All,

I've posted some slides on my blog (xkenneth.blogspot.com)
detailing some simple ways to describe GUI apps in python. Please let
me know what you think.

Regards,
Kenneth Miller
--
http://mail.python.org/mailman/listinfo/python-list


Conversion from string to integer

2006-03-22 Thread xkenneth
Hi,

   I've been attempting to write a serial program in python. I talk to
a custom designed bit of hardware that sends me back groups that are 2
bytes in length. When i recieve them using either pySerial or USPP i'm
not sure how python interprets them. Both of the bytes should be
interpreted as one integer. I store each of the two bytes in a python
array. Here is an example of the data as printed in a terminal.

['\x1dz', '\xa8<', '\x89{', '}O', 'r\xaf', '\x83\xcd', '\x81\xba',
'\x00\x02', '\x00\x00', '\x00\x00', '\x00\x00']

As you can see it either chooses to represent one byte in hex or one in
ascii or both in hex etc. I'm just not sure how to get this into an
integer format.

Thanks for the help.

Regards,
Ken

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie: Print question

2006-03-22 Thread xkenneth
doesnt look like you're passing any data to the print statement,
shouldn't it be something like

print '%d' % 4

output:
4\n

-- 
http://mail.python.org/mailman/listinfo/python-list


Bitwise OR?

2006-03-24 Thread xkenneth
Why is 3500 | -67 equal to 3500 instead of -3567?

-- 
http://mail.python.org/mailman/listinfo/python-list


Wrapping LabVIEW and DAQmx Libraries for Python

2009-06-08 Thread xkenneth
All,

 I've started wrapping the DAQmx and other LabVIEW libraries for
python using ctypes. I really like doing some things in python and
other in LabVIEW, so I'd like to have the same functionality available
for both. I've hosted the tiniest bit of code (mostly just proof of
concept) on github. Let me know if anyone else would be interested in
this. I'd love some help hashing it out.

- Ken

http://github.com/erdosmiller/pydaqmx/tree/master
-- 
http://mail.python.org/mailman/listinfo/python-list