Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-27 Thread Michael L Torrie
On 10/27/2016 11:05 PM, Michael Torrie wrote:
> On 10/27/2016 04:07 AM, Terry Reedy wrote:
>> As I and others have said, those keyboard functions are not available on 
>> text terminals.  I predict that keyboard functions that so not work on 
>> all systems will never become built-ins.  But some are available with an 
>> import.

> Is this not what BartC is talking about?  

I see that BartC is wanting to detect keys like left shift and right
shift.  Even back in QB MS-DOS days when the program was running very
close to bare metal that wasn't possible using a QB construct.

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


Re: Code correctness, and testing strategies

2008-05-24 Thread Michael L Torrie
David wrote:
 Seriously, 10 hours of testing for code developed in 10 hours? What
 kind of environment do you write code for? This may be practical for
 large companies with hordes of full-time testing  QA staff, but not
 for small companies with just a handful of developers (and where you
 need to borrow somone from their regular job to do non-developer
 testing). In a small company, programmers do the lions share of
 testing. For programmers to spend 2 weeks on a project, and then
 another 2 weeks testing it is not very practical when they have more
 than one project.

Watch your programmers then.  They do have to write and debug the code.
 And they will spend at least as much or more time debugging as writing
the code.  It's a fact.  I have several programmers working for me on
several projects.  What you have been told is fact.  In my experience
it's 3-10x more time debugging as programming.  I've heard that *good*
programmers write, on average, 10 new lines of code per day.  I can also
verify that this is pretty accurate, both in my own programming
experience, and watching programmers working for me.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Zope/DTML Infuriating...

2008-05-01 Thread Michael L Torrie
Michael Torrie wrote:
 The second example, x = Integer.fromString('5') demonstrates a huge
 weakness in Java.  

Ahem.  Javascript.  Sorry.

-- 
Michael Torrie
Assistant CSR, System Administrator
Chemistry and Biochemistry Department
Brigham Young University
Provo, UT 84602
+1.801.422.5771

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

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


Re: Hi

2008-03-06 Thread Michael L Torrie
[EMAIL PROTECTED] wrote:
 Hello
 
 can u plz tell how to send and read msg from device(telit-863-GPS) and
 the coding is in python.
 
 if this can happen then plz send the source code to my mail account

Sounds like a new development model.  You should patent this.  Just
e-mail lists with cryptic requests for code, then combine the resulting
fragments into one executable.  In fact, if you do it in chain letter
form, you can get code even faster.  I heard a rumor once that's how
Windows Me was originally built.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Professional Grant Proposal Writing Workshop (April 2008: Vancouver, British Columbia)

2008-02-22 Thread Michael L Torrie
Anthony Jones wrote:
 The Grant Institute's Grants 101: Professional Grant Proposal Writing 
 Workshop 
 will be held in Vancouver, British Columbia, April 14 - 16, 2008. Interested 
 development professionals, researchers, faculty, and graduate students should 
 register as soon as possible, as demand means that seats will fill up 
 quickly. 
 Please forward, post, and distribute this e-mail to your colleagues and 
 listservs.

Not sure what this has to do with Python programming.  Can someone
please unsubscribe the list from these mailings?  Or if Anthony Jones is
reading this, unsubscribe python-list@python.org please!

thanks.

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


Re: Last 4 Letters of String

2008-02-21 Thread Michael L Torrie
Robert Rawlins - Think Blue wrote:
 Hello Guys,
 
  
 
 I'm looking for a function which will give me the last 4 characters of a
 given string. I'm sure it's a very simple task but I couldn't find anything
 of it.

Use the same technique as you'd use slicing a list.

http://www.diveintopython.org/native_data_types/lists.html

 
  
 
 Any ideas?
 
  
 
 Rob
 
 
 

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


Re: Client side GUI-like web framework ?

2008-02-04 Thread Michael L Torrie
USCode wrote:
 [EMAIL PROTECTED] wrote:
 You just described what XUL aims to be
 http://developer.mozilla.org/en/docs/The_Joy_of_XUL
 http://developer.mozilla.org/en/docs/XULRunner

 At present it lacks for sure documentation (or maybe it isn't
 organized really well)
 
 Just took a look at XUL and it in some ways describes what I was 
 thinking except it doesn't appear to deliver it's interface via a 
 browser/web server.  Then your application wouldn't be accessible via a 
 web browser through the internet.  The XUL application still appears to 
 only execute locally on the client machine?

But it is served up in the firefox web browser.  A good example is:

http://www.faser.net/mab/chrome/content/mab.xul

The UI always, by definition, has to run on the client.  This is true
whether you're talking about a non-web-based GUI, or an html form.  XUL
is no different.  XUL does blend client and server-side logic into a
stateful app.

 
 Also, personally I find having to describe your interface directly via 
 XML (XUL) is just plain ugly.

I agree completey.

 


-- 
Michael Torrie
Assistant CSR, System Administrator
Chemistry and Biochemistry Department
Brigham Young University
Provo, UT 84602
+1.801.422.5771

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


Re: Client side GUI-like web framework ?

2008-02-04 Thread Michael L Torrie
USCode wrote:
 Michael L Torrie wrote:
 But it is served up in the firefox web browser.  A good example is:

 http://www.faser.net/mab/chrome/content/mab.xul

 That's pretty slick, but unfortunately then you're locked into only the 
 Firefox web browser, which many folks don't use.  You're trading OS 
 lock-in for browser lock-in.

Which is a heck of lot better than OS lock in.  Of course you can use
xul-runner or something.  Gecko and XUL are both open source, so I'm not
quite sure what this lock in really is, though.


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


Re: Linux/Win32 func. to get Python instdir (not exedir) + site-packages = extensions mgmt

2008-01-20 Thread Michael L Torrie
pythonewbie wrote:
 Hi all,
 
 I am newbie in Python, my wish would be to create python applications
 for both Linux/Win32.
 
 I am stucked on creating a function to get the Python install
 directory (and site-packages directory) with a 100% reliable method...
 
 My goal is to verify if an/several extension(s) are installed and to
 automatically install the missing ones on Linux or Win32.
 
 I have tested sys.executable and sys.path, but I am not sure to be
 able to get what I need on different versions of Python and different
 platforms.
 
 Google was not a good friend on this, so I am very interested on how
 you implement such a function.

On both windows and Linux, installing stuff into the python install dir
requires root or administrative privileges, something most linux users
won't have unless they sudo.  So if the extensions you need are missing,
and you are distributing them yourself, why not just add them into the
path at runtime, rather than messing with the user's system?

As for obtaining the installation path, the setup.py that often comes
with python modules like ldaptor, seems to be able to figure it out.
I'd check there.  I think setup.py is created with distutils.


 
 Cheers.

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


Re: Mix different C source files into a single one

2007-12-29 Thread Michael L Torrie
Horacius ReX wrote:
 Hi,
 
 I have a C program split into different source files. I am trying a
 new compiler and for some reason it only accepts a single source file.
 So I need to mix all my different C source files into a single one.
 
 Do you know about some type of python script able to do this kind of
 task ?

No, but bash and friends can:

cat *.c  newfile.c

If you're stuck working with windows, the copy command can also
concatenate files.

After concatenating the files, editing the file to remove/merge #include
directives would work.  Any compiler that can only deal with a single
source file is of course extremely limited in what it can do, so this
manual process shouldn't be too bad for short programs (all that this
compiler can really deal with).

 
 Thanks

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


Re: More than one interpreter per process?

2007-12-17 Thread Michael L Torrie
sturlamolden wrote:
 Python has a GIL that impairs scalability on computers with more than
 one processor. The problem seems to be that there is only one GIL per
 process. Solutions to removing the GIL has always stranded on the need
 for 'fine grained locking' on reference counts. I believe there is a
 second way, which has been overlooked: Having one GIL per interpreter
 instead of one GIL per process.

How would this handle python resources that a programmer would want to
share among the threads?  What facilities for IPC between the
interpreters would be used?

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


Re: A Python 3000 Question

2007-10-29 Thread Michael L Torrie
brad wrote:
 Not complaining. len is simple and understandable and IMO fits nicely 
 with split(), strip(), etc... that's why I used it as an example, but 
 list(), etc. could be used as examples as well:
 
 a_string.list() instead of list(a_string)

This is a great example of why list() needs to be a singleton and *not*
a method of any particular class.  Consider the following contrived
object (yes object):

def foo():
for x in xrange(6):
yield x


If we eliminated list() as a first class singleton and forced it to be a
method call, how would it work with this generator object?  Right now I
can say:

mylist=list(foo())

Saying list() should be a method only of something iterable is not only
foolish, but wasteful.  Why should I burden every iterable object with
redundant code?  And how would you deal with generators in your scenario?

In short, making list() a method is wrong-thinking.  Reminds me of java.
 Ugg.

 
 And to answer the question. In OO programming generic functions
 are no less important than classes and objects.
 
 Do they not take away from the OOness of the overall language and 
 introduce inconsistencies?

If find Python to be more OO through and through than Java.  Once you
understand that functions are objects, and duck-typing, things like
len() being a function rather than a method make perfect sense.


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


Re: Pari Python

2007-10-28 Thread Michael L Torrie
Anton Mellit wrote:
 And I think (correct me if I am wrong) that the ^ operator (xor) is
 used very very infrequently. And it is not difficult to replace all ^
 with say ^^. The division is probably used more often, but python has
 this trend anyway - to replace division with 'true' division, so
 people should use // when they divide integers and expect an integer.

That's besides the point.  It *breaks* python, which is a problem.  How
can someone use your code with other third-party modules which may use
this operator?

 
 Other than these two things (the second one does not require
 recompilation, so it is not so bad probably) I don't need any changes
 to python core. I agree that a standard must be standard.

With that in mind, why not implement your shell layer using pypy (python
on python). That way you can have a full python parser that you can
modify to your hearts content, running on an unmodified cpython core.
Or implement your own parser using pyparsing.

Or how about this:  Implement a shell in python that uses regex to
replace and translate PariPython syntax into python syntax, and then
evaluate it on the unmodified core.

There's got to be some solution that doesn't break python.   Of course
really you would be (and are) creating a new language.  Call it
PariPython or something.  Make a new file extension so people don't
confuse it with python.  like .ppy or something.


 
 Anton

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


Re: tuples within tuples

2007-10-26 Thread Michael L Torrie
[EMAIL PROTECTED] wrote:
 On 26 Ott, 19:23, Dennis Lee Bieber [EMAIL PROTECTED] wrote:
(A,B,C,D)
 that could be
 ('tagA', None, [('tagB', None, ['bobloblaw], None)], None)
 C isn't a tuple in your example either. It is a one-element list
 (the single element INSIDE the list is a tuple whose third element is a
 list containing a non-terminated string -- so the entire structure is
 invalid)

 
 i'm not sure what u mean with the entire structure is invalid...
 that's exactly what I got while parsing...

Your structure is correct.  Dennis just didn't read all the matching
parens and brackets properly.

 
 


-- 
Michael Torrie
Assistant CSR, System Administrator
Chemistry and Biochemistry Department
Brigham Young University
Provo, UT 84602
+1.801.422.5771

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


Re: C++ version of the C Python API?

2007-10-21 Thread Michael L Torrie
Robert Dailey wrote:
 On 10/21/07, Martin v. Löwis [EMAIL PROTECTED] wrote:
 No, I literally meant that the Python C API is object-oriented.
 You don't need an object-oriented language to write object-oriented
 code.
 
 I disagree with this statement. C is not an object oriented language,
 and I've seen attempts to make it somewhat object oriented, however it
 failed miserably in readability and manageability overhead. However,
 this isn't the place to discuss such a thing so I've got nothing more
 to say than that.

Guess you haven't programmed in GTK+ on C, then.  Very heavy in
object-oriented programmin.  C++'s OOP stuff is just pure syntactic
sugar, nothing more, nothing less.

Python's OO nature is a bit deeper, since we're talking a dynamic
language.  Scheme, another dynamic language, is not inherently OO or
non-OO.  You can use it in either fashion.

 
 I do appreciate you taking the time to respond to my inquiry and offer
 a few C++ wrapper API's for the Python C API. Take care!

Any C++ version of the python API is by definition going to be a wrapper
around the C version.  Even the C version is a wrapper around the python
object model.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Cross-platform GUI development

2007-10-12 Thread Michael L Torrie
Alexandre Badez wrote:
 Personnaly, I use PyQt simply because I prefere Qt to Gtk, witch is
 much more integrated with all desktop than Gtk.
 In fact, your application in Qt on Mac, Win or Linux look like a
 native app.

Qt doesn't look very native on my desktop.  In fact, Qt apps have always
looked out of place on a Gnome desktop.

On Windows and Mac, no question, they look pretty native.  You do have
to take pains to make the app feel native, though.  Like follow the UI
guidelines of the platform,  etc.

 
 Just a question of feeling I think; because most of those GUI
 framework, offer quiet the same functionality.


 

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


Re: if then elif

2007-10-11 Thread Michael L Torrie
Michael L Torrie wrote:
 Which is exactly what he said.  

Haha.  Nevermind.  You're right.  A subtle distinction, isn't it.

He also said that what the poster
 probably wanted was
 
 if cal = 0 or fat =0
 
 

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


Re: if then elif

2007-10-10 Thread Michael L Torrie
[EMAIL PROTECTED] wrote:

 
 that's the most incorrect thing i've heard all day!
 
 if cal or fat = 0 is parsed as if (cal) or (fat = 0)

Which is exactly what he said.  He also said that what the poster
probably wanted was

if cal = 0 or fat =0

 

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


Re: list index()

2007-09-01 Thread Michael L Torrie
[EMAIL PROTECTED] wrote:
 In my case of have done os.listdir() on two directories. I want to see
 what files are in directory A that are not in directory B.
 I have used exceptions in other languages and only do so on logic that
 should never happen. In this case it is known that some of the files
 will not be in both lists. I just want to know which ones.
 

What's wrong, then, with doing:

if i in list:
   print list.index(i)

Since if, as you proposed, list.index() returned some value to represent
 not found, you'd require an if anyway.

This is probably not pythonic, but at least it would overcome your
exceptions excuse.

If we were to program this .index() method in some language that
enforces contracts, like haskell, then we'd say that .index() expects a
value that exists in the list.  So if you violate the contract, why
should you expect to *not* get an exception.  Doing it any other way,
though, makes the code a lot more error prone.

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


Re: list index()

2007-09-01 Thread Michael L Torrie
Alex Martelli wrote:

 is the one obvious way to do it (the set(...) is just a simple and
 powerful optimization -- checking membership in a set is roughly O(1),
 while checking membership in a list of N items is O(N)...).

Depending on a how a set is stored, I'd estimate any membership check in
a set to be O(log N).  That's if it's stored in a tree of some kind,
which you'd need to fast finding.  Say a balanced binary tree.  Worst
case, you'd have to search half of the elements to find what you were
looking for.

 
 
 Alex

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


Re: IDE for Python

2007-08-21 Thread Michael L Torrie
Ricardo Aráoz wrote:
 Hi,
   Do you know if for in-house development a GPL license applies? (Qt4
 and/or Eric4).

If your programs are used in-house and never released, then you don't
have to abide by the terms of the GPL.  BUT (this is a big but) if you
ever release your code or distribute the binary, you must now do so
under the terms of the GPL, because Qt is GPL'd and your use of Qt must
follow those terms.  Another huge caveat is that Qt's proprietary
license says that you can only use the proprietary Qt libraries for
programs that you developed from the beginning with the proprietary
libraries.  In other words, you can't develop a Qt application under the
GPL and link it against the GPL'd Qt libraries and then at a later date
buy Qt and try to relicense your program under something other than the
GPL.  Note that this has nothing to do with the GPL itself, but rather
the terms of the proprietary Qt license (Qt is dual-licensed).

 
 

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


Re: why psyco using more memery in liunx?

2007-08-17 Thread Michael L Torrie
kyo guan wrote:
 Hi all:
 
   When you import psyco in python2.5, you can see the memery grow up near 
 40MB in linux. but the same version python and
 psyco, is only grow up 1MB under windows. 

I have a hunch it's because of how the OS's are reporting shared memory
usage.  IE, the 1 MB increase under windows may not be altogether
truthful, and neither is the reported 40 MB on linux.  Memory usage is
tricky to judge on any modern OS, as shared libraries do increase the
apparent memory use by an application, but the libraries are shared with
other applications and OS components.

 
 kyo
 

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


Re: Any reason why cStringIO in 2.5 behaves different from 2.4?

2007-07-28 Thread Michael L Torrie
Stefan Scholl wrote:
 Don't let the subject line fool you. I'm OK with cStringIO. The
 thread is now about xml.sax's parseString().

Giving you the benefit of the doubt here, despite the fact that Stefan
Behnel has state this over and over again and you just haven't listened.

xml.sax's use of parseString() is exactly correct.  xml.sax should
*never* parse python unicode strings as by definition XML must be
encoded as a *byte stream*, which is what a python string is.

A python /unicode/ string could be held internally in any number of
ways, 2, 3, 4, or even 8 bytes per character if the implementation
demanded it (a bit contrived, I admit).  Since the xml parser is only
ever intended to parse *XML*, why should it ever know what to do with
python unicode strings, which could be stored any number of ways, making
byte-parsing impossible.

So your code is faulty in its assumptions, not xml.sax.

 
 

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


Re: code indentation

2007-07-26 Thread Michael L Torrie
[EMAIL PROTECTED] wrote:
 
 .so maybe if you can help me with this?

If I understand you correctly, you're trying to make a pretty-printer
in python, right?  Something that will take arbitrary python source
code, recognize the blocks and so forth, and then emit clean python code
(text) with tabs for indents instead of spaces?

 
 Regards,
 
 Vedran
 
 (http://www.v-programs.com)
 

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


Re: Slightly OT: Why all the spam?

2007-05-22 Thread Michael L Torrie
On Tue, 2007-05-22 at 09:08 +0200, bryan rasmussen wrote:
 Well two things I would suppose:
 
 1. relative popularity and volume of the group leads spammers to put
 more resources towards spamming the group.
 
 2. I seem to remember that python-list is also a usenet group?
 non-moderated, meaning it is tough to ban people?
 
 Actually, it would be nice to know if anybody has any good filters
 worked up that will work in Gmail for reading python-list.

It appears that people using nntp to read this list aren't seeing the
spam because the moderators expire the messages as they find them.
However, by then the messages have already hit the mailman gateway.
Thus you may want to consider reading c.l.p via nntp when at work.

Lately all the spams contain a url to a certain site, so you can
probably procmail filter based on that.  The spam does not appear to be
random-bot generated, but targeted spam by a single person or entity.
Which makes it easier to filter out.

 
 
 Cheers,
 Bryan Rasmussen
 
 
 


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


Re: Restart Linux System

2007-05-22 Thread Michael L Torrie
On Mon, 2007-05-21 at 09:25 +0100, Robert Rawlins - Think Blue wrote:
 Hello Guys,
 
  
 
 I’m looking to restart a Linux system from my python application.
 What’s the best way to achieve this, is there something in the OS
 module?

Probably not.  You need to just spawn the reboot command, or run init
6.  This requires root, though.  Without root there's no way to reboot
a linux system.

 
  
 
 Thanks,
 
  
 
 Rob
 
 
 -- 
 http://mail.python.org/mailman/listinfo/python-list

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

Re: Restart Linux System

2007-05-22 Thread Michael L Torrie
On Tue, 2007-05-22 at 09:34 -0700, Alexandre Gans wrote:
 
 You can use sudo on your user or the bit suid in your application...

Just know that you cannot setuid any shebang executable, of which python
scripts usually are.

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


Re: List Moderator

2007-05-21 Thread Michael L Torrie
On Mon, 2007-05-21 at 14:24 +, Grant Edwards wrote:
 
 To quantify things for curiosity's sake, I just scanned through
 the last 1000 postings in c.l.p.  There was exactly 1 spam
 message and two replies to spam messages complaining about
 them.

I'm seeing 2 messages a day, lately, to c.l.p that are blatant and a bit
rude spam (and some would argue this thread is spam), out of about
200-400 messages per day.  I just barely deleted one a moment ago, in
fact.  While that's not bad at all, my other mailing lists (gtk-list,
openldap, etc) all get 0 spam per day.  Also they are getting annoying
mainly because they seem so preventable.  They all have the same from
address.  If this was a normal mailinst list, the moderators could
unsubscribe that address and prevent it from subscribing again.  

I'm not at all sure how moderation is working here.  I am subscribed to
c.l.p exclusively through the mailman mailing list, so I don't ever use
the nntp part.  


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


Re: Python compared to other language

2007-05-21 Thread Michael L Torrie
On Mon, 2007-05-21 at 16:00 +0200, Marc 'BlackJack' Rintsch wrote:
 In [EMAIL PROTECTED],
 [EMAIL PROTECTED] wrote:
 
  Python is a strongly typed but dynamic language ...
  
  In the A few questions thread, John Nagle's summary of Python begins
  Python is a byte-code interpreted untyped procedural dynamic
  language with implicit declaration. 
  
  Is Python strongly typed or untyped?
 
 Strongly typed.

Most people think of statically typed, like Java, when they think of
Strongly typed.

Python is strongly, dynamically typed.  Some people refer to Python as
duck typed meaning that python cares more about what the object
appears to be, rather than it's actual type.  If it looks like a duck,
quacks like a duck, it must be a duck.  Thus python is more concerned
with the protocol of an object than the actual type.  This is a powerful
concept.  I've also found, though, that duck-typing can be a real
weakness when you're working with a complicated third-party library with
weak documentation.  You can't always infer what the method call is
expecting, even if you have the source code in front of you.  Figuring
out the python twisted I/O library, is fraught with such challenges,
despite the documentation.

 
 Ciao,
   Marc 'BlackJack' Rintsch
 

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


Re: Python and GUI

2007-05-21 Thread Michael L Torrie
On Mon, 2007-05-21 at 18:23 +0200, Petr Muller wrote:
 There's PyQt thingy, imho very good and easy to learn/use, but still 
 powerful. I've used it for a small gui-oriented project with almost no 
 problems and it worked like a charm. However, sometimes I had troubles 
 finding useful documentation for it.
 I've also tried to play with PyGTK, it's quite nice and easy (and you 
 have the advantage of Glade), but I don't like GTK way of creating GUI.
 I haven't used Tkinter a lot, only looked at it. And I didn't like it much.

How does GTK's way of creating the GUI (I presume you're not talking
look and feel) differ from Qt's?  From what I can see (having developed
large apps in both GTKmm and Qt (C++), they both function the same.  In
other words you create the widget first, then parent it in a container
and add callbacks. Whereas wxPython's approach is somewhat different. 

It appears that most wxPython apps setup the GUI programmatically,
whereas Most Qt and Gtk apps tend to use XML-based gui-building
factories.  In this latter case, Glade's method is quite different from
Qt's.

 
 I would really suggest PyQt. (with a big IMHO :)
 
 Petr

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


Re: Help in Placing Object in Memory

2007-03-27 Thread Michael L Torrie
On Tue, 2007-03-27 at 16:49 +0200, Diez B. Roggisch wrote:
  can two python script share a common object?
 
 What do you mean by that? They can both load a pickled object, yes. But they
 can't share it as a at-runtime object, where changes in one script are
 immediately are known to the other.

Remote procedure call, such as Python Twisted's PB library can allow
this to virtually be the case.

 
 To do such a thing, look at pyro.
 
 Diez

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


Re: Excellent Interview with Dennis D'Souza, full of laughs

2007-01-29 Thread Michael L Torrie
On Mon, 2007-01-29 at 15:47 -0800, [EMAIL PROTECTED] wrote:
 stuff
I know this is a useless gesture, but my normal tolerance for such
behavior has reached an end.

Please stop spamming this list with off-topic profanities.  Your
ramblings have nothing to do with programming in Python (this is a
computer-related group by the way) and grow tiresome.  I generally
tolerate occasional off-topic posts because they can be intelligent,
witty, diverting, and sometimes informative and educational.  However
your posts are none of these things.  There are plenty of forums out
there for you to vent your frustrations and express your beliefs and
opinions.  Kindly take your musings elsewhere, particularly when you
have to resort to using profanity to make up for your lack of elegant
expression and inability to argue a point, or even present a point.

Should this become more of a problem, I would vote in favor of moving
this newsgroup to being moderated.  In fact, I'd be in favor of shutting
down the newsgroup entirely and using the members-only mailing list
exclusively, although I know a number of people here would oppose that.

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


Re: PIL - Pixel Level Image Manipulation?

2006-11-08 Thread Michael L Torrie
On Wed, 2006-11-08 at 11:53 -0500, Gregory Piñero wrote:
 I want to be able to randomly change pixels in an image and view the
 results.  I can use whatever format of image makes this easiest, e.g.,
 gray scale, bit tonal, etc.
 
 Ideally I'd like to keep the pixels in an intermediate format like a
 list of (integers?) or an array and convert that to an image as
 needed.
 
 I'm hoping someone has some experience on this and could offer some
 advice or code.  I thought it would be easy in PIL  but I'm not sure.

What OS are you using and what GUI library?  These things are specific
to the GUI library you wish to use to display images, and not python
itself (which doesn't care).

 
 Much Appreciated,
 
 -- 
 Gregory Piñero
 Chief Innovation Officer
 Blended Technologies
 (www.blendedtechnologies.com)

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


Re: What is the cleanest way to for a module to access objects from the script that imports it?

2006-10-31 Thread Michael L Torrie
On Fri, 2006-10-27 at 14:53 -0700, [EMAIL PROTECTED] wrote:
 Hi,
 
 I am new to python and am currently writing my first application. One
 of the problems I quickly ran into, however, is that python's imports
 are very different from php/C++ includes in the sense that they
 completely wrap the imported script in a module object. One of the
 problems with this was that a plugin system that I am making requires
 use of objects, classes and the such from the original script. Thus, on
 one hand, I am hesitant to use execfile(), since I *do* want to wrap
 the plugin up, but on the other hand, I want the plugin to be able to
 use functions from the original script. Any ideas?

I have a system that uses modules as plugins also.  These are loaded
dynamically when the user specifies them from a gui.  I put all these
modules in an array using the __import__ function.  I found, though,
that I needed to specify whether or not each module had actually loaded,
or if there had been an exception (module not found or whatever).  So I
wrote a wrapper object that would try to load the module and store it as
a local attribute.  I made my wrapper object implement functions like
__getattr__ and pass any unknown calls into the module object itself,
making the wrapper object act as if it was the module, but having extra
capabilities, such as being able to tell me if the module had actually
loaded or not.

Michael


 
 Sincerely,
 Noam Samuel.
 

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


Re: building extensions for Windows Python

2006-10-13 Thread Michael L Torrie
On Fri, 2006-10-13 at 11:39 -0400, JW wrote:
 I have a lousy little Python extension, generated with the generous help
 of Pyrex.  In Linux, things are simple.  I compile the extension, link it
 against some C stuff, and *poof*! everything works.
 
 My employer wants me to create a Windows version of my extension that
 works with the vanilla Python 2.5 from python.org.
 
 My employment contract states that I won't be required to run Windows, and
 I desperately want to honor that clause. Ideally,  I'd somehow MinGw cross
 compile like I do with C/C++ and *poof*!, out would pop a file I could
 hand out to someone who wanted to import my_lousy_extension.

I took a very simple pyrex file that compiled and worked fine on linux
and built it for windows using my mingw cross compiler.  

First I borrowed a complete windows python installation and stuck it on
my linux drive (in my case in /usr/i386-pc-mingw32/Python2.4.

Then I just did:

$ pyrex test.pyx

$ i386-pc-mingw32-gcc -o test.dll test.c -I/usr/i386-pc-
mingw32/include/python2.4 -mwindows -shared -lpython24 -L/usr/i386-pc-
mingw32/Python2.4/lib

Since there were no special windows libraries used, there were no code
changes required at all.  So look into the mingw cross compiler.
Usually you have to build it yourself.  see
http://www.torriefamily.org/~torriem/cross for more information.  The
information on the windows target is in the second half of the document.
This document used the OS X as the build host, but the same steps work
on linux.  I prefer to use /usr/local or /usr as my prefix (ending up
with /usr/local/bin/i386-pc-mingw32-gcc etc)

Michael


 
 In Windows, things aren't so simple.  I'm immediately bedazzled by a vast,
 unfamiliar nomenclature: VC6, VC7.1, msvcrt, msvcr71, msvcr80,
 VS2005, VS2007, MSVC2003, MSVC2005, Express Edition, .NET SDK,
 etc. 
 
 The python.org recommended compiler is apparently no longer
 available, but someone posted a link to an obscure Microsoft webpage
 artifact where it could still be obtained.  Running it under WINE is less
 than ideal, but I decided to try and make it work.  However, when I tried
 installing the compiler, it failed because my Internet Explorer [was] out
 of date.  I'm not sure how IE comes into the picture, but I'm just a
 programmer, after all.
 
 I am further confused by the python.org docs on using MinGw to build
 extensions:  These instructions only apply if you're using a version of
 Python prior to 2.4.1 with a MinGW prior to 3.0.0, but further on:
 pcexports python25.dll python25.def seems to contradict that.  It
 really makes no difference.  The referenced webpage where the pcexports
 tool is found seems defunct.
 
 My main problem is that I don't really grasp the big picture.  Can someone
 give me an overview of the requirements to build extensions for Windows
 Python, circa 2.5?  Or, can I tell my employer she'll just have to
 hire/contract a Windows expert to do the mud wrestling?
 
 Jim Wilson
 Gainesville, FL

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