Re: how to get names of attributes

2015-12-30 Thread Charles T. Smith
On Wed, 30 Dec 2015 11:51:19 +, Charles T. Smith wrote: > Hi, > > How can I get *all* the names of an object's attributes? I have legacy > code with mixed new style classes and old style classes and I need to > write methods which deal with both. That's the imm

Re: how to get names of attributes

2015-12-30 Thread Charles T. Smith
On Wed, 30 Dec 2015 11:51:19 +, Charles T. Smith wrote: > Hi, > > How can I get *all* the names of an object's attributes? I have legacy > code with mixed new style classes and old style classes and I need to > write methods which deal with both. That's the imm

using __getitem()__ correctly

2015-12-30 Thread Charles T. Smith
Hello, I thought __getitem__() was invoked when an object is postfixed with an expression in brackets: - abc[n] and __getattr__() was invoked when an object is postfixed with an dot: - abc.member but my __getitem__ is being invoked at this time, where there's no subscript (going into a s

Re: how to get names of attributes

2015-12-30 Thread Charles T. Smith
On Wed, 30 Dec 2015 23:50:03 +1100, Chris Angelico wrote: > On Wed, Dec 30, 2015 at 11:40 PM, Charles T. Smith > wrote: >> Oh! >> >> Although the referenced doc says: >> >> "For compatibility reasons, classes are still old-style by default." >

Re: using __getitem()__ correctly

2015-12-30 Thread Charles T. Smith
On Thu, 31 Dec 2015 00:11:24 +1100, Chris Angelico wrote: > On Wed, Dec 30, 2015 at 11:57 PM, Charles T. Smith > wrote: >> Hello, >> >> I thought __getitem__() was invoked when an object is postfixed with an >> expression in brackets: >> >> - abc[n] &

Re: how to get names of attributes

2015-12-30 Thread Charles T. Smith
On Wed, 30 Dec 2015 14:10:14 +, Mark Lawrence wrote: > On 30/12/2015 11:51, Charles T. Smith wrote: >> Hi, >> >> Does anyone know *why* the __members__ method was deprecated, to be >> replaced by dir(), which doesn't tell the truth (if only it took an &

Re: using __getitem()__ correctly

2015-12-30 Thread Charles T. Smith
On Wed, 30 Dec 2015 08:35:57 -0700, Ian Kelly wrote: > On Dec 30, 2015 7:46 AM, "Charles T. Smith" > wrote: >> As is so often the case, in composing my answer to your question, I >> discovered a number of problems in my class (e.g. I was calling >> __getitem__()

Re: using __getitem()__ correctly

2015-12-30 Thread Charles T. Smith
On Wed, 30 Dec 2015 13:40:44 -0700, Ian Kelly wrote: > On Wed, Dec 30, 2015 at 9:58 AM, Charles T. Smith >> The problem is that then triggers the __getitem__() method and I don't >> know how to get to the attributes without triggering __getattr__(). >> >> It&#

Re: using __getitem()__ correctly

2015-12-30 Thread Charles T. Smith
On Wed, 30 Dec 2015 22:54:44 +, Charles T. Smith wrote: > But I concede I must be doing something fundamentally wrong because this > assert is triggering: > def __getattr__ (self, name): > print "attrdict:av:__getattr__: entered for ", name > ass

Re: using __getitem()__ correctly

2015-12-30 Thread Charles T. Smith
On Thu, 31 Dec 2015 10:13:53 +1100, Ben Finney wrote: > "Charles T. Smith" writes: > >> I don't understand this distinction between an "attribute" and a "dict >> item". > > When did you most recently work through the Python tutorial &

Re: how to get names of attributes

2015-12-31 Thread Charles T. Smith
On Thu, 31 Dec 2015 10:58:17 +1100, Steven D'Aprano wrote: (some very good information) Thank you. -- https://mail.python.org/mailman/listinfo/python-list

Re: using __getitem()__ correctly

2015-12-31 Thread Charles T. Smith
On Thu, 31 Dec 2015 10:50:53 +1100, Steven D'Aprano wrote: > I'm not sure what distinction you're referring to, can you explain? Ian Kelly had said: >> How precisely are you trying to store these: as an attribute, or as a >> dict item? If it's supposed to be in the dict, then why is your >> __ge

Re: using __getitem()__ correctly

2015-12-31 Thread Charles T. Smith
On Thu, 31 Dec 2015 11:21:59 +1100, Ben Finney wrote: > Steven D'Aprano writes: > >> On Thu, 31 Dec 2015 10:13 am, Ben Finney wrote: >> >> > You may be familiar with other languages where the distinction >> > between “attribute of an object” is not distinct from “item in a >> > dictionary”. Pyth

Re: using __getitem()__ correctly

2015-12-31 Thread Charles T. Smith
On Wed, 30 Dec 2015 17:31:11 -0700, Ian Kelly wrote: >> In any case, I thought that class attributes were, in fact, items of >> __dict__? > > That's correct, but as I said in my previous message, self.attrs and > self.attrs.__dict__ are two different dicts, and you're confusing one > for the othe

Re: using __getitem()__ correctly

2015-12-31 Thread Charles T. Smith
On Thu, 31 Dec 2015 12:12:43 +, Oscar Benjamin wrote: > When you write x.attr the name 'attr' is looked up on the object x. This > calls x.__getattribute__('attr'). In turn this checks the dict > associated with the object x i.e. x.__dict__['attr']. This in turn calls > x.__dict__.__getitem__

Powerful perl paradigm I don't find in python

2016-01-15 Thread Charles T. Smith
while ($str != $tail) { $str ~= s/^(head-pattern)//; use ($1); } -- https://mail.python.org/mailman/listinfo/python-list

Re: Powerful perl paradigm I don't find in python

2016-01-15 Thread Charles T. Smith
On Fri, 15 Jan 2016 11:42:24 +0100, Wolfgang Maier wrote: > On 15.01.2016 10:43, Peter Otten wrote: >> Charles T. Smith wrote: >> >>> while ($str != $tail) { >>> $str ~= s/^(head-pattern)//; >>> use ($1); >>> } >> >

Re: Powerful perl paradigm I don't find in python

2016-01-15 Thread Charles T. Smith
On Fri, 15 Jan 2016 11:04:32 +, Charles T. Smith wrote: > capability, somehow, but that was apparently overlooked. For example, > by storing string state in the match object and having a *sub* method without > a string parameter. -- https://mail.python.org/mailman/listinfo/python-list

Re: Powerful perl paradigm I don't find in python

2016-01-18 Thread Charles T. Smith
On Fri, 15 Jan 2016 14:20:17 +0100, Wolfgang Maier wrote: > pattern = pattern_str.compile() > try: > matches = pattern.findall(some_str, endpos=some_str.index(tail)) > except ValueError: > # do something if tail is not found > pass Oh! I think that's it! matches = findall (patte

When is an int not an int? Who can explain this?

2016-01-18 Thread Charles T. Smith
$ python Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> type(0) is int True ... (PDB)type(0) is int False (PDB)type(1) is int False (PDB)p 5 + 0 5 (PDB)class c (object): pass (PDB)type (c()) is c T

Re: When is an int not an int? Who can explain this?

2016-01-18 Thread Charles T. Smith
On Tue, 19 Jan 2016 03:19:59 +1100, Chris Angelico wrote: > On Tue, Jan 19, 2016 at 3:11 AM, Charles T. Smith > wrote: >> $ python >> Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 >> Type "help", "copyright", "credits&quo

importing: what does "from" do?

2016-01-21 Thread Charles T. Smith
What does "from (module) import (func)" do? Please don't tell me that I shouldn't ask because real programmers know not to have circular dependencies ... I have no idea what was imported before. I just want to import hexdump(). Unfortunately, this does not work: from utilities import hexdump

Re: importing: what does "from" do?

2016-01-21 Thread Charles T. Smith
On Thu, 21 Jan 2016 07:52:17 -0700, Ian Kelly wrote: >> I have no idea what was imported before. I just want to import >> hexdump(). Unfortunately, this does not work: >> >> from utilities import hexdump >> >> ImportError: cannot import name hexdump > > What is utilities? Is it a module on

Re: importing: what does "from" do?

2016-01-21 Thread Charles T. Smith
On Thu, 21 Jan 2016 15:31:45 +, John Gordon wrote: > The most likely explanation here is that the 'utilities' module simply > does not contain something named 'hexdump'. > > Have you inspected the 'utilities' module? Does it, in fact, contain > something named 'hexdump'? Yes -- https://ma

Re: importing: what does "from" do?

2016-01-21 Thread Charles T. Smith
On Thu, 21 Jan 2016 15:44:43 +, John Gordon wrote: > How did this error come up? Did the code work previously? If so, what > changed? The developers of this legacy code had this as well as other functions duplicated throughout the system, in order to avoid confronting these issues. I'm tr

Re: importing: what does "from" do?

2016-01-21 Thread Charles T. Smith
On Thu, 21 Jan 2016 15:44:43 +, John Gordon wrote: > In that case, the problem is most likely a circular import issue, as you > mentioned. The only way to fix it is to reorganize your modules. > > How did this error come up? Did the code work previously? If so, what > changed? What I nee

Re: importing: what does "from" do?

2016-01-21 Thread Charles T. Smith
On Thu, 21 Jan 2016 08:59:39 -0700, Ian Kelly wrote: > What happens if you just do 'import utilities'. Can you then call > utilities.hexdump? Can you see anything in the utilities module? Yes, that works! That's what I'm doing as a work around. I was trying to avoid doing that because I figured

Re: importing: what does "from" do?

2016-01-21 Thread Charles T. Smith
On Thu, 21 Jan 2016 16:30:30 +, Charles T. Smith wrote: >> Side observation: 'int' is a bad name for a package, because it will >> shadow the name of the 'int' built-in. > > > Boy oh boy have I experienced that now! :) (it wasn't me! ;)

Re: Refactoring in a large code base

2016-01-22 Thread Charles T. Smith
On Fri, 22 Jan 2016 12:19:50 +0200, Marko Rauhamaa wrote: > We need similar code sanity management. Developers are given much too > much power to mess up the source code. That's why "legacy" is considered > a four-letter word among developers. When I started in this business, in the mid-70s, ther

merging number of csv files

2016-03-03 Thread m . t . egle
Hey! I have been goggling around for the last few days and tried out many python codes. I want to merge two csv files, say thought_probe1.csv and thought_probe2.csv. I want them to merge column-wise in a new csv file 'new_file.csv'. What coding is smart to use in order to achieve it? I would r

merging two csv files

2016-03-03 Thread m . t . egle
Hey! I want to merge column-wise two csv files, say: file1.csv and file2.csv, both containing two columns, into a new csv file. I could not find a good code for doing this. It never really worked. If you could show me the code with this example, I would highly appreciate it. Best wishes, Tib

a clarification on the "global" statement sought

2016-03-11 Thread Charles T. Smith
When might a "global" statement be used in the outermost level of a module? (whereby, I assume a module is equivalent to a python file, correct?) TIA for any thoughts. cts -- https://mail.python.org/mailman/listinfo/python-list

Re: a clarification on the "global" statement sought

2016-03-11 Thread Charles T. Smith
On Fri, 11 Mar 2016 19:29:20 +1100, Chris Angelico wrote: > Usefully? Never. > > Simple question - simple answer :) > > ChrisA Right, that was the expected answer as well. I just ran into that in legacy code, checked out the documentation and couldn't really make that out. So I figured I bet

Re: a clarification on the "global" statement sought

2016-03-11 Thread Charles T. Smith
On Fri, 11 Mar 2016 08:31:22 +, Mark Lawrence wrote: > Never. Hopefully this > http://www.python-course.eu/python3_global_vs_local_variables.php can > explain it better than I can :) The article is good, I'm glad to have confirmed what I have so empirical stumbled over. ... Irrespective of t

hasattr() or "x in y"?

2016-03-11 Thread Charles T. Smith
>From the performance point of view, which is better: - hasattr() - x in y TIA cts -- https://mail.python.org/mailman/listinfo/python-list

Re: hasattr() or "x in y"?

2016-03-11 Thread Charles T. Smith
On Fri, 11 Mar 2016 21:44:27 +, Charles T. Smith wrote: > From the performance point of view, which is better: - hasattr() > - x in y > > TIA > cts I just realized that "in" won't look back through the class hierarchy... that clearly makes them not interc

Re: hasattr() or "x in y"?

2016-03-11 Thread Charles T. Smith
On Fri, 11 Mar 2016 22:00:41 +, Grant Edwards wrote: > Since they behave differently, perhaps the question ought to be "which > does what you want to do?" For parsed msgs, I had this: elif hasattr (msg.msgBody, 'request'): It occurred to me that this was less abstruse:

sobering observation, python vs. perl

2016-03-18 Thread Charles T. Smith
I've really learned to love working with python, but it's too soon to pack perl away. I was amazed at how long a simple file search took so I ran some statistics: $ time python find-rel.py ./find-relreq *.out | sort -u TestCase_F_00_P TestCase_F_00_S TestCase_F_01_S TestCa

Re: sobering observation, python vs. perl

2016-03-19 Thread Charles T. Smith
On Thu, 17 Mar 2016 18:34:06 +0200, Marko Rauhamaa wrote: > n-vs-perl-performance Okay, that was interesting. Actually, I saw a study some years ago that concluded that python could be both slower and faster than perl, but that perl had much less deviation than python. I took that and accepted

Re: sobering observation, python vs. perl

2016-03-19 Thread Charles T. Smith
On Thu, 17 Mar 2016 17:47:55 +0200, Marko Rauhamaa wrote: > Can't comment on the numbers but the code segments are not quite > analogous. What about this one: > > #!/usr/bin/env python > # vim: tw=0 > import sys > import re > > isready = re.compile("(.*) is ready") > for

Re: sobering observation, python vs. perl

2016-03-19 Thread Charles T. Smith
On Thu, 17 Mar 2016 09:21:51 -0700, Ethan Furman wrote: >> well, I don't want to forgo REs in order to have python's numbers be >> better > > The issue is not avoiding REs, but using Python's strengths and idioms. > Write the code in Python's style, get the same results, then compare > t

Re: sobering observation, python vs. perl

2016-03-19 Thread Charles T. Smith
On Thu, 17 Mar 2016 17:48:54 +0200, Marko Rauhamaa wrote: > "Charles T. Smith" : > >> On Thu, 17 Mar 2016 15:29:47 +, Charles T. Smith wrote: >> >> And for completeness, and also surprising: >> >> time sed -n -e '/ is ready

Re: sobering observation, python vs. perl

2016-03-19 Thread Charles T. Smith
On Thu, 17 Mar 2016 18:07:12 +0200, Marko Rauhamaa wrote: > "Charles T. Smith" : > Ok. The LANG=C setting has a tremendous effect on the performance of > textutils. > > > Marko Good to know, thank you... -- https://mail.python.org/mailman/listinfo/python-list

Re: sobering observation, python vs. perl

2016-03-19 Thread Charles T. Smith
On Thu, 17 Mar 2016 10:26:12 -0700, Ethan Furman wrote: > On 03/17/2016 09:36 AM, Charles T. Smith wrote: > >> Yes, your point was to forgo REs despite that they are useful. >> I could have thought the search would have been better as: >> >> 'release[

Re: sobering observation, python vs. perl

2016-03-19 Thread Charles T. Smith
On Thu, 17 Mar 2016 18:30:29 +0200, Marko Rauhamaa wrote: > "Charles T. Smith" : > >> I need the second check to also be a RE because it's not >> separate tokens. > > The string "in" check doesn't care about tokens. > > > Marko

Re: sobering observation, python vs. perl

2016-03-19 Thread Charles T. Smith
On Thu, 17 Mar 2016 10:52:30 -0500, Tim Chase wrote: >> Not saying this will make a great deal of difference, but these two > items jumped out at me. I'd even be tempted to just use string > manipulations for the isready aspect as well. Something like > (untested) well, I don't want to forgo RE

Re: sobering observation, python vs. perl

2016-03-20 Thread Charles T. Smith
On Thu, 17 Mar 2016 19:08:58 +0200, Marko Rauhamaa wrote: > "Charles T. Smith" : > > > Compare Perl (http://www.perlmonks.org/?node_id=98357>): > >my $str = "I have a dream"; >my $find = "have"; >my $replace = "h

Re: sobering observation, python vs. perl

2016-03-20 Thread Charles T. Smith
On Thu, 17 Mar 2016 15:29:47 +, Charles T. Smith wrote: And for completeness, and also surprising: time sed -n -e '/ is ready/{s///;h}' -e '/release_req/{g;p}' *.out | sort -u TestCase_F_00_P TestCase_F_00_S TestCase_F_01_S TestCase_F_02_M real0m10.998s u

Re: sobering observation, python vs. perl

2016-03-20 Thread Charles T. Smith
On Thu, 17 Mar 2016 21:18:43 +0530, srinivas devaki wrote: > please upload the log file, Sorry, it's work stuff, can't do that, but just take any big set of files and change the strings appropriately and the numbers should be equivalent. > > and global variables in python are slow, so just ke

Re: crash while using PyCharm / Python3

2016-03-21 Thread Dirk T. Verbeek
Op 21-03-16 om 17:51 schreef Adam: "Adam" wrote in message news:ncikss$tks$1...@news.albasani.net... Host OS:Ubuntu Desktop 14.04 LTS / Unity System crashed while using PyCharm / Python3. Booting takes forever and stuck at the purple screen with the Ubuntu logo and the five dots cycling.

caught in the import web again

2014-11-15 Thread Charles T. Smith
Now, I'm getting these errors: ImportError: cannot import name ... and AttributeError: 'module' object has no attribute ... (what is 'module'?) Is there a way to resolve this without having to restructure my code every couple of days? I thought using imports of the form: from module i

Re: caught in the import web again

2014-11-16 Thread Charles T. Smith
On Sun, 16 Nov 2014 08:14:05 +0100, dieter wrote: > "Charles T. Smith" writes: >> Now, I'm getting these errors: >> >> ImportError: cannot import name ... >> >> and >> >> AttributeError: 'module' object has no attrib

Re: caught in the import web again

2014-11-17 Thread Charles T. Smith
On Mon, 17 Nov 2014 08:08:40 +0100, dieter wrote: > "Charles T. Smith" writes: >> ... >> Are others equally frustrated by this or is there a trick or principle >> that I'm missing. At this point, I guess the way I'll have to proceed >> is to put e

Re: caught in the import web again

2014-11-18 Thread Charles T. Smith
On Tue, 18 Nov 2014 00:00:42 -0700, Michael Torrie wrote: > On 11/17/2014 03:45 PM, Steven D'Aprano wrote: > >> Circular dependencies are not just a problem in Python, they are a >> problem throughout most of software design. > > Personally I find that duck typing eliminates a lot of the circula

[no subject]

2015-06-22 Thread John T. Haggerty
I'm looking to just have a simple program that will do a SQLite query pull a random record and then copy that record too the clipboard the system. I'm not quite seeing how to do this perhaps this is already been done elsewhere but I spent quite a bit of time trying to figure out how to do that and

Re: OFF-TOPIC Ben's sig monster quote [was Re: Parametrized Unit Tests]

2015-08-28 Thread John T. Haggerty
People are naturally competitive. People naturally don't like to hear the word know. People love to get what they want. Combine all of these things together and you have all of the elements necessary to eventually create another conflict. Just because it doesn't happen immediately doesn't mean it's

True == 1 weirdness

2015-09-16 Thread Blake T. Garretson
I am maintaining some old code where the programmer used 1 for True because booleans hadn't been added to Python yet. I'm getting some weird behaviour, so I created some simple tests to illustrate my issue. >>> 1 in {1:1}#test1 True >>> 1 in {1:1} == 1 #test2 False >>> (1 in {1:1}) ==

Re: True == 1 weirdness

2015-09-16 Thread Blake T. Garretson
On Wednesday, September 16, 2015 at 8:54:07 AM UTC-4, Jussi Piitulainen wrote: > The second test, test2, is interpreted (almost) as > > (1 in {1:1}) and ({1:1} == 1) > > which is obviously False. Ah, that makes sense. It didn't occur to me that Python would interpret it that way, and I'

Re: True == 1 weirdness

2015-09-16 Thread Blake T. Garretson
On Wednesday, September 16, 2015 at 9:08:54 AM UTC-4, jmp wrote: > x = 5 > 3 < x < 10 That's a great example. I use this case all the time and didn't think to apply the same principal to the in/== case. I assumed that "in" was evaluated first, and then the == comparison was made. Thanks! --

Re: To start a simple server

2011-10-03 Thread Amelia T Cat
On Mon, 03 Oct 2011 10:09:59 -0700, sillyou su wrote: > 啊!! > > I should use 127.0.0.1 instance of 0.0.0.0 Theoretically either one should be fine. If you use 127.0.0.1 it will only expose the service to your local machine. If you use 0.0.0.0 ut will expose the service to other computers on t

Re: Complete beginner, any help appreciated :) - For Loops

2011-12-01 Thread Kyle T. Jones
On 12/1/11 4:53 AM, Mark wrote: Hi there, I'm a complete beginner to Python and, aside from HTML and CSS, to coding in general. I've spent a few hours on it and think I understand most of the syntax. However, I'm wondering a bit about For Loops. I know that the basic syntax for them is to def

Robotics and parallel ports

2005-12-15 Thread Isaac T Alston
Basically, I'm thinking about building a robot which can be controlled by programs which I write, I'm going to interface to the robot through the parallel port (like in this tutorial here: linuxfocus.org/English/May2001/article205.shtml). However, I know that this will probably need to be done in l

Re: Robotics and parallel ports

2005-12-15 Thread Isaac T Alston
Heiko Wundram wrote: > Maybe it's what you're looking for. Thanks for that. I've never actually built a robot or anything like that before, so I'm welcome to any advice I can get! I've heard programming via USB is hard, so that's why I'm using the parallel port (serial ports are said to be slow wh

Re: text manipulation

2005-12-16 Thread Isaac T Alston
Johhny wrote: > Any advice would be great. Have you had a look at Python's re module? If you've not, I suggest you do so - it contains all of Python's regex tools which you'll need. Regards, -- Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: Robotics and parallel ports

2005-12-16 Thread Isaac T Alston
Thanks for everyone's tips and hints. I WILL MAKE THIS WORK! I think I'll take your advice and use the serial port instead of the parallel port - I won't have that much data to send (in comparison with, for example, industrial level applications). As for on-board chips though, does this require low

Re: Python and curses

2005-12-16 Thread Isaac T Alston
linuxfreak wrote: > Was wanting to write a text based application in python seems > curses module is the way to go... anyone knows of any good tutorials > apart from the one written by esr Not off the top of my head, no. However, you will find that the functions needed will be very similar to

Re: Robotics and parallel ports

2005-12-18 Thread Isaac T Alston
Thanks - now I just have to convince my parents that I should be allowed to etch circuit boards in my room :-) . Thanks again. Regards, Isaac -- http://mail.python.org/mailman/listinfo/python-list

OT: New Python T-shirt available

2006-02-01 Thread Mr t dolton
I created a new Python T-shirt: http://www.cafepress.com/import_re I have been looking for this shirt ever since I fell in love with the slogan a few years ago. I gave up looking and decided to fumble through Photoshop for many hours to make my own. >From today through February 14th, $1.00 f

Encryption with Python?

2005-05-05 Thread Blake T. Garretson
I want to save some sensitive data (passwords, PIN numbers, etc.) to disk in a secure manner in one of my programs. What is the easiest/best way to accomplish strong file encryption in Python? Any modern block cipher will do: AES, Blowfish, etc. I'm not looking for public key stuff; I just want

Re: How Can I Increase the Speed of a Large Number of Date Conversions

2007-06-07 Thread James T. Dennis
Some Other Guy <[EMAIL PROTECTED]> wrote: > vdicarlo wrote: >> I am a programming amateur and a Python newbie who needs to convert >> about 100,000,000 strings of the form "1999-12-30" into ordinal dates >> for sorting, comparison, and calculations. Though my script does a ton >> of heavy calculati

Re: 4 byte integer

2007-06-09 Thread James T. Dennis
Paul D Ainsworth <[EMAIL PROTECTED]> wrote: > Greetings everyone. I'm a relative newcomer to python and I have a technical > problem. > I want to split a 32 bit / 4 byte unsigned integer into 4 separate byte > variables according to the following logic: - > bit numbers 0..7 byte 1 > bit numbers

Re: PyGTK : a NEW simple way to code an app

2007-06-09 Thread James T. Dennis
manatlan <[EMAIL PROTECTED]> wrote: > I was a fan of "SimpleGladeApp/tepache way" to build a pygtk app. > I've build a new efficient/dynamic way to build a pygtk app ... > Here is an example : > = > class Fen(GladeApp): >""" >Window win >

Re: need help with python

2007-06-10 Thread James T. Dennis
[EMAIL PROTECTED] wrote: > On May 11, 10:16 pm, Paul McGuire <[EMAIL PROTECTED]> wrote: >> On May 11, 9:41 pm, [EMAIL PROTECTED] wrote: [... much ellided ...] ["ellided" is a fancy word for "left out" or "replaced with ellipses."] > I was looking around in my Python folder and

Re: Dynamic subclassing ?

2007-06-10 Thread James T. Dennis
Karlo Lozovina <[EMAIL PROTECTED]> wrote: > manatlan wrote: >> I can't find the trick, but i'm pretty sure it's possible in an easy >> way. > It's somewhat easy, boot looks ugly to me. Maybe someone has a more > elegant solution: > In [6]: import new > In [13]: class Button: >: def

Re: logging module and threading

2007-06-12 Thread James T. Dennis
Ross Boylan <[EMAIL PROTECTED]> wrote: > I would like my different threads to log without stepping on each > other. > Past advice on this list (that I've found) mostly says to send the > messages to a Queue. That would work, but bypasses the logging > module's facilities. > The logging module it

Re: Convert String to Int and Arithmetic

2007-06-12 Thread James T. Dennis
tereglow <[EMAIL PROTECTED]> wrote: > Hello, > I am a complete newbie to Python and am accustomed to coding in PHP/ > Perl/Shell. I am trying to do the following: > I have a string: > cpuSpeed = 'Speed: 10' > What I would like to do is extract the '10' from the string, > and di

Re: how to kill a process

2007-06-12 Thread James T. Dennis
Richard Rossel <[EMAIL PROTECTED]> wrote: > Hi Fellows, > I have a problem with process termination. I have a python code that > apache runs through a django interface. > The code is very simple, first, it creates a process with the > subprocess.Popen call, and afterwards, (using a web request) the

Re: Re printing on same line.

2007-06-19 Thread James T. Dennis
Robert Bauck Hamar <[EMAIL PROTECTED]> wrote: > Jerry Hill wrote: >> On 6/15/07, HMS Surprise <[EMAIL PROTECTED]> wrote: >>> I want to print a count down timer on the same line. I tried >>> print '\r', timeLeft, >>> which just appends to the same line. >> Sounds to me like whatever you're p

Re: Subprocess with and without shell

2007-06-29 Thread James T. Dennis
George Sakkis <[EMAIL PROTECTED]> wrote: > On May 15, 5:30 am, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: >> George Sakkis <[EMAIL PROTECTED]> wrote: >>> I'm trying to figure out why Popen captures the stderr of a specific >>> command when it runs through the shell but not without it. IOW: >>>

Re: Trying to choose between python and java

2007-07-13 Thread James T. Dennis
Hamilton, William <[EMAIL PROTECTED]> wrote: >> From: Beliavsky > On May 15, 1:30 am, Anthony Irwin <[EMAIL PROTECTED]> wrote: >> >>> #5 someone said that they used to use python but stopped because the >>> language changed or made stuff depreciated (I can fully remember >>> which) and old code

Re: indexing web pages - in python?

2007-04-18 Thread Kevin T. Ryan
On Apr 18, 8:55 pm, Dan Stromberg <[EMAIL PROTECTED]> wrote: > Are there any open source search engines written in python for indexing a > given collection of (internal only) html pages? Right now I'm talking > about dozens, but hopefully it'll be hundreds or thousands at some point. > > I'm think

ICFP Programming Contest 2007

2007-04-26 Thread johan . t . jeuring
Want to show off your programming skills? Your favorite programming language? Your best programming tools? Join the ICFP Programming Contest 2007! The 10th ICFP Programming Contest celebrates a decade of contests. This is one of the world's most advanced and prestiguous programming contest you can

Re: SEO - Search Engine Optimization - Seo Consulting

2007-04-29 Thread Juan T. Llibre
re: !>>>Top posting !>> Did not. I replied to the message at the bottom of the thread. !> Congratulations, you've now made a fool of yourself in public. OK, cut it out. Top or bottom posting is a user choice. No need to flame someone for using either. Juan T. Llibre,

Re: Plot with scipy

2007-05-06 Thread Kevin T. Ryan
On May 4, 8:53 am, redcic <[EMAIL PROTECTED]> wrote: > Hi all, > > I've just downloaded scipy v 0.5.2 and I would like to be able to draw > plots. I've tried: > import scipy.gplt > import scipy.plt > import scipy.xplt > > and none of them work. Are these modules still included in scipy ? If > not,

Minor bug in tempfile module (possibly __doc__ error)

2007-05-08 Thread James T. Dennis
Tonight I discovered something odd in the __doc__ for tempfile as shipped with Python 2.4.4 and 2.5: it says: This module also provides some data items to the user: TMP_MAX - maximum number of names that will be tried before giving up. templat

Re: Minor bug in tempfile module (possibly __doc__ error)

2007-05-09 Thread James T. Dennis
Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Wed, 09 May 2007 06:50:38 -, "James T. Dennis" > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: >> In fact I realized, after reading through tempfile.py in /usr/lib/... >> that th

Re: Minor bug in tempfile module (possibly __doc__ error)

2007-05-09 Thread James T. Dennis
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, James T. Dennis wrote: >> Tonight I discovered something odd in the __doc__ for tempfile >> as shipped with Python 2.4.4 and 2.5: it says: >> >> This

Re: Minor bug in tempfile module (possibly __doc__ error)

2007-05-10 Thread James T. Dennis
Marc Christiansen <[EMAIL PROTECTED]> wrote: > James T. Dennis <[EMAIL PROTECTED]> scribis: >> In fact I realized, after reading through tempfile.py in /usr/lib/... >> that the following also doesn't "work" like I'd expect: >># foo.py

mmap thoughts

2007-05-11 Thread James T. Dennis
I've been thinking about the Python mmap module quite a bit during the last couple of days. Sadly most of it has just been thinking ... and reading pages from Google searches ... and very little of it as been coding. Mostly it's just academic curiosity (I might be teaching an "overview of

Re: Simple Python REGEX Question

2007-05-12 Thread James T. Dennis
johnny <[EMAIL PROTECTED]> wrote: > I need to get the content inside the bracket. > eg. some characters before bracket (3.12345). > I need to get whatever inside the (), in this case 3.12345. > How do you do this with python regular expression? I'm going to presume that you mean something like:

Re: Change serial timeout per read

2007-05-13 Thread James T. Dennis
[EMAIL PROTECTED] wrote: > I'm writing a driver in Python for an old fashioned piece of serial > equipment. Currently I'm using the USPP serial module. From what I can > see all the serial modules seem to set the timeout when you open a > serial port. This is not what I want to do. I need to change

Re: track cpu usage of linux application

2007-05-14 Thread James T. Dennis
Fabian Braennstroem <[EMAIL PROTECTED]> wrote: > Hi, >I would like to track the cpu usage of a couple of >programs using python. Maybe it works somehow with >piping 'top' to python read the cpu load for a greped >application and clocking the the first and last >appearence. Is t

Re: file uploader

2007-05-14 Thread James T. Dennis
please let me know. > I will ignore the "server" part... >> Here is the code that I am using (it runs exactly the same as the linux >> app >> 'arcgen'). >> [...] >> t = i-1 >> filename=string.replace(filename,".-%s&quo

Hello gettext

2007-05-14 Thread James T. Dennis
You'd think that using things like gettext would be easy. Superficially it seems well documented in the Library Reference(*). However, it can be surprisingly difficult to get the external details right. * http://docs.python.org/lib/node738.html Here's what I finally came up with a

Re: Hello gettext

2007-05-14 Thread James T. Dennis
James T. Dennis <[EMAIL PROTECTED]> wrote: ... just to follow-up my own posting --- as gauche as that is: > You'd think that using things like gettext would be easy. Superficially > it seems well documented in the Library Reference(*). However, it can > be surprisingly

Re: How to do basic CRUD apps with Python

2007-05-14 Thread James T. Dennis
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > walterbyrd a ?crit : >> With PHP, libraries, apps, etc. to do basic CRUD are everywhere. Ajax >> and non-Ajax solutions abound. >> With Python, finding such library, or apps. seems to be much more >> difficult to find. >> I thought django might be

Re: python shell

2007-05-16 Thread James T. Dennis
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On May 16, 12:38 pm, Krypto <[EMAIL PROTECTED]> wrote: >> I have been using python shell to test small parts of the big program. >> What other ways can I use the shell effectively. My mentor told me >> that you can virtually do anything from testing yo

Re: append

2007-05-25 Thread James T. Dennis
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > HMS Surprise a ?crit : >> Trying not to be a whiner but I sure have trouble finding syntax in >> the reference material. I want to know about list operations such as >> append. > The only thing you have to know is that it doesn't exists. Python >

Re: Newbie question about string(passing by ref)

2007-05-30 Thread James T. Dennis
Steven D'Aprano <[EMAIL PROTECTED]> wrote: ... > Python does NOT support pass by reference. Nor does it do pass by value. > Both of those models might describe what other languages do, but they > don't describe what Python does. > Python's passing model is different from both pass by reference

Re: Newbie question about string(passing by ref)

2007-05-30 Thread James T. Dennis
Duncan Booth <[EMAIL PROTECTED]> wrote: > lazy <[EMAIL PROTECTED]> wrote: >> I want to pass a string by reference. I understand that strings are >> immutable, but Im not >> going to change the string in the function, just to aviod the overhead >> of copying(when pass-by-value) because the >> strin

<    1   2   3   4   5   >