Re: MS SQL Server/ODBC package for Python

2005-04-15 Thread Simon Brunning
On 4/15/05, Graham <[EMAIL PROTECTED]> wrote: > Thanks Simon > I have just installed mxODBC and tried one of their samples. > Am getting an error on trying to import mx.ODBC > > ImportError: No module named mx.ODBC > > After the install the mx folder has been place in my C:\Program Files\Plon

Dr. Dobb's Python-URL! - weekly Python news and links (Apr 18)

2005-04-18 Thread Simon Brunning
QOTW: "Darn. I finally say something that gets into Quote of the Week, and it's attributed to someone else!" -- Greg Ewing (we think) http://groups-beta.google.com/group/comp.lang.python/msg/15b836a557afccb2 "If there were something wrong with the API, Guido would have long since fired up the

Re: Why does python class have not private methods? Will this never changed?

2005-04-19 Thread Simon Brunning
On 4/19/05, could ildg <[EMAIL PROTECTED]> wrote: > Python is an oop language, Yes. > Private stuff always makes programming much easier. That contention is, at best, debatable. See http://groups-beta.google.com/group/comp.lang.python/msg/b977ed1312e10b21. -- Cheers, Simon B, [EMAIL PROTECTED]

Dr. Dobb's Python-URL! - weekly Python news and links (Apr 18)

2005-04-19 Thread Simon Brunning
QOTW: "Darn. I finally say something that gets into Quote of the Week, and it's attributed to someone else!" -- Greg Ewing (we think) http://groups-beta.google.com/group/comp.lang.python/msg/15b836a557afccb2 "If there were something wrong with the API, Guido would have long since fired up the

Re: [Python-Dev] How do you get yesterday from a time object

2005-04-19 Thread Simon Brunning
On 4/19/05, Ralph Hilton <[EMAIL PROTECTED]> wrote: > i'm a beginning python programmer. > > I want to get the date for yesterday > > nowTime = time.localtime(time.time()) > print nowTime. > oneDay = 60*60*24 # number seconds in a day > yday = nowTime - oneDay # <-- generates an error > print yd

Re: Proposal: an unchanging URL for Python documentation

2005-04-20 Thread Simon Brunning
On 4/19/05, Skip Montanaro <[EMAIL PROTECTED]> wrote: > ... the documentation for the os > steve> module would also be available at > steve> http://python.org/doc/current/lib/module-os.html. > > Time machine at work? The above URL works for me now. Yup, but it's not all unchanging. Take,

Re: goto statement

2005-04-20 Thread Simon Brunning
On 4/20/05, praba kar <[EMAIL PROTECTED]> wrote: >In Python what is equivalent to goto statement http://docs.python.org/tut/node6.html See, it's those dratted node numbers again. ;-) -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/m

Re: goto statement

2005-04-20 Thread Simon Brunning
On 4/20/05, Maurice Caret <[EMAIL PROTECTED]> wrote: > > other equivalents are in > > http://docs.python.org/tut/node10.html I also missed , for the while statement. Those URLs just keeg getting better... -- Cheers, Simon B,

Re: goto statement

2005-04-20 Thread Simon Brunning
On 4/20/05, Maxim Kasimov <[EMAIL PROTECTED]> wrote: > it would be quite useful for debuging porposes How does goto help you to remove bugs? I can certainly see how it helps you put them in in the first place... -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ --

Re: goto statement

2005-04-20 Thread Simon Brunning
On 4/20/05, Maxim Kasimov <[EMAIL PROTECTED]> wrote: > WOW, just greate! ... but i'd like to relax at some more interesting way than > to comment each of rows Get a decent text editor. -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mai

Re: building a small calculator

2005-04-20 Thread Simon Brunning
On 20 Apr 2005 05:18:17 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Now once the user has select a shape and typed in the lengths required, > the result is printed and the program quits. What I want to do is make > the program display the result and then make it wait for the user to > pre

Re: building a small calculator

2005-04-20 Thread Simon Brunning
On 20 Apr 2005 05:31:15 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I get the following error message when using the command sys.exit(). > > name 'sys' is not defined. You really are new at this, aren't you? ;-) You need to import the sys module before you use it. Put this at the top of

Re: building a small calculator

2005-04-20 Thread Simon Brunning
On 20 Apr 2005 05:41:37 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Sorry. This is my first day using Python. Nothing to apologise for. We were all new to Python once. > Is there an equivelent to the goto command? I want to find some way to > take the user back to the main menu. Funny

Re: goto statement

2005-04-20 Thread Simon Brunning
On 4/20/05, Maxim Kasimov <[EMAIL PROTECTED]> wrote: > > Or, if you really like the spirit of goto, > > use "if 0:". > > ... and add tabs to each string Get a decent text editor. What are you using? Notepad? -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- ht

Re: goto statement

2005-04-20 Thread Simon Brunning
On 4/20/05, Christos TZOTZIOY Georgiou <[EMAIL PROTECTED]> wrote: > If you need more help, I would gladly send you the output of `man vi' > from a non-GNU Unix. I can also send you the output of `man vim' from a > GNU system. It'll probably be easier to convince Guido to introduce a 'goto' statem

Re: Using Jython in Ant Build Process

2005-04-21 Thread Simon Brunning
On 4/21/05, Maurice LING <[EMAIL PROTECTED]> wrote: > I am looking for a way to use Jython in Ant build process. I have some > pure Python scripts (not using any C extensions) that I'll like to > incorporate into Java using Jython. I heard that this can be done but > you can I set up Ant to do this

Re: Dictionary question.

2005-04-21 Thread Simon Brunning
On 21 Apr 2005 02:47:42 -0700, hawkesed <[EMAIL PROTECTED]> wrote: > I am semi new to Python. Here is my problem : I have a list of 100 > random integers. I want to be able to construct a histogram out of the > data. So I want to know how many 70's, 71's, etc. I can't figure out > how to do this.

Re: XML parsing per record

2005-04-21 Thread Simon Brunning
On 4/21/05, Willem Ligtenberg <[EMAIL PROTECTED]> wrote: > Sorry I just decided that I want to use your solution, but I am wondering > is cElemenTree in expat or is that something different? Nope, cElemenTree is very much its own man. See . -- Cheers, Si

Re: recording data between [ and ]

2005-04-21 Thread Simon Brunning
On 4/21/05, rbt <[EMAIL PROTECTED]> wrote: > string.between(data,[,]) def between(data, start, end): return re.findall(re.escape(start) + r'([^]]*)'+ re.escape(end), data) foo = '''stuff [lsass.exe] [System] more stuff x [firefox.exe] .. ''' print between(foo, '[', ']') -- C

Re: Run Unix shell command $ parse command line arguments in python

2005-04-22 Thread Simon Brunning
On 21 Apr 2005 23:39:03 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Kindly suggest me some ideas/comments. Why don't you make a start, and come back to us with whatever problems you encounter? We're happy to help, but we aren't going to do it for you. Andrew Dalke's "Wrapping command-li

Re: Noobie Question: Using strings and paths in mkdir (os.mkdir("/test/"a))

2005-04-22 Thread Simon Brunning
On 4/22/05, Roman Neuhauser <[EMAIL PROTECTED]> wrote: > > import os > > a = 'books' > > os.chdir( '/test') > > os.mkdir("/test/"a) > > > > the last line does not seem to work. os.mkdir(a) makes the directory > > books, but i want this directory as a subdirectory of test. > http://docs.python.

Re: Run Unix shell command $ parse command line arguments in python

2005-04-22 Thread Simon Brunning
On 22 Apr 2005 03:16:02 -0700, hue <[EMAIL PROTECTED]> wrote: > Thanks for your reply > > I started writing the script.. I have gone through documentation for > getopt (snip) Good start. I tend to prefer optparse over getopt these days, but if you've got it working the way you want it, you shoul

Dr. Dobb's Python-URL! - weekly Python news and links (Apr 25)

2005-04-25 Thread Simon Brunning
QOTW: "Sure, but what about the case where his program is on paper tape and all he has for an editor is an ice pick?" - Grant Edwards "And in this case, you get improved usability *and* improved speed at the same time. That's the way it should be." - Fredrik Lundh The Simplest Possible Metac

Re: Changing a line in a text file

2005-04-26 Thread Simon Brunning
On 4/25/05, Kirk Job Sluder <[EMAIL PROTECTED]> wrote: > In addition, I would argue that editing a file in place using a > non-interactive program is dangerous and bad practice in general. By > the time you find a bug in your edit script, the original is lost. This > is something I learned from b

Dr. Dobb's Python-URL! - weekly Python news and links (Apr 25)

2005-04-26 Thread Simon Brunning
QOTW: "Sure, but what about the case where his program is on paper tape and all he has for an editor is an ice pick?" - Grant Edwards "And in this case, you get improved usability *and* improved speed at the same time. That's the way it should be." - Fredrik Lundh The Simplest Possible Metac

Re: Can .py be complied?

2005-04-29 Thread Simon Brunning
On 28 Apr 2005 07:01:50 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > IMO the fact that so many people ask > > "How can I create executables in Python on Windows" > > indicates that standard "batteries included" Windows Python > distribution is missing a vital battery. It indicates to *m

Re: Self-awareness of imported modules? Do they know where they live?

2005-12-15 Thread Simon Brunning
The only self aware Python scripts that I'm aware are the timbot and the effbot. Their sources are available from the PSU website at -- http://mail.python.org/mailman/listinfo/python-list

Re: Why and how "there is only one way to do something"?

2005-12-15 Thread Simon Brunning
On 12/15/05, Steve Holden <[EMAIL PROTECTED]> wrote: > Aahz wrote: > > python -c 'import this' > > Faster: > >python -m this So, there's two ways to do it. ;-) -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mailman/listinfo/pyth

Re: Overlapping Regular Expression Matches With findall()

2005-12-15 Thread Simon Brunning
On 15 Dec 2005 12:26:07 -0800, Mystilleef <[EMAIL PROTECTED]> wrote: > I want a pattern that scans the entire string but avoids > returning duplicate matches. For example "cat", "cate", > "cater" may all well be valid matches, but I don't want > duplicate matches of any of them. I know I can filter

Re: getopt and options with multiple arguments

2005-12-19 Thread Simon Brunning
On 19 Dec 2005 02:29:41 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I want to be able to do something like: > > myscript.py * -o outputfile > > and then have the shell expand the * as usual, perhaps to hundreds of > filenames. But as far as I can see, getopt can only get one argument > wi

Re: How to create linked list automatically

2005-12-19 Thread Simon Brunning
I haven't the time (or inclination) to sort out all your problems here, but one thing jumps out at me: On 12/19/05, Shahriar Shamil Uulu <[EMAIL PROTECTED]> wrote: > class Node: > def __init__(self,name=None,next=None): > self.name=name > self.next=next > > def __str__(self

Re: Is 'everything' a refrence or isn't it?

2006-01-04 Thread Simon Brunning
On 4 Jan 2006 10:54:17 -0800, KraftDiner <[EMAIL PROTECTED]> wrote: > I was under the assumption that everything in python was a refrence... (snip) > Have I misunderstood something? Yup. The concept if a reference is, I find, sometimes an unhelpful one in Python. Reset your brain -

Re: making objects unassignable "read-only" (especially when extending)

2006-01-18 Thread Simon Brunning
On 18 Jan 2006 11:59:23 GMT, Johannes Zellner <[EMAIL PROTECTED]> wrote: > Hi, > > can I make an object read-only, so that > > x = new_value > > fails (and x keeps it's orginal value)? This works for me: http://groups.google.com/group/comp.lang.python/msg/2b1785397358ff90 -- Cheers, Simon B,

Re: testing array of logicals

2006-07-13 Thread Simon Brunning
On 12 Jul 2006 11:14:43 -0700, John Henry <[EMAIL PROTECTED]> wrote: > Is there a more elagant way of doing this? > > # logflags is an array of logicals > test=True > for x in logflags: >test = test and x > print test min(logflags) I feel dirty now. ;-) -- Cheers, Simon B, [EMAIL PROTECTED]

Re: Accessors in Python (getters and setters)

2006-07-13 Thread Simon Brunning
On 10 Jul 2006 05:51:02 -0700, mystilleef <[EMAIL PROTECTED]> wrote: > I decided to change the name of an attribute. Problem is I've used the > attribute in several places spanning thousands of lines of code. If I > had encapsulated the attribute via an accessor, I wouldn't need to do > an unreliab

Re: Accessors in Python (getters and setters)

2006-07-13 Thread Simon Brunning
On 7/13/06, Simon Brunning <[EMAIL PROTECTED]> wrote: > Something like this any use to you? Or this, about a squillion times cleaner: class MyClass(object): def _get_bad_name(self): warn('"bad_name" deprecated. Please refer to "good_name&qu

Re: testing array of logicals

2006-07-13 Thread Simon Brunning
On 13 Jul 2006 05:45:21 -0700, John Henry <[EMAIL PROTECTED]> wrote: > > Simon Brunning wrote: > > > > min(logflags) > > > > !!! Be aware that not only is this an outrageous misuse of min(), it's also almost certainly much less efficient than /F's s

Re: running python from a memory stick?

2006-07-13 Thread Simon Brunning
On 7/13/06, John Salerno <[EMAIL PROTECTED]> wrote: > Is there a way to 'install' and use Python on a memory stick, just as > you would on any computer? I use Windows, and I know the installation > does things with the registry, so probably I couldn't use the executable > file to install it. But is

Re: bay area based - python guru..

2006-07-13 Thread Simon Brunning
On 7/13/06, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Maybe the right thing to ask back is: how much do you pay? And possibly; *which* bay? ;-) -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Coding style

2006-07-17 Thread Simon Brunning
On 17 Jul 2006 08:56:34 -0700, PTY <[EMAIL PROTECTED]> wrote: > Which is better? > > lst = [1,2,3,4,5] > > while lst: > lst.pop() > > OR > > while len(lst) > 0: > lst.pop() How about: lst = [1,2,3,4,5] while lst: lst.pop() Or even just: lst = [] ;-) -- Cheers, Simon B, [EMAIL PROTECT

Re: mkdir

2006-07-18 Thread Simon Brunning
On 18 Jul 2006 05:45:48 -0700, westymatt <[EMAIL PROTECTED]> wrote: > I have been looking around for a while, but I haven't seen many > examples of os.mkdir() > Anybody have any experience with it, is a since deprecated function? Example here - - but it reall

Re: Python linker

2006-07-18 Thread Simon Brunning
On 18 Jul 2006 08:01:22 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I develop shareware applications that need to be extremely slim (less > than 1 MB is preferable). > > Delphi applications easily meet this requirement and I can expect end > users to download the .NET framework (if they d

Re: New SourceForge project: Diet Python!!!

2006-07-19 Thread Simon Brunning
On 19 Jul 2006 02:34:09 -0700, Simon Hibbs <[EMAIL PROTECTED]> wrote: > I was reading an article about the One Laptop Per Child initiative the > other day, and being a Python fan I wondered if there are any plans to > put Python on it, or at least make it available. A cut-down version of > python,

Re: How do I pass a list to a __init__ value/definition?

2006-07-25 Thread Simon Brunning
On 25 Jul 2006 05:46:55 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Let me start with my disclaimer by saying I'm new to computer > programming and have doing it for the past three weeks. I may not be > completely correct with all the jargon, so please bear with me. > > Anyways, I'm writ

Re: Newbie Q: Class Privacy (or lack of)

2006-07-26 Thread Simon Brunning
On 7/26/06, Steve Jobless <[EMAIL PROTECTED]> wrote: > If I was working on a large project with many engineers, I'd assume > someone will do things like this sooner or later. I've seen many > horrendous code in my life and I have no control over who I work with. If you work with cowboys, not P

Re: Problem with readlines() and uml

2006-07-26 Thread Simon Brunning
On 26 Jul 2006 04:55:37 -0700, wscrsurfdude <[EMAIL PROTECTED]> wrote: > Sorry it is so hot in here, I make mistakes, I meant it to be an xml > file. But still sthe same problem Check out elementtree - . -- Cheers, Simon B, [EMAIL PROTECTED], http://www.

Re: Writting to file from file and printing using python

2006-07-28 Thread Simon Brunning
On 7/28/06, atanas Cosmas Nkelame <[EMAIL PROTECTED]> wrote: > Hi, > I have a task to write a program that will do the following. > > 1. Run from the command line Check out the optparse module for this. > 2. Get data from a text file (say data.t

Re: Suppressing banner on interactive startup?

2006-07-28 Thread Simon Brunning
On 7/27/06, Tim Chase <[EMAIL PROTECTED]> wrote: > 2) is there a way to change the two prompts from ">>>" and "..." > to other options? Namely, again with the TTS option, something > that is more TTS friendly than hearing "greater-than greater-than > greater-than". The "dot dot dot" isn't nearly

Re: opposite of import

2006-08-03 Thread Simon Brunning
On 3 Aug 2006 04:50:35 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi > I am new to python. I wanted to know if there is an opposite of "import" Err, depends upon what you mean by opposite. If you want to remove the module from a namespace into which you imported it, you can do that wi

Re: opposite of import

2006-08-03 Thread Simon Brunning
On 8/3/06, Simon Brunning <[EMAIL PROTECTED]> wrote: > If you want to remove the module from a namespace into which you > imported it, you can do that with del: > > import amodule > amodule.afunction() # Works fine > > del amodule > amodule.afunction() # Will die n

Re: Datetime question

2006-08-03 Thread Simon Brunning
On 8/3/06, Rama <[EMAIL PROTECTED]> wrote: > But wont this create a new object? Whereas if you want to modify the same > object, should we not be using replace? Or does it not matter in the global > picture? datetime objects are immutable. You can't change the value of an existing datetime object,

Re: opposite of import

2006-08-03 Thread Simon Brunning
On 8/3/06, Gerhard Fiedler <[EMAIL PROTECTED]> wrote: > Is that guaranteed, or is that just until the garbage collector has removed > the module (at some arbitrary point)? I *think* it's guaranteed. It's not a matter for the garbage collector. GC only exists to remove cyclic references. Ordinary

Re: opposite of import

2006-08-03 Thread Simon Brunning
On 8/3/06, John Salerno <[EMAIL PROTECTED]> wrote: > According to Python in a Nutshell, references are stored in the > dictionary sys.modules, but I'm not sure if it matters that it's not > __modules__ instead (unless that also exists). Right you are - it's sys.modules, not sys.__modules__. -- C

Re: Datetime question

2006-08-03 Thread Simon Brunning
On 8/3/06, Rama <[EMAIL PROTECTED]> wrote: > Just curious why when > I call id(a) I get the same id after I call the replace method. In your example, you called a's replace() method, but did nothing with the new datetime object that it returned. The original object, a, naturally still has the same

Re: where i can find this module

2006-08-03 Thread Simon Brunning
On 8/3/06, enas khalil <[EMAIL PROTECTED]> wrote: > first i want to subscribe on this list Go to . > i have a question , i run a script which uses module as follows > import ag > > but got the error : > > ImportError: No module named ag

Re: trouble understanding inheritance...

2006-08-16 Thread Simon Brunning
On 16 Aug 2006 12:53:12 -0700, KraftDiner <[EMAIL PROTECTED]> wrote: > I can see that this might work... > c = [a, b] > for c in [a,b]: >c.getName() > > but when does baseClass ever get used? > Why did i even have to define it? Well, quite. -- Cheers, Simon B, [EMAIL PROTECTED], http://www.b

Re: how do you get the name of a dictionary?

2006-08-23 Thread Simon Brunning
On 23 Aug 2006 09:29:40 -0700, jojoba <[EMAIL PROTECTED]> wrote: > And what im saying is that isnt it silly that we need pass an entire > namespace, when a much simpler notion would be to have each object know > its own name(s) (even if that name doesnt exist). > Now, here's where everyone tells me

Re: How do I read Excel file in Python?

2006-10-05 Thread Simon Brunning
On 5 Oct 2006 10:25:37 -0700, Matimus <[EMAIL PROTECTED]> wrote: > > the date( 8/9/2006 ) in Excel file, i am getting the value as 38938.0, > > which I get when I convert date values to general format in Excel. I > > want the actual date value. How do get that? > > 38938 appears to be the date in d

Re: How do I read Excel file in Python?

2006-10-05 Thread Simon Brunning
On 10/5/06, Simon Brunning <[EMAIL PROTECTED]> wrote: > On 5 Oct 2006 10:25:37 -0700, Matimus <[EMAIL PROTECTED]> wrote: > > > the date( 8/9/2006 ) in Excel file, i am getting the value as 38938.0, > > > which I get when I convert date values to general format

Re: How do I read Excel file in Python?

2006-10-06 Thread Simon Brunning
On 5 Oct 2006 12:49:53 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Actually was about to post same solution and got same results. (BTW > Simon, the OP date is Aug 9th, 2006). Scratched head and googled for > excel date calculations... found this bug where it treats 1900 as leap > year in

Re: A Universe Set

2006-10-16 Thread Simon Brunning
On 10/16/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > You're at the mercy of the comparison machinery implemented by individual > classes. Plus, if you put a wildcard object into a set (or use it as a dictionary key) you'll confuse yourself horribly. I know I did. ;-) -- Cheers, Simon B

Re: Need a strange sort method...

2006-10-16 Thread Simon Brunning
On 16 Oct 2006 11:13:08 -0700, SpreadTooThin <[EMAIL PROTECTED]> wrote: > I have a list and I need to do a custom sort on it... > > for example: > a = [1,2,3,4,5,6,7,8,9,10] #Although not necessarily in order > > def cmp(i,j): #to be defined in this thread. > > a.sort(cmp) > > print a > [1,4,7,10,

Re: Need a strange sort method...

2006-10-16 Thread Simon Brunning
On 10/16/06, Simon Brunning <[EMAIL PROTECTED]> wrote: > >>> a = [1,2,3,4,5,6,7,8,9,10] > >>> a.sort(key=lambda item: (((item-1) %3), item)) > >>> a > [1, 4, 7, 10, 2, 5, 8, 3, 6, 9] Re-reading the OP's post, perhaps sorting isn't what'

Re: string splitting

2006-10-16 Thread Simon Brunning
On 16 Oct 2006 12:12:38 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello, > I have thousands of files that look something like this: > > wisconsin_state.txt > french_guiana_district.txt > central_african_republic_province.txt > > I need to extract the string between the *last* underscore

Re: Looking for assignement operator

2006-10-17 Thread Simon Brunning
On 10/17/06, Alexander Eisenhuth <[EMAIL PROTECTED]> wrote: > Hello, > > is there a assignement operator, that i can overwrite? Soirry, no, assignment is a statement, not an operator, and can't be overridden. -- Cheers, Simon B [EMAIL PROTECTED] http://www.brunningonline.net/simon/blog/ -- http

Re: Dictionaries

2006-10-18 Thread Simon Brunning
On 18 Oct 2006 08:24:27 -0700, Lad <[EMAIL PROTECTED]> wrote: > How can I add two dictionaries into one? > E.g. > a={'a:1} > b={'b':2} > > I need > > the result {'a':1,'b':2}. >>> a={'a':1} >>> b={'b':2} >>> a.update(b) >>> a {'a': 1, 'b': 2} -- Cheers, Simon B [EMAIL PROTECTED] http://www.brunn

Re: invert or reverse a string... warning this is a rant

2006-10-20 Thread Simon Brunning
On 20 Oct 2006 09:34:55 -0700, Istvan Albert <[EMAIL PROTECTED]> wrote: > Yes, that's where the big bucks are, the Palindrome Industry. > > It is the shortsightedness of the Python core developers that keeps the > palindrome related functions and algorithms out of the standard library +1 QOTW --

Re: help with my first use of a class

2006-10-20 Thread Simon Brunning
On 10/20/06, James Stroud <[EMAIL PROTECTED]> wrote: > > I don't really have formal programming training, but it is increasingly > becoming my experience that OOP is but one ingredient in a good program. > It can be left out or it can be mixed with other ingredients for a nice > effect. Indeed. Py

Re: cross-linked version of the python documentation

2006-10-20 Thread Simon Brunning
On 10/20/06, tom arnall <[EMAIL PROTECTED]> wrote: > Is there a cross-linked version of the python documentation available? Is > anyone interested in starting a project for such? What do you mean by cross-linked? -- Cheers, Simon B [EMAIL PROTECTED] http://www.brunningonline.net/simon/blog/ --

Re: Py3K idea: why not drop the colon?

2006-11-13 Thread Simon Brunning
On 11/11/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Hendrik van Rooyen wrote: > > >> blue is red or green or yellow > > > > *grin* - this can be construed as a weakness in Python - > > it's boolean logic, and it's incompatible with human use of the same > terms in all contexts, not just Python.

Re: explicit self revisited

2006-11-13 Thread Simon Brunning
On 11/13/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > I suppose that in his view, language advocacy is a zero-sum game, so > > positive comments about Python can be considered as FUD against his own > > project. He's even invented his own del.icio.us tag for this purpose: > > > > http:/

Re: regexp questoin

2006-06-11 Thread Simon Brunning
On 9 Jun 2006 17:44:42 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > actually, i am doing an application that allows user to delete files by > entering an input pattern. If you are looking to match filenames, you might want to have a look at the fnmatch and glob modules. The patterns that

Re: joining NoneType and DateTimeType

2006-06-14 Thread Simon Brunning
On 14 Jun 2006 03:43:39 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > i have some databse results that are NoneType and DateTimeType. now i > have trouble > joining these row results together like "|".join(result) as it says > cannot join NoneType , DateTimeType . How can i change these typ

Re: Numerics, NaNs, IEEE 754 and C99

2006-06-14 Thread Simon Brunning
On 14 Jun 2006 10:33:21 -0700, Sébastien Boisgérault <[EMAIL PROTECTED]> wrote: > Jeez, 12 posts in this IEEE 754 thread, and still > no message from uncle timmy ? ;) Somebody reboot the timbot, please. Seems to have hung. -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simo

Re: Open Office and Python

2006-08-25 Thread Simon Brunning
On 8/25/06, F <[EMAIL PROTECTED]> wrote: > I'd like to load a .csv file to the Open Office spreadsheet from the command > line using an arbitrary delimiter through Python. I don't need any fancy > formatting and stuff like that, just putting the values in the spreadsheet > will do. Have you looked

Re: how do you get the name of a dictionary?

2006-09-08 Thread Simon Brunning
On 8 Sep 2006 02:24:49 -0700, MonkeeSage <[EMAIL PROTECTED]> wrote: > I guess I don't get the problem with the OP's request, either. There is > already a name<->identifier mapping in place for objects. Do you mean a name<->object mapping? This, I think, isn't true. There is a name->object mapping

Re: Unit balancing

2006-09-13 Thread Simon Brunning
On 13 Sep 2006 07:47:41 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I am working with a researcher who would be very happy if he could > include units in his calculations. Then, if his complicated expression > didn't result in "kg/yr" the program would stop and point out his > error. Th

Re: When is it a pointer (aka reference) - when is it a copy?

2006-09-19 Thread Simon Brunning
On 9/19/06, Magnus Lycka <[EMAIL PROTECTED]> wrote: > Fredrik Lundh wrote: > > this article > > > > http://effbot.org/zone/python-objects.htm > > > > may be useful for those who haven't already seen it. > > I don't know how many times I've referred to, or paraphrased, > that article. Shouldn't

Re: why a main() function?

2006-09-19 Thread Simon Brunning
On 9/19/06, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > I totally fail to see why that should be the case - for python as well as > for C. If you put your code into a main() function, all the names that it binds are in the function's local scope, whereas if the code is in the module's top level

Re: How to efficiently proceed addition and subtraction in python list?

2006-09-19 Thread Simon Brunning
On 18 Sep 2006 15:43:31 -0700, Daniel Mark <[EMAIL PROTECTED]> wrote: > Hello all: > > I have a list AAA = [1, 2, 3] and would like to subtract one from list > AAA > so AAA' = [0, 1, 2] You've had some excellent suggestions as to how to go about this assuming that by "efficient" you mean in terms

Re: Python and CORBA

2006-09-21 Thread Simon Brunning
On 21 Sep 2006 01:48:55 -0700, rodmc <[EMAIL PROTECTED]> wrote: > Can anyone recommend an easy to install COBRA implementation which > works with Python? I am using Windows XP. is the 2nd hit if you go to . ;-) -- Che

Re: Remap Mysql tuple to dictionary

2006-09-26 Thread Simon Brunning
On 9/26/06, Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > All right, sorry, looks like they want to load the entire table into RAM and > key it off the first field. Kind of defeats the point of having SQL, but > there you go... Keeping an in-memory cache of small, unchanging, frequently-read ta

Re: concat next line with previous

2006-09-26 Thread Simon Brunning
On 26 Sep 2006 03:16:25 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > what is the python way to concat 2 lines eg > > line 1 with some text > line 2 with some text > > i want to bring line 2 up , such that i get one whole string. > > line 1 with some text line 2 with some text line1 = "l

Re: where are isinstance types documented?

2006-09-26 Thread Simon Brunning
On 9/26/06, Simon Brunning <[EMAIL PROTECTED]> wrote: > On 26 Sep 2006 02:59:07 -0700, codefire <[EMAIL PROTECTED]> wrote: > > For example isinstance(a, int) works fine but isinstance(s, string) > > doesn't - because 'string is not known'. > > In th

Re: where are isinstance types documented?

2006-09-26 Thread Simon Brunning
On 26 Sep 2006 02:59:07 -0700, codefire <[EMAIL PROTECTED]> wrote: > I'm using the isinstance built-in function. I've found the docs for it, > but there are no docs on the supported types. > > For example isinstance(a, int) works fine but isinstance(s, string) > doesn't - because 'string is not kno

Re: Remap Mysql tuple to dictionary

2006-09-26 Thread Simon Brunning
On 9/26/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Frank Millman wrote: > > > I am reminded of a spoof Latin motto from the days of my youth - > > > >NIL ILLEGITIMO CARBORUNDUM > > isn't that usually written > > Illegitimi non carborundum According to the Wikipedia, neither is actually

Re: A critique of cgi.escape

2006-09-26 Thread Simon Brunning
On 26 Sep 2006 15:53:46 GMT, Jon Ribbens <[EMAIL PROTECTED]> wrote: > To be honest I'm not sure what *sort* of code people test this way. It > just doesn't seem appropriate at all for web page generating code. Web > pages need to be manually viewed in web browsers, and validated, and > checked for

Re: does anybody earn a living programming in python?

2006-09-27 Thread Simon Brunning
On 26 Sep 2006 13:43:24 -0700, Fuzzyman <[EMAIL PROTECTED]> wrote: > Simon Brunning is a Pythonista in his spare time but uses > Java at work. He has got Jython fairly deeply embedded though. Sure do. We also use Python for a lot of internal tools, the most complex probably be

Re: Extra Newby question - Trying to create md5 File Listing

2006-09-27 Thread Simon Brunning
On 9/27/06, James Johnston <[EMAIL PROTECTED]> wrote: > > I've never written a Python program before and I'm trying to read a config > file with file path/names (eg. c:\\python24\\*.dll, ... *.exe) to create an > output file of filename + md5 values. I'm confused. I'm trying to learn > how to use

Re: Surprise using the 'is' operator

2006-09-27 Thread Simon Brunning
On 9/27/06, tobiah <[EMAIL PROTECTED]> wrote: > Suppose I fill an list with 100 million random integers in the range > of 1 - 65535. Wouldn't I save much memory if all of the ocurrances > of '12345' pointed to the same integer object? Why should more be made, > when they all do the same thing, an

Re: Can string formatting be used to convert an integer to its binary form ?

2006-09-29 Thread Simon Brunning
On 9/29/06, Steve Holden <[EMAIL PROTECTED]> wrote: > Unfortunately forty years of programming experience has taught me that > there's an essentially infinite supply of mistakes to make ... your > mistakes just get smarter most of the time. +1 QOTW. -- Cheers, Simon B, [EMAIL PROTECTED] -- http

Re: How to coerce a list of vars into a new type?

2006-10-02 Thread Simon Brunning
On 10/2/06, Matthew Wilson <[EMAIL PROTECTED]> wrote: > > I want to verify that three parameters can all be converted into > integers, but I don't want to modify the parameters themselves. > > This seems to work: > > def f(a, b, c): > > a, b, c = [int(x) for x in (a, b, c)] > > Original

Re: Manipulate PDFs

2006-10-03 Thread Simon Brunning
On 10/3/06, Weko Altamirano <[EMAIL PROTECTED]> wrote: > Hi Everyone, am a developer using Zope and wanted to know if any of you have > ever implemented a pdf generating/creating system using python? This just > means mostly manipulating pdfs (create and/or edit) via web. If you guys > have any sug

Equal to Anything

2006-10-04 Thread Simon Brunning
For the purposes of a little test utility that we use, I need an object that evaluates as equal to anything. (I realise that this is a bad idea in some ways, breaking the equals/hashcode invariant and so forth, but I'm hoping that I can get away with it in this case.) It seems a simple enough task

Re: python vs java & eclipse

2006-12-01 Thread Simon Brunning
On 1 Dec 2006 01:24:47 -0800, Amir Michail <[EMAIL PROTECTED]> wrote: > Eclipse for example provides such an amazing IDE for java that it is no > longer obvious to me that one would be much more productive in python > for medium sized projects. Eclipse can generate a lot of the Java boilerplate c

Re: Problem in reading a URL

2006-12-08 Thread Simon Brunning
On 12/8/06, Χρυσάνθη Αϊναλή <[EMAIL PROTECTED]> wrote: > Hi, > > I get an error, when I am trying to read URL. > Where is the Problem? > > Thank u very much for all ideas!!! > > sincerely > > Chrysanthi > > > from urllib2 import * > > filename=urlopen('http://www.ncbi.nlm.nih.gov/entrez/viewer.fcgi

Re: YouTube written in Python

2006-12-13 Thread Simon Brunning
On 12/13/06, Terry Reedy <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> wrote: > > Really? > > It's awful! > > Awesome? Well, it's got some pretty awful clips on it, but I don't think you can blame that on the technology. ;-) -- Cheers, Simon B [EMAIL PROTECTED] http://www.brunningonline.net/s

Re: tuple.index()

2006-12-14 Thread Simon Brunning
On 12/14/06, Nick Maclaren <[EMAIL PROTECTED]> wrote: > Well, if that were so, it would explain things. But lists AREN'T > necessarily homogeneous! > > >>> a=[52,"abc",[1,2],5.6] > >>> print repr(a) > [52, 'abc', [1, 2], 5.5996] It's not a technical restriction, as I said, but it's wh

Re: tuple.index()

2006-12-14 Thread Simon Brunning
On 14 Dec 2006 11:24:04 GMT, Nick Maclaren <[EMAIL PROTECTED]> wrote: > > Why doesn't the tuple type have an index method? It seems such a > bizarre restriction that there must be some reason for it. Yes, > I know it's a fairly rare requirement. It's because, philosophically, a Python tuple isn'

Re: Multiple inheritance and __slots__

2006-12-14 Thread Simon Brunning
On 14 Dec 2006 05:23:33 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi all, > >From the google search, it seems its not possible to do the following. > > >>> class Test1(object): > ... __slots__ = ['a'] > ... > >>> class Test2(object): > ... __slots__ = ['b'] > ... > >>> class Tes

<    1   2   3   4   5   6   >