Re: editor for Python on Linux

2006-02-19 Thread F. Petitjean
Le Sun, 19 Feb 2006 21:33:59 +0100, Rene Pijlman a écrit : > Mladen Adamovic: >>I wonder which editor or IDE you can recommend me for writing Python >>programs. > > vi I beg to disagree :-) Use ed "Ed is the standard text editor." http://www.gnu.org/fun/jokes/ed.msg.html -- http://mail.python.

Re: Komodo - Will it Lock Me In?

2006-02-18 Thread F. Petitjean
Le Fri, 17 Feb 2006 18:14:26 -0800, Trent Mick a écrit : > > Nope. Komodo adds no goo to your code (TM). > TM's my name, not a trademark on "Komodo adds no goo to your code" -- > but I'm thinking about it. :) +1 JOTW (Joke of the week) > > Cheers, > Trent > -- http://mail.python.org/mailman/listin

Re: GDI in python>?

2006-02-18 Thread F. Petitjean
Le 17 Feb 2006 22:02:23 -0800, al pacino a écrit : > hi, > > is it possible to address the 'screen pixels' using python , like > analogous to older dos( functions that graphics.h provides') or win api > calls for gdi. Some possibilities (all on Win32 only): ctypes by Thomas Heller venster (uses ct

Re: Python 2.4 under WinXP, free VC71 toolkit and VC6 libraries

2005-09-27 Thread F. Petitjean
Le Tue, 27 Sep 2005 17:48:47 +0200, Berthold Höllmann a écrit : > I have wrapped some inhouse libraries for Python. How ? Directly coding C code ? > The development team > uses VC6 and DF6.1 for development of these libraries under WinXP. DF6.1 is Digital FORTRAN 6.1 ? > I > would like to wrap the

Re: Pointers and ctypes

2005-08-29 Thread F. Petitjean
Le 29 Aug 2005 06:19:17 -0700, [EMAIL PROTECTED] a écrit : > Hello, > i've got a problem with pointers in the following function which i want > to use: > > I16 __stdcall DO_ReadPort (U16 CardNumber, U16 Port, U32 *Value) > > The function is supposed to read out the status of a digital port of > ana

Re: J-Integra for COM (Java COM interoperability)

2005-07-18 Thread F. Petitjean
Le 18 Jul 2005 13:39:41 -0700, [EMAIL PROTECTED] a écrit : snip > > J-Integra for COM Features: snip > > For a free evaluation, visit our website at > http://j-integra.intrinsyc.com/ > > Regards, > > Shane Sauer Q: What are the Vikings singing in the background ? A: Spam, spam, spam ! -- htt

Re:

2005-07-01 Thread F. Petitjean
Le Fri, 01 Jul 2005 20:47:45 +0200, Andreas Kostyrka a écrit : about C++ templates > And they are a kind of "compile-time" late binding. You get the worst > from both worlds. All the complication of a static typing system, and at > the same time no safety. +1 QOTW -- http://mail.python.org/mailma

Re: map vs. list-comprehension

2005-06-29 Thread F. Petitjean
Le Wed, 29 Jun 2005 09:46:15 + (UTC), Mandus a écrit : > Hi there, > > inspired by a recent thread where the end of reduce/map/lambda in Python was > discussed, I looked over some of my maps, and tried to convert them to > list-comprehensions. > > This one I am not sure how to conver: > > Given

Re: turn text lines into a list

2005-06-27 Thread F. Petitjean
[En-tête "Followup-To:" positionné à comp.lang.python.] Le Mon, 27 Jun 2005 14:27:28 -, Grant Edwards a écrit : > On 2005-06-27, Xah Lee <[EMAIL PROTECTED]> wrote: >> i have a large number of lines i want to turn into a list. >> In perl, i can do >> >> @corenames=qw( >> rb_basic_islamic >> sq1_

Re: os.system(cmd) isn't working

2005-06-23 Thread F. Petitjean
Le Thu, 23 Jun 2005 01:19:11 -0500, Paul Watson a écrit : > "Gregory Piñero" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > Hi guys, > > I'm trying to run this statement: > > os.system(r'"C:\Program Files\Mozilla Firefox\firefox.exe"' + ' > "www.blendedtechnologies.com"') > > The

Re: Package organization

2005-06-22 Thread F. Petitjean
Le Wed, 22 Jun 2005 20:42:24 +0200, Thomas Lotze a écrit : > Hi, > > I've two questions concerning organizing and naming things when writing > a Python package. > > Assume I have a package called PDF. Should the classes then be called > simply File and Objects, as it is clear what they do as th

Re: how to use more than 1 __init__ constructor in a class ?

2005-06-22 Thread F. Petitjean
Le 22 Jun 2005 11:44:09 -0700, [EMAIL PROTECTED] a écrit : > You also could use a list to represent your data, then you get more > dimensions supported, e.g: > import math > class Point: > def __init__(self, *args): > self.points = list(args) > > def dist(x, y): > if len(x

Re: What is different with Python ?

2005-06-13 Thread F. Petitjean
Le Mon, 13 Jun 2005 07:53:03 -0400, Roy Smith a écrit : > Python let's you concentrate on the real universal > fundamentals of data structures, algorithms, and control flow without > getting bogged down in details. +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

Re: __init__.py in packages

2005-06-08 Thread F. Petitjean
Le Wed, 08 Jun 2005 10:34:38 -0500, Gary Wilson Jr a écrit : > I'm creating a python package foo. > > What is intended use for __init__.py files? > Well, I found this: http://www.python.org/doc/essays/packages.html >>From what I can gather it is for initialization of the package when doing an > im

Re: decimal and trunkating

2005-06-02 Thread F. Petitjean
Le Thu, 02 Jun 2005 19:59:08 +1000, Timothy Smith a écrit : > i want to trunkate 199.999 to 199.99 round(199.999, 2) # 2 digits after the decimal point > do i really have to use floats to do this? 19.999 is a float : type(19.999) is float # ==> True -- http://mail.python.org/mailman/listin

Re: eric3 question

2005-05-30 Thread F. Petitjean
Le Tue, 31 May 2005 03:13:31 +0400, Alexander Zatvornitskiy a écrit : > Hello All! > > I'am using eric3 IDE under win32 (snapshot 2005-04-10), and have a trouble. I > use this code: > print "enter q to quit, or smthing else to continue" > while not sys.stdin.readline()=="q": > smth

Re: what is addMethod ?

2005-05-23 Thread F. Petitjean
Le 23 May 2005 02:40:57 -0700, [EMAIL PROTECTED] a écrit : > Hello, > >I saw some python open source project with many > self.addMethod() functions (with 3 paramters) Which "open source project" ? Which class in which module ? > > What does self.addMethod() is good for ? > Find where this m

Re: firebird and unicode

2005-05-23 Thread F. Petitjean
Le Mon, 23 May 2005 09:30:31 GMT, flupke a écrit : > It's like jumping over a fence with barb wire. > You know your balls might be in danger but > sometimes you got to take a risk :) +1 QOTW > > I hope i don't end up singing with a funny voice ;) -- http://mail.python.org/mailman/listinfo/pyth

Re: os.popen vs os.system

2005-05-17 Thread F. Petitjean
Le Tue, 17 May 2005 13:50:08 -0400, rbt a écrit : > Is it more appropriate to use os.popen or os.system on a windows XP > client? Nope. use the subprocess module :-) Microsoft had the great idea to embed white space inside a lot of directories (compare C:\Program Files\ to /usr/bin ) which mean

Re: Can get reference of a part of a list?

2005-05-12 Thread F. Petitjean
Le Fri, 13 May 2005 00:58:49 +0800, flyaflya a écrit : > I want make a 2-D array from a list,all elements is references of > list's,like this: > a = [1,2,3,4] > b = [ [1,2], [3,4] ] > when change any elements of a, the elements of b will change too, so I > can use some function for list to chang

Re: Python Documentation (should be better?)

2005-05-11 Thread F. Petitjean
Le Wed, 11 May 2005 15:58:04 -0400, rbt a écrit : > Christopher J. Bottaro wrote: > Because PHP is such a 'thrown together' and 'bolted-on' language. If it > didn't have *outstanding* documentation (which it does BTW), no one > could even begin to understand how they got from a little HTML langua

Re: Trouble saving unicode text to file

2005-05-09 Thread F. Petitjean
Le Mon, 09 May 2005 08:39:40 +1000, John Machin a écrit : > On Sun, 08 May 2005 19:49:42 +0200, "Martin v. Löwis" ><[EMAIL PROTECTED]> wrote: > >>John Machin wrote: >>> Martin, I can't guess the reason for this last suggestion; why should >>> a Windows system use iso-8859-1 instead of cp1252? >> >

Re: Shell Commands in Python Code

2005-05-07 Thread F. Petitjean
Le Sat, 7 May 2005 08:55:35 -0700 (PDT), Sara Khalatbari a écrit : > There are a lot of commands that I need to use in my > code & I don't know how to do it > > Is there a way to use shell commands in Python code? Python is a scrpting language. So you can substitute most shell scripts idioms with

Re: get file modification time in mm/dd/yyyy format?

2005-05-07 Thread F. Petitjean
Le 7 May 2005 08:23:48 -0700, [EMAIL PROTECTED] a écrit : > Using Python 2.4 on Windows, for me the command > > print os.stat("temp.txt")[stat.ST_MTIME] > > gives > > 1115478343 , > > which is "seconds since the epoch". How can I get the modification time > in a format such as > > 05/07/2005

Re: sorting list and then return the index of the sorted item

2005-05-03 Thread F. Petitjean
Le 3 May 2005 06:37:14 -0700, custard_pie a écrit : > I need help sorting a list...I just can't figure out how to sort a list > and then return a list with the index of the sorted items in the list > for example if the list I want to sort is [2,3,1,4,5] > I need [2,0,1,3,4] to be returned > Can som

Re: Python or PHP?

2005-04-23 Thread F. Petitjean
Le Sat, 23 Apr 2005 19:11:19 +0200, Fredrik Lundh a écrit : > in PHP, good programmers are able to write bad programs without > even noticing. +1 QOTW --- The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense. Dr. E.W. Dijkstra -- http://mail.pyth

trying to understand unicode

2005-04-20 Thread F. Petitjean
Python has a very good support of unicode, utf8, encodings ... But I have some difficulties with the concepts and the vocabulary. The documentation is not bad, but for example in reading http://docs.python.org/lib/module-unicodedata.html I had a long time to figure out what unicodedata.digit(unichr

Re: XML-RPC -- send file

2005-04-19 Thread F. Petitjean
Le 19 Apr 2005 11:02:47 -0700, codecraig a écrit : > Experient I have been :) > > Here is what I am getting now > > CLIENT > --- > d = xmlrpclib.Binary(open("C:\\somefile.exe").read()) open the file with mode "rb" fin = open(r'C:\somefile.exe', 'rb') contents = fin.read() fin.close()

Re: packages

2005-04-18 Thread F. Petitjean
Le Mon, 18 Apr 2005 20:29:39 +0200, Mage a écrit : >Hello, > > I read about modules and packages in the tutorial. I think I understand > how to use packages and modules, even I know how to create a module (as > far I understand it's a simple .py) file , but I don't know how can I > create

Re: distutils question: different projects under same namespace

2005-04-17 Thread F. Petitjean
Le 16 Apr 2005 01:20:34 -0700, Qiangning Hong a écrit : > To avoid namespace confliction with other Python packages, I want all > my projects to be put into a specific namespace, e.g. 'hongqn' package, > so that I can use "from hongqn.proj1 import module1", "from > hongqn.proj2.subpack1 import modu

Re: module to parse "pseudo natural" language?

2005-04-17 Thread F. Petitjean
Le Sun, 17 Apr 2005 13:38:09 +0200, Andrew E a écrit : > Hi all > > I've written a python program that adds orders into our order routing > simulation system. It works well, and has a syntax along these lines: > > ./neworder --instrument NOKIA --size 23 --price MARKET --repeats 20 > > etc > >

Re: preallocate list

2005-04-13 Thread F. Petitjean
Le Wed, 13 Apr 2005 16:46:53 +0100, Jim a écrit : > > What I really want is a Numeric array but I don't think Numeric supports > importing files. Numeric arrays can be serialized from/to files through pickles : import Numeric as N help(N.load) help(N.dump) (and it is space efficient) > > Jim --

Re: Doubt regarding sorting of a list specific field

2005-04-13 Thread F. Petitjean
Le Wed, 13 Apr 2005 01:13:40 -0600, Steven Bethard a écrit : > praba kar wrote: >> list = [[1234,'name1'],[2234,'name2'],[0432,'name3']] >> >> I want to sort only numeric value having array field. >> How I need to do for that. > > In Python 2.4: > > py> import operator > py> seq = [(1234,'name1

Re: How to name Exceptions that aren't Errors

2005-04-07 Thread F. Petitjean
Le 7 Apr 2005 19:23:21 GMT, Leo Breebaart a écrit : > I've recently become rather fond of using Exceptions in Python to > signal special conditions that aren't errors, but which I feel > are better communicated up the call stack via the exception > mechanism than via e.g. return values. > > For in

Re: check interpreter version before running script

2005-04-05 Thread F. Petitjean
Le Tue, 05 Apr 2005 08:57:12 -0400, rbt a écrit : > Is there a recommended or 'Best Practices' way of checking the version > of python before running scripts? I have scripts that use the os.walk() > feature (introduced in 2.3) and users running 2.2 who get errors. > Instead of telling them, 'Upg

Re: that is it is not it (logic in Python)

2005-04-01 Thread F. Petitjean
Le Fri, 01 Apr 2005 17:42:30 -0500, Jeremy Bowers a écrit : > On Fri, 01 Apr 2005 22:01:25 +0000, F. Petitjean wrote: > >> Le Fri, 1 Apr 2005 13:39:47 -0500, Terry Reedy a écrit : >>> This is equivalent to '(that is it) and (it is not it)' which is clearly >

Re: that is it is not it (logic in Python)

2005-04-01 Thread F. Petitjean
Le Fri, 1 Apr 2005 13:39:47 -0500, Terry Reedy a écrit : > > "F. Petitjean" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>>>> iterable = range(10) >>>>> it = iter(iterable) >>>>> that = iter(it) &g

that is it is not it (logic in Python)

2005-04-01 Thread F. Petitjean
I want to know if iter(iterator) returns always its argument (when argument is an iterator) So : >>> iterable = range(10) >>> it = iter(iterable) >>> that = iter(it) >>> that is it True# Good! >>> that is it is not it False # What ? >>> >>> Python = map(bool, it) >>> logic = True >>> logic i

Re: Problem in designing a global directory in python

2005-03-29 Thread F. Petitjean
Le 29 Mar 2005 09:50:46 -0800, Tian a écrit : > I want to create a object directory called Context in my program, which > is based on a dict to save and retrieve values/objects by string-type > name. I have the definition like this: > > utils.py > > global sysctx # you are in

Re: Pattern matching from a text document

2005-03-24 Thread F. Petitjean
Le 24 Mar 2005 06:16:12 -0800, Ben a écrit : > > Below is a few sample lines. There is the name followed by the class > (not important) followed by 5 digits each of which can range 1-9 and > each detail a different ability, such as fitness, attacking ability > etc. Finally the preferred foot is st

Re: metaclass error

2005-03-17 Thread F. Petitjean
Le 17 Mar 2005 12:27:07 -0800, [EMAIL PROTECTED] a écrit : > dear readers, > > i have a very simple package organized as follows: > > !-! > bgp/ > __init__.py > managers/ > __init__.py > ManagerInterface.py > Test

Re: code for Computer Language Shootout

2005-03-16 Thread F. Petitjean
Le Tue, 15 Mar 2005 23:21:02 -0800, Michael Spencer a écrit : > Jacob Lee wrote: >> On Tue, 15 Mar 2005 21:38:48 -0800, Michael Spencer wrote: >> >> Good call. >> >> > > How about this then: > > basetable = string.maketrans('ACBDGHKMNSRUTWVYacbdghkmnsrutwvy', > 'T

Re: why this error?

2005-03-15 Thread F. Petitjean
Le Wed, 16 Mar 2005 17:53:57 -0500, spencer a écrit : > Hi, > I'm not sure why I can't concatenate dirname() with basename(). > > Traceback (most recent call last): > File "showDir.py", line 50, in ? > print 'somthing new...', os.path.join(os.path.dirname(os.getcwd)) + > os.path.basename(os.

Re: Iterate using tuple as index

2005-03-10 Thread F. Petitjean
Le Thu, 10 Mar 2005 13:12:31 -0800, James Stroud a écrit : > Hello, > > Its not obvious to me how to do this. I would like to iterate using a tuple > as > an index. Say I have two equivalently sized arrays, what I do now seems > inelegant: > > for index, list1_item in enumerate(firstlist): >

Re: Is there a short-circuiting dictionary "get" method?

2005-03-09 Thread F. Petitjean
Le Wed, 09 Mar 2005 09:45:41 -0800, Dave Opstad a écrit : > In this snippet: > > d = {'x': 1} > value = d.get('x', bigscaryfunction()) > > the bigscaryfunction is always called, even though 'x' is a valid key. > Is there a "short-circuit" version of get that doesn't evaluate the > second argume

Re: autoexecution in Windows

2005-03-07 Thread F. Petitjean
Le Mon, 07 Mar 2005 13:25:35 -0700, Earl Eiland a écrit : > How does one make a Python program auto-execute in Windows? > > Earl > write a virus ? :-) What do you mean by « auto-execute » ? Regards -- http://mail.python.org/mailman/listinfo/python-list

Re: starting windows program from python based on file extension ?

2005-03-03 Thread F. Petitjean
Le 3 Mar 2005 02:53:51 -0800, [EMAIL PROTECTED] a écrit : > Hi everybody, > > I used python to build a HTML file and now I would like to > automatically start my browser to display this file. I guess I could > use os.system(), but then I had to specify a specific path to the > browser. > > I wond

Re: changing __call__ on demand

2005-02-14 Thread F. Petitjean
Le Sun, 13 Feb 2005 13:19:03 -0500, Hans Nowak a écrit : > Stefan Behnel wrote: >> Hi! >> >> This somewhat puzzles me: >> >> Python 2.4 (#1, Feb 3 2005, 16:47:05) >> [GCC 3.3.4 (pre 3.3.5 20040809)] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >> >> .>>> c

Re: newbie: Syntax error

2005-02-04 Thread F. Petitjean
Le Fri, 4 Feb 2005 12:49:51 -0600, Chad Everett a écrit : > Hi Everyone, > > I am new to Python and programming in general. I bought the book "Python > Programming for the Absolute Beginner" by michael Dawson. > > I am trying to make a coin flip program and keep geting a Synax Error > "invalid s

Re: Python's idiom for function overloads

2005-02-01 Thread F. Petitjean
Le Tue, 01 Feb 2005 12:10:47 +0100, Philippe Fremy a écrit : > >> Frequently, in Python, code which checks for types, rather than >> checking for features, ends up being excessively restrictive and >> insufficiently general. > snip > > Enforcing types also brings the benefit that the program is

Crude statistics on the standard library

2005-01-31 Thread F. Petitjean
I have written a script to find the modules which export the largest number of names. The gc.getreferrers(*objs) function gives also an idea of the dependencies between the modules. The code (statsmod.py) : #!/usr/bin/env python # -*- coding: latin-1 -*- """ statsmod.py module rudimentaire de

Re: Dynamic class methods misunderstanding

2005-01-28 Thread F. Petitjean
Le Fri, 28 Jan 2005 10:20:30 -0500, Bill Mill a écrit : > Hello all, > > I have a misunderstanding about dynamic class methods. I don't expect > this behavior: > > In [2]: class test: >...: def __init__(self, method): >...: self.method = method >...: self.method()

Re: a sequence question

2005-01-28 Thread F. Petitjean
Le Fri, 28 Jan 2005 13:59:45 GMT, Chris Wright a écrit : > Hi, > > 1) I want to iterate over a list "N at a time" > > > Is there a nifty way to do with with list comprehensions, > or do I just have to loop over the list ? > > cheers and thanks seq = xrange(1, 9) # an iterable [1, 2, ... 8] N

Re: import problems *newbie*

2005-01-14 Thread F. Petitjean
Le 13 Jan 2005 21:58:36 -0800, mike kreiner a écrit : > I am having trouble importing a module I created. I'm running PythonWin > on Windows XP if that helps. I saved my module in a folder called > my_scripts in the site-packages directory. I edited the python path to > include the my_scripts folde

Re: Tkinter Puzzler

2005-01-07 Thread F. Petitjean
Le 07 Jan 2005 05:28:31 EST, Tim Daneliuk a écrit : > I am trying to initialize a menu in the following manner: > > for entry in [("Up", KeyUpDir), ("Back", KeyBackDir), ("Home", KeyHomeDir), > ("Startdir", KeyStartDir), ("Root", > KeyRootDir)]: > > func = entry[1] > UI.ShortBtn.menu.

Re: Why tuples use parentheses ()'s instead of something else like <>'s?

2004-12-30 Thread F. Petitjean
On Thu, 30 Dec 2004 15:58:07 GMT, Roel Schroeven wrote: > Rocco Moretti wrote: >> So to summarize: >> >> Commas define tuples, except when they don't, and parentheses are only >> required when they are necessary. >> >> I hope that clears up any confusion. > > You have my vote for QOTW. > +1 :-

Re: python metrics program/script sample

2004-12-27 Thread F. Petitjean
On Mon, 27 Dec 2004 12:09:16 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote: > Philippe C. Martin wrote: >> I am looking for an eric3/linux compatible alternative to checking code >> metrics (ex: true lines of code count) > > I don't know what "eric3/linux compatible" might be, I'm not sure > what

Re: More elegant way to cwd?

2004-12-27 Thread F. Petitjean
On Mon, 27 Dec 2004 11:53:57 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote: > Kamilche wrote: >> Is there a more elegant way to change the working directory of Python > > That depends on how you define "elegant", I guess. > >> to the directory of the currently executing script, and add a folder >