Re: string splitting

2006-10-17 Thread stefaan
> Anyone have any ideas?

l = "wisconsin_state.txt"
l.split(".")[0].split("_")[-1]

Explanation:
---
the split(".")[0] part takes everything before the "."

the split("_")[-1] part selects in the last element in the list of
substrings which are separated by "_"

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


Re: DAO and Access97 WHERE clause fails

2007-06-09 Thread stefaan
> I should point out that I don't do DAO (or ADO) -- and if I had to
> code Python to access JET, I'd probably hijack a copy of mxODBC in order
> to get a "sane" SQL interface.

I have successfully used the dejavu object-relational mapper (http://
projects.amor.org/docs/dejavu/1.5.0RC1/) to access MS ACCESS databases
recently.

Bestregards,
Stefaan.

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


Re: S2K DTS and Python

2007-07-10 Thread stefaan
> > However, I now want to update some tables in MSAccess, and it occurred
> > to me that because Sequel Server 2000 DTS can interface with scripting
> > languages that maybe I could call my first Python program from within
> > DTS and then update the tables using DTS. (I am learning DTS hence the
> > idea).

I have never heard about DTS, so I cannot advise you on that.
But since you mentioned MsAccess, I want to mention that I have
successfully used the DejaVu object relational mapper[1] to access
MsAccess
databases. Other ORMs like SqlObject and SqlAlchemy - to the best of
my knowledge -
do not support MsAccess out of the box (yet?).

[1] http://projects.amor.org/docs/dejavu/1.5.0RC1/

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


Re: (Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-18 Thread stefaan
> To make it short: Is there something like this already?

To keep it short: yes.
To make it longer: not sure about its status... i've never tried it
myself.
To make it short again: http://code.enthought.com/ets/

I also know some people are trying to create something called pyxides,
but
also there I am not sure about the status: http://pyxides.stani.be/

Best regards,
Stefaan.

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


XML based programming language

2007-03-18 Thread stefaan
Hello,

I have recently had to deal with an XML-based
programming language. (The programs are
generated programmatically.)

XML leads to a "two-level" parsing problem: first
parse the xml into tokens, then parse the tokens
to grasp their meaning (based on the semantics
of the programming language).

Basically, I used elementtree as a sophisticated "lexer" and wrote a
recursive descent parser to perform the semantic analysis and
interpretation.
(It works great.)

But I keep wondering: do parser generator tools
exist that I could have used instead of writing
the recursive descent parser manually ?

Best regards,
Stefaan.

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


Re: XML based programming language

2007-03-19 Thread stefaan
Thank you Diez for answering.
As far as I can see, it more or less corresponds to what I have.

But my question was perhaps more this:

"If elementtree is "lex", what is "yacc" ? "


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


Re: XML based programming language

2007-03-19 Thread stefaan
> Elementtree isn't lex. You are comparing apples and oranges here. Lex
> tokenizes, yacc creates trees. Both of is covered in XML itself - it's
> defined the tokenization and parsing, built into elementtree. So,
> elemnttree is lex _and_ yacc for XML. And if your language is written in
> XML, that's all there is to it.

I see your point. But yacc does more: I specify a grammar, and yacc
will
reject input files that do not conform to the grammar.
Elementtree OTOH will happily accept any valid XML file, all checking
has to
implememented manually by me.

Best regards,
Stefaan.

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


Re: XML based programming language

2007-03-19 Thread stefaan
> All of these are grammar-specifications that allow you to define the
> structure of your XML-documents with more constraints.

Ok, I should have foreseen the schema checker answer...my point really
is that
yacc can do even more than just checking the conformance to a grammar.

It also allows me to specify semantic actions,
e.g. to help in building an abstract syntax tree from
the concrete syntax tree, or to implement a very basic
interpreter...

mock example:



No schema checker can take this specification and simply output "22".
XSLT might be able to implement it, but it is complex for anything
real-life. Elementtree can immediately give me the concrete syntax
tree,
but any semantic actions have to be implemented during a
manually programmed tree traversal.

Anyway, it is not urgent for me, I have something which works,
it just seems like something's missing still from the
existing XML tool collection. Or I am being thick-headed ;)


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


Re: XML based programming language

2007-03-20 Thread stefaan
> Don't you think the lex/yacc combo is complex even in anything in
> real-life?
If real-life means: C++, then yes, it is impossible :)
If real-life means: some domain specific language, then it is ok.

>The "XML tree simplification implementations" (as Elementtree
> can be considered) has other complex tasks to do.

I fully agree. Perhaps I need a validating parser with user-definable
hooks for semantic actions. This would be a layer on top of
Elementtree.



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


Re: XML based programming language

2007-03-22 Thread stefaan
Thank you for all the answers!

Stefaan.


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


difflib.HtmlDiff

2007-01-13 Thread stefaan
Hello List,

I am using difflib.HtmlDiff and it provides great functionality.
Unfortunately it is too slow for my purpose.

Is anyone aware of an alternative ?
- a C-implementation lying around somewhere ?
- perhaps an external tool into which I can pipe my data ?

Intra-line differences are important for my task at hand.

Does it make sense performance-wise to use e.g. GNU diff to generate a
line-by-line diff, then
use SequenceMatcher to find intraline changes?

Google is my friend, but so far it didn't turn up much practical
results :s

Thanks for any insights you may share.
Stefaan.

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


storing setup.py (for py2exe) in other directory than main script directory

2008-01-04 Thread stefaan
Hello list,

I have the following problem after upgrading to python 2.5 and py2exe
0.6.6
It seems that py2exe is using the location of the setup.py file as its
search path, instead of the current
working folder. (This used to be different with an older version of
py2exe)

Can I tell py2exe somehow to use the current working directory as
search path instead of the location of the setup.py file ? Also: is
this a feature or a bug ?

The reason I am asking is because I'd like to keep the build scripts
in a "win32specific" subfolder of my code folder,
and then run the following command in the code folder:
python win32specific\setup.py py2exe

Alternative suggestions also welcome!

Best regards,
Stefaan.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Implicit initialization is EXCELLENT

2011-07-05 Thread Stefaan Himpe

Hello,

I agree with the contents of this post.

I see a similar problem with API's requiring to initialize all kinds of 
data using setters/properties instead of receiving it in the initializer 
(or constructor).



Python generally follows this design. Apart from files, I can't easily think
off the top of my head of any types that require a separate
open/start/activate call before they are usable.


database connections, network connections, spawning expensive 
processes/threads, things that benefit from lazy evaluation...



Now, I have an ulterior motive in raising this issue... I can't find the
original article I read! My google-fu has failed me (again...). I don't
suppose anyone can recognise it and can point me at it?


My sarcasm detector warns me not to add a link, although perhaps it's 
time for recalibration (after all, summer season started) :-)


Best regards,
Stefaan.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Implicit initialization is EXCELLENT

2011-07-06 Thread Stefaan Himpe



No! I was serious. I've spent *ages* trying to find the link to the
article... if you know it, please share.


Ok - I thought you were referring to some troll's rant with similar 
title. I'm probably way off, but were you referring to the RAII technique?


http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization




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


Re: list comprehension to do os.path.split_all ?

2011-07-28 Thread Stefaan Himpe

Hi,


[python 2.7] I have a (linux) pathname that I'd like to split
completely into a list of components, e.g.:
'/home/gyoung/hacks/pathhack/foo.py'  -->   ['home', 'gyoung',
'hacks', 'pathhack', 'foo.py']


Not sure what your exact requirements are, but the following seems to work:

pathname = '/home/gyoung/hacks/pathhack/foo.py'
print pathname[1:].split("/")

Note that this would only work for absolute linux paths (i.e. starting 
with "/").


Best regards,
Stefaan.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread Stefaan Himpe

Here's a mockup of the app I'm looking for: http://i52.tinypic.com/2uojswz.png

Which would you recommend?


You drew editra! http://editra.org/preview

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


Re: Python IDE/text-editor

2011-04-27 Thread Stefaan Himpe



Thanks for all the suggestions, glad I found the right one!


You're welcome :D
--
http://mail.python.org/mailman/listinfo/python-list


Re: Easiest framework to develop simple interactive web site in python?

2011-09-12 Thread Stefaan Himpe

The simplest one to learn is web2py http://www.web2py.com
No configuration needed, just unpack and get started.
It also has very good documentation and tons of little examples to get 
things done.


The other options you mentioned are good too :)

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


Re: Usefulness of the "not in" operator

2011-10-08 Thread Stefaan Himpe




So what is the usefulness of the "not in" operator ? Recall what Zen of
Python tells

There should be one-- and preferably only one --obvious way to do it.


the zen of python also says (amongst other things):

...
Readability counts.
...
Although practicality beats purity
...

Best regards,
Stefaan.

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


auto upgrade scripts?

2006-09-11 Thread stefaan . himpe
Hello list,

Is anyone aware of a (light-weight, easy-to-use)
auto-upgrade framework for python scripts?

I find it hard to believe no one has wanted this before,
yet google doesn't find too much relevant stuff.

Thanks,
Best regards,
Stefaan.

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


Re: auto upgrade scripts?

2006-09-12 Thread stefaan . himpe
> Auto-upgrade from what to what?
> -Larry Bates

Interesting question.

In my case I want my program to check for (e.g.) bug-fix releases on
some location (network drive or ftp), and if available, allow to
automatically download and install them.
Kind of like the AutoUpgrade functionality in .net (*shudder*) ;)

Best regards,
Stefaan.

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


Re: auto upgrade scripts?

2006-09-13 Thread stefaan . himpe
> Since you mention .NET and didn't state otherwise, I'm assuming
> Windows platform?

No, I need both linux and windows. I guess this means
I'll have to make something myself ...

Thanks, and best regards,
Stefaan.

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


Re: Pythonic way to determine if one char of many in a string

2009-02-16 Thread Stefaan Himpe

An entirely different approach would be to use a regular expression:

import re
if re.search("[abc]", "nothing expekted"):
   print "a, b or c occurs in the string 'nothing expekted'"

if re.search("[abc]", "something expected"):
   print "a, b or c occurs in the string 'something expected'"

Best regards,
Stefaan.
--
http://mail.python.org/mailman/listinfo/python-list


Re: p2exe for python 2.6

2008-10-22 Thread Stefaan Himpe

How can convert my python script in exe for the python version 2.6?


You must use a standalone executable builder like
* py2exe (Windows)
* py2app (Mac OS)
* PyInstaller (all platforms)
* cx_Freeze (Windows and Linux)
* bbFreeze (Windows and Linux)

Presumably you could use GUI2EXE [1] as a graphical front-end to these
tools (never tried this myself).

Best regards,
Stefaan.

[1] http://xoomer.alice.it/infinity77/main/GUI2Exe.html
--
http://mail.python.org/mailman/listinfo/python-list


Re: Building musical chords starting from (a lot of) rules

2008-11-15 Thread Stefaan Himpe

The costrunction of a chord is based on a root note and a structure,
so by default, giving just a note, it creates a major chord adding the
third and fifth note.


Quite some time ago I wrote something to solve the reverse problem: 
given a list of note names, find out a chord name. 
(http://chordrecognizer.sourceforge.net/ )


I used a look-up table to made a correspondence between the chord-name 
and the notes from which the chord is built. The notes are expressed as

a distance from the root note.

E.g. starting from a chromatic scale built on C, the distances would be:
C:0  C#:1  D:2  D#:3  E:4  F:5  F#:6  G:7  G#:8  A:9  A#:10  B:11
(and similar for flats, double sharps and double flats, ...)

Any chord thus can be constructed from a root note + the distance 
information.


example distance information:

 { 'm' : [ 0, 3, 7 ],# minor triad
   ''  : [ 0, 4, 7 ],# major triad
   '7' : [ 0, 4, 7, 10]  # etc...
...
 }

How does one e.g. construct the E7 chord from this information?

1. generate the chromatic scale starting from E, and annotate with note 
distance to root note:


E:0  F:1  F#:2  G:3  G#:4  A:5  A#:6  B:7  C:8  C#:9  D:10  D#:11

2. take the recipe for a '7' chord from the distance information:
[0, 4, 7, 10]

3. map the numbers from step 2. to the note names from step 1.: E G# B D

If you care about proper enharmonic spelling of the chord's note names 
(i.e. do  not confuse F# and Gb), you will need to add some extra 
information in the look-up tables or you need to pass extra information 
to the chord construction recipe at the moment of creating a chord, but 
that is left as an excercise to you - the interested reader ;)


HTH,
Stefaan.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Using Python after a few years of Ruby

2009-04-14 Thread Stefaan Himpe

Hi,


1) Is there anything like a Python build tool? (Or do I
even need something like that?)


If you're going to run the python source code, you don't need anything.
Python builds what it needs automagically. Some tools exist to build
stand-alone executables though, if you'd like to do so (e.g. py2exe, 
http://www.py2exe.org)



3) Web frameworks
I quite like the powerful and very intuitive and easy to use web2py 
(http://www.web2py.com).


(not to be confused with the minimalist web framework web.py, 
http://webpy.org).


Best regards,
Stefaan.
--
http://mail.python.org/mailman/listinfo/python-list


Re: html ui + py background? any tut?

2009-05-23 Thread Stefaan Himpe

Perhaps you want to investigate
pyjamas[1] and pyjamas-desktop[2]

[1] http://pyjs.org/
[2] http://pyjd.sourceforge.net/

Best regards,
Stefaan.
--
http://mail.python.org/mailman/listinfo/python-list


Re: html ui + py background? any tut?

2009-05-23 Thread Stefaan Himpe

Or maybe you are looking for something like nufox?
http://nufox.berlios.de/
--
http://mail.python.org/mailman/listinfo/python-list


Re: regarding SWIG

2008-07-22 Thread Stefaan Himpe

Hi..
I'm new to SWIG and need to create Wrapper for C code,
so, I have installed the SWIG already but doesnot know how to run it
for generating Interface file...


As far as I understand, SWIG will not generate an interface file for 
you. You have to write it yourself, to tell SWIG what parts of your API

you want to expose in python.

HTH,
Stefaan.
--
http://mail.python.org/mailman/listinfo/python-list


Re: I donä't get while-loops

2008-08-02 Thread Stefaan Himpe


def read2():
expr = ""
while expr != "quit":
expr = raw_input("Lisp> ")
print parse(expr)
read2()

^

print "Good session!"



You shouldn't call read2() inside read2()...
just remove that line and retry...

Each time you call read2() recursively, a
new expr is initialized to "", so the condition
never becomes true
--
http://mail.python.org/mailman/listinfo/python-list


Re: Profiling weirdness: Timer.timeit(), fibonacci and memoization

2008-08-02 Thread Stefaan Himpe

Nothing weird about this ...
The difference will become larger as your input value becomes larger.

You can easily understand why if you try to calculate fib(10) by hand,
i.e. work through the algorithm with pencil and paper,
then compare the work you have to do to the memoized version which just 
takes fib(9) and fib(8) from memory and adds them together.


Best regards,
Stefaan.
--
http://mail.python.org/mailman/listinfo/python-list


Re: raw_input on several lines

2008-08-02 Thread Stefaan Himpe



How can I change this behavior, so that another action is needed to stop the
input? For example, CTRL-G. It would allow the user to input several lines.



I don't think you can change raw_input's behaviour in this respect, but 
you could build something yourself that's based on interpretation of raw 
keyboard scan codes.


Google is your friend in this...

e.g. on Linux you could use something like urwid
e.g. on win32 you could use something like 
http://code.activestate.com/recipes/197140/


I am not aware of an os independent way to accomplish what you want.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Distribution of Python Scripts

2010-11-19 Thread Stefaan Himpe



So, what's my options.


Maybe this page can give some inspiration?
http://wiki.python.org/moin/deployment


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


Re: A web site using Python

2010-12-09 Thread Stefaan Himpe

1. Pick a web framework, I'd suggest looking at:


web2py: http://web2py.com - probably the easiest to install (no 
configuration needed) and learn. Suitable for both small and big 
projects. No worries when upgrading to a newer version as backward 
compatibility is an explicit design goal.


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


surprised by import in python 2.6

2010-12-10 Thread Stefaan Himpe

Hello list,

Recently someone asked me this question, to which I could not give an 
answer. I'm hoping for some insight, or a manual page. What follows is 
python 2.6.


The problem is with the difference between

from test import *

and

import test

First things first. Here's the code to test.py:

a = 3
def f():
   global a
   return a

Now, in the interactive interpreter:

>>> from test import *
>>> a
3
>>> f()
3
>>> a = 4
>>> f()
3

in a second session:

>>> import test
>>> test.a
3
>>> test.f()
3
>>> test.a = 4
>>> test.f()
4

Somehow, in the first session I cannot modify the global variable a 
returned from f, but in the second session I can. To my eye, the only 
difference seems to be a namespace. Can anyone shine some light on this 
matter?


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


Re: Reactive programming in Python ?

2010-04-16 Thread Stefaan Himpe



You can find more information on this project at www.yoopf.org.  Your
comments are more than welcome!


Is this something similar to trellis?
http://pypi.python.org/pypi/Trellis

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


Re: Only one forum app in Python?

2010-07-09 Thread Stefaan Himpe

Is Pocoo really the only solution available out there?

No. See e.g. http://www.pyforum.org/


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


Re: can python make web applications?

2009-08-23 Thread Stefaan Himpe

Deep_Feelings wrote:

can python make powerfull database web applications that can replace
desktop database applications? e.g: entrprise accounting
programs,enterprise human resource management programs ...etc


In addition to the recommendations by other people, I'd like to
recommend the very easy to learn and use web2py. (www.web2py.com).
--
http://mail.python.org/mailman/listinfo/python-list


Re: Spreadsheet-style dependency tracking

2010-10-21 Thread Stefaan Himpe

Florian Weimer wrote:


Are there libraries which implement some form of spreadsheet-style
dependency tracking?


The first that come to mind (I have very limited experience with them):

trellis http://peak.telecommunity.com/DevCenter/Trellis
pycells http://pycells.pdxcb.net/

Best regards,
Stefaan.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-10-09 Thread Stefaan A Eeckels
On Sat, 08 Oct 2005 22:39:38 GMT
Roedy Green <[EMAIL PROTECTED]> wrote:

> So from an aesthetic point of view, once people learn how it works,
> CSS lets sender and receiver compromise on what the message looks
> like. No other medium gives ANY control to the receiver about how a
> message is formatted.

My mail reader renders HTML as text. Usually, that gets the message
through without the impediments the sender included.
Of course one can render anything in one's computer exactly the way one
wants, given comptence and time. Mutual agreement on a CSS is possible,
but for widespread usage it  needs to be a standardised CSS, and then
we're back in the featuritis spiral. 

> One of the most important changes in the ability to select special
> fonts for the those without prefect vision and larger fonts.

That's exactly why I don't want people to muck with the presentation of
an email. I've set up my machine to render standard ASCII emails
execatly the way I want, with the font that I can read, in a size that
optimises ease and visible text. I don't care that someone would like
to inline a 5000x3000 JPEG from their 15 megapixel camera, or render
text in white on black, or any other silly format. If they want me to
see a document in _exactly_ the way they prepared it, let them use PDF.
It's there, and it works well.

> There is also the philosophical question. When my nephew sends me a
> message, do I have a right to warp his intent even if I don't like the
> aesthetics?  That is part of his message.

That question is answered above - if your nephew wants you to see
exactly what he produced, let him use the format specifically designed
for the purpose. And yes, philosophically speaking the recipient can do
anything they like with the message, including not reading it at all.
Anything else would be preposterous. 
 
> Should my email reader fix the spelling mistakes in the emails sent me
> by angry US soldiers?  Or is that part of the message?

If you want it to do that, yes. Wheter including the corrected message
in the reply is a good idea is another question (mostly related to how
the relation is, how it should be, and how big the soldier in question
is).

> There are three different issues getting muddled together:
> 
> 1. avoiding spam

Which happens to use HTML to obfuscate the message and avoid getting
caught by filters. 

> 2. making mail from well meaning but inept friends more readable.

Who happen to use HTML because they don't have a clue.

> 3. what constitutes a good general style for general correspondence.
> How should you use rich text appropriately.

Which happens to be largely superfluous as far as conveying intent is
concerned. 

Email works well without rich text, especially when combined with
attachments that use a format sender and recipient have agreed to. 
We don't need more, and we shouldn't assume that more complex
technology equates to an improvement. Example: it's not because we can
use a gazillion typefaces in pastel colours that documents that we
should do so. 

Take care,
-- 
Stefaan
-- 
As complexity rises, precise statements lose meaning,
and meaningful statements lose precision. -- Lotfi Zadeh 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-10-09 Thread Stefaan A Eeckels
On Sun, 9 Oct 2005 13:44:42 GMT
Tim Tyler <[EMAIL PROTECTED]>  wrote:

> In comp.lang.java.programmer Roedy Green
> <[EMAIL PROTECTED]> wrote or quoted:
> 
> > Read my essay.
> > http://mindprod.com/projects.html/mailreadernewsreader.html

It's gone :-)


> FYI, this bit: 
> 
> ``Like ICQ, someone cannot send you mail without your prior
> permission. They can't send you mail because they don't have your
> public key to encrypt the mail.''
> 
> ...is pretty confusing - because "public key" is a term with a
> technical meaning in cryptography - and a public key really *is*
> public.
> 
> If you want to allow email only from a list of senders, then you use
> a simple white list.  Cryptography is not needed or desirable if this
> is the intended goal.

But what is desirable is the possibility to authenticate the sender of
the message as genuine, given the ease with which SMTP headers can be
spoofed. Maybe this is suggested in Mr Green's essay, but
cryptographically signed email (using the originator's _private_ key),
where the signature and hence the originator of the mail can be verified
independently, would be very useful. The problem is to get everyone to
use digital signatures, and to ensure that such a signature can be
linked to an individual or business. I've no illusions here.

Take care,

-- 
Stefaan
-- 
As complexity rises, precise statements lose meaning,
and meaningful statements lose precision. -- Lotfi Zadeh 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-10-09 Thread Stefaan A Eeckels
On Mon, 10 Oct 2005 08:49:32 +1000
Steven D'Aprano <[EMAIL PROTECTED]> wrote:

> On Sun, 09 Oct 2005 19:28:31 +, Roedy Green wrote:
> 
> > What if I am sending diagrams to help someone repair
> > their computer? It is ridiculous to tie people's arms behind their
> > backs.  What you do instead is work to prevent abuse.  Captions in
> > and of themselves are not dangerous things.
> 
> I didn't say they were. Obviously you haven't been reading my emails,
> just reacting against them mindlessly. I use a mail client that gives
> me the choice of displaying or not displaying HTML emails. If there
> is no alternative to HTML, then I may _choose_ to render the HTML.

Norm Reitzel said it all a while ago:

"I don't understand that attitude.  Don't we want email that has dancing
 bears, cute little videos, musical tunes, animated waving hands, sixty
 fonts, and looks like it's been done with crayolas? Good grief, man,
 think like a three year old!" 

-- 
Stefaan
-- 
As complexity rises, precise statements lose meaning,
and meaningful statements lose precision. -- Lotfi Zadeh 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-10-14 Thread Stefaan A Eeckels
On Wed, 12 Oct 2005 22:04:14 GMT
Roedy Green <[EMAIL PROTECTED]> wrote:

> On Mon, 10 Oct 2005 00:42:18 +0200, Stefaan A Eeckels
> <[EMAIL PROTECTED]> wrote or quoted :
> 
> >"I don't understand that attitude.  Don't we want email that has
> > dancing bears, cute little videos, musical tunes, animated waving
> > hands, sixty fonts, and looks like it's been done with crayolas?
> > Good grief, man, think like a three year old!"
> 
> that excuse could also be used to explain why you have not cracked a
> book since high school.  The same tools that create dancing bears can
> do a UML diagram.

Mine doesn't. Stick figures is as far as it'll go.

Specific document formats can be attached to an email without any
problems. When exact rendering is important, the appropriate format
(e.g. PDF) can be used. Only a fool would want his email program to
render a UML diagram (which is far more than a cute drawing done in
Visio, in case you hadn't noticed).

-- 
Stefaan
-- 
As complexity rises, precise statements lose meaning,
and meaningful statements lose precision. -- Lotfi Zadeh 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python popenX() slowness on AIX?

2006-11-24 Thread Stefaan A Eeckels
On 24 Nov 2006 09:03:41 -0800
[EMAIL PROTECTED] wrote:

> Stefaan A Eeckels wrote:
> > On 21 Nov 2006 13:02:14 -0800
> > [EMAIL PROTECTED] wrote:
> >
> > > The fact that it does this in Python code instead of C is the main
> > > cause of the slowness.  So, unless Python is changed to do this
> > > in C, it's always going to be slow on AIX :-(
> >
> > I guess that the reason it's slow is that there are many
> > descriptors to try and close. Reducing them using ulimit -n could
> > improve the speed.
> >
> > AIX has a fcntl command to close all open file descriptors from a
> > descriptor onwards:
> >
> > fcntl(3, F_CLOSEM);
> >
> > This of course should be used instead of the loop:
> >
> > 10 happens to be the value of F_CLOSEM (from /usr/include/fcntl.h).
> > I've currently no access to an AIX system with Python, but it could
> > be worth trying.
> 
> Yes, very much worth it.  F_CLOSEM is _so_ much better than the loop,
> even in C.   Using your brilliant suggestion, I now have a simple
> patch to the python source that implements it for any OS that happens
> to have the fcntl F_CLOSEM option.   

The *BSDs and Solaris have "closefrom(3)" which does the same as
F_CLOSEM in AIX. As with AIX, the speedup is dramatic when there are a
lot of file descriptors to try and close.

> It is below in its entirety.  I believe I got the try: stuff correct,
> but since I'm new to Python, I'd appreciate any comments.

I'm no great Python specialist myself. I'll leave it to those better
qualified to comment.

> I have another patch to implement my os.rclose(x,y) method, which
> would improve the speed of popenX() for the OSes that don't have
> F_CLOSEM, by doing the close() loop in C instead of Python,  but I
> don't know if it would be as likely to be accepted as this probably
> would be.
> 
> Now, where do I send my proposed patch for consideration?

The README file in the Python distribution has the following to say:

Patches and contributions
---------

To submit a patch or other contribution, please use the Python Patch
Manager at http://sourceforge.net/patch/?group_id=5470.  Guidelines
for patch submission may be found at http://www.python.org/patches/.

Take care,

-- 
Stefaan A Eeckels
-- 
Never explain by malice what can be adequately explained by stupidity.
However:
Sufficiently advanced stupidity is indistinguishable from malice.
-- 
http://mail.python.org/mailman/listinfo/python-list