Re: inspect getsource() minor fix?

2005-09-19 Thread Ron Adam
Delaney, Timothy (Tim) wrote: > Ron Adam wrote: > > >>While playing around with the inspect module I found that the >>Blockfinder doesn't recognize single line function definitions. >> >>Adding the following two lines to it fixes it, but I'm not sur

Re: Question About Logic In Python

2005-09-19 Thread Ron Adam
Steven D'Aprano wrote: > On Mon, 19 Sep 2005 12:16:15 +0200, sven wrote: > > >>to make sure that an operation yields a boolean value wrap a bool() >>around an expression. >>None, 0 and objects which's len is 0 yield False. >>so you can also do stuff like that: > > > Are there actually any usa

Re: Organising a python project

2005-09-20 Thread Ron Adam
[EMAIL PROTECTED] wrote: > Dear all, > > Can anyone point me to a resource that describes the best way of > organising a python project? My project (gausssum.sf.net) is based > around a class, and has a GUI that allows 'easy-access' to the methods > of the class. What is the best or typical direc

Re: Question About Logic In Python

2005-09-21 Thread Ron Adam
Steven D'Aprano wrote: >>So.. >> >>bool(a and b) * value >> >>Would return value or zero, which is usually what I want when I do this >>type of expression. > That's all very interesting, and valuable advice for somebody who doesn't > understand how Python's logical operators work, but the qu

Re: Question About Logic In Python

2005-09-21 Thread Ron Adam
Steven D'Aprano wrote: > Ah, that's a good example, thanks, except I notice you didn't actually > cast to bool in them, eg: (min < value < max) * value It wasn't needed in these particular examples. But it could be needed if several comparisons with 'and' between them are used. It just seems o

Re: Finding where to store application data portably

2005-09-21 Thread Ron Adam
Steven D'Aprano wrote: > On Wed, 21 Sep 2005 20:07:54 +0100, Tony Houghton wrote: > > >> > I wish the Linux Standard Base folks would specify that settings files >> > should all go into a subdirectory like ~/settings rather than filling up >> > the home directory with cruft. That was acceptable

Re: Finding where to store application data portably

2005-09-21 Thread Ron Adam
Tony Houghton wrote: > > I'm using pygame to write a game called Bombz which needs to save some > data in a directory associated with it. In Unix/Linux I'd probably use > "~/.bombz", in Windows something like > "C:\Documents And Settings\\Applicacation Data\Bombz". > > There are plenty of message

Re: Question About Logic In Python

2005-09-22 Thread Ron Adam
Steve Holden wrote: > Ron Adam wrote: >> >> 2. Expressions that will be used in a calculation or another >> expression. >> > By which you appear to mean "expressions in which Boolean values are > used as numbers". Or compared to other types, wh

Re: Finding where to store application data portably

2005-09-22 Thread Ron Adam
Steve Holden wrote: > Ron Adam wrote: > >> Tony Houghton wrote: >> >>> I'm using pygame to write a game called Bombz which needs to save some >>> data in a directory associated with it. In Unix/Linux I'd probably use >>> "~/.bomb

Re: Finding where to store application data portably

2005-09-22 Thread Ron Adam
Tony Houghton wrote: > > This works on Win XP. Not sure if it will work on Linux. > > > > import os > > > > parent = os.path.split(os.path.abspath(os.sys.argv[0]))[0] > > file = parent + os.sep + '.bombz' > > Ooh, no, I don't want saved data to go in the installation directory. In > genera

Re: Can'r run BLT twice?

2005-04-29 Thread Ron Adam
did to solve it. :-( It is fixable though. I know that's not much help. I'll look at how I use it in my program and see if that rings any bells. Ron Adam -- http://mail.python.org/mailman/listinfo/python-list

Re: Can'r run BLT twice?

2005-04-29 Thread Ron Adam
ly using the free version of EditPad Pro, the full version has a spelling checker built in. It's loads up fast and can run external programs on the current document and capture the results and the errors in separate panels. It also supports syntax highlighting for pthon (and a dozen other languages). Cheers, Ron Adam -- http://mail.python.org/mailman/listinfo/python-list

Re: New to Python - block grouping (spaces)

2015-04-16 Thread Ron Adam
On 04/16/2015 01:41 PM, Steven D'Aprano wrote: >2. Having been an employer, it is difficult to force programmers to use >any particular editor or style. Different editors handle tabs and spaces >differently. This is all a bloody nightmare with Python. Do you really expect us to believe for

Re: Great Math Mystery

2015-04-17 Thread Ron Adam
On 04/17/2015 11:03 AM, Steven D'Aprano wrote: On Fri, 17 Apr 2015 07:47 pm, Fetchinson . wrote: >>>In an altercation with the police, complying with their orders greatly >>>increases your chances of survival. >> >>Ah, the definition of a police state: where ordinary people, whether >>breaki

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Ron Adam
On 04/19/2015 05:42 PM, BartC wrote: So I'm aware of some of the things that are involved. (BTW that project worked reasonably well, but I decided to go in a different direction: turning "J" from a mere syntax into an actual language of its own.) Something you might try with your new langua

An experiment with blocks of object code and other meta ideas.

2015-04-27 Thread Ron Adam
I've been playing around with a experimental script language that executes object code lists directly and am looking for others who might like to help. The first version was written in python. The original idea came from wondering if it is possible to replace python's byte code with nested

Re: Rule of order for dot operators?

2015-05-18 Thread Ron Adam
On 05/18/2015 09:32 PM, Rustom Mody wrote: >In particular, each .foo() need not return a string - it might return anything, >and the following .bah() will work on that anything. For an arbitrary binary operator ◼ x ◼ y ◼ z can group as (x◼y)◼z or x◼(y◼z) One could (conceivably) apply the same

Re: Rule of order for dot operators?

2015-05-19 Thread Ron Adam
On 05/19/2015 02:25 AM, Chris Angelico wrote: On Tue, May 19, 2015 at 12:43 PM, Ron Adam wrote: >Having just implementing something similar for nested scopes, it turns out >it can't be operators because if it was, then the names y and z would be >resolved in the wrong scope.

Re: Set a flag on the function or a global?

2015-06-15 Thread Ron Adam
On 06/15/2015 08:07 PM, Chris Angelico wrote: On Tue, Jun 16, 2015 at 9:57 AM, Steven D'Aprano wrote: >I have two ideas for this, a module-level global, or a flag set on the >function object itself. Remember that the usual way of using this will be >"from module import edir", there are two o

Re: Set a flag on the function or a global?

2015-06-16 Thread Ron Adam
On 06/16/2015 05:15 AM, Steven D'Aprano wrote: On Tuesday 16 June 2015 10:24, Ron Adam wrote: >Another way is to make it an object with a __call__ method. > >The the attribute can be accessed from both outside and inside dependably. That's what functions are, objects wit

Re: Lawful != Mutable (was Can Python function return multiple data?)

2015-06-21 Thread Ron Adam
On 06/20/2015 10:50 PM, Rustom Mody wrote: Here is Eric Snow: | Keep in mind that by "immutability" I'm talking about*really* | immutable, perhaps going so far as treating the full memory space | associated with an object as frozen. For instance, we'd have to | ensure that "immutable" Python

Re: (side-)effects and ...

2015-07-05 Thread Ron Adam
On 07/05/2015 04:29 PM, Stefan Ram wrote: But why do we not have a common and well-known term for the counterpart, that something does not modify the state of the world, but that the state of the world does influence the value (behaviour) of a call such as »datetime.datetime.now

Re: Fastest Way To Loop Through Every Pixel

2006-07-29 Thread Ron Adam
Chaos wrote: > As my first attempt to loop through every pixel of an image, I used > > for thisY in range(0, thisHeight): > for thisX in range(0, thisWidth): > #Actions here for Pixel thisX, thisY > > But it takes 450-1000 milliseconds > > I want speeds less

Re: String.digits help!!!

2006-08-09 Thread Ron Adam
[EMAIL PROTECTED] wrote: > Simon Forman: > >> accessing it from a >> module (perhaps math.. math.infinity, math.epsilon, etc., just like >> math.pi and math.e.) > > It too looks acceptable. > > >> I look forward to hearing your thoughts an the subject. > > Thank you, but I am not expert enoug

Easy Validators

2006-08-20 Thread Ron Adam
Sometimes it's good to check things while working on them. This seems like a good way to do that. You could probably put these in a module and just import them. from validators import * I'm interested if anyone can think of ways to improve this further. Each validator consists of an as

Re: Painless way to do 3D visualization

2006-10-08 Thread Ron Adam
Peter Beattie wrote: > Hey folks, > > I need to do the following relatively simple 3D programming: > > I want to convert data from four-item tuples into 3D co-ordinates in a > regular tetrahedron. Co-ordinates come in sequences of 10 to 20, and the > individual dots in the tetrahedron need to be

Re: 3D Vector Type Line-Drawing Program

2006-10-10 Thread Ron Adam
Scott David Daniels wrote: > James Stroud wrote: >>> I'm looking for a program to do line-drawings in 3d, with output to >>> postscript or svg or pdf, etc. I would like to describe a scene with >>> certain 1-3d elements oriented in 3d space with dashed or colored >>> lines and filled or transpar

Re: 3D Vector Type Line-Drawing Program

2006-10-12 Thread Ron Adam
Scott David Daniels wrote: > Ron Adam wrote: >> Scott David Daniels wrote: >>> James Stroud wrote: >>>>> I'm looking for a program to do line-drawings in 3d, with output to >>>>> postscript or svg or pdf, etc. I would like to describe a scene

Alphabetical sorts

2006-10-16 Thread Ron Adam
I have several applications where I want to sort lists in alphabetical order. Most examples of sorting usually sort on the ord() order of the character set as an approximation. But that is not always what you want. The solution of converting everything to lowercase or uppercase is closer, but

Re: Alphabetical sorts

2006-10-16 Thread Ron Adam
Neil Cerutti wrote: > On 2006-10-16, Ron Adam <[EMAIL PROTECTED]> wrote: >> I have several applications where I want to sort lists in >> alphabetical order. Most examples of sorting usually sort on >> the ord() order of the character set as an approximation. But >

Re: Alphabetical sorts

2006-10-17 Thread Ron Adam
Neil Cerutti wrote: > On 2006-10-17, Ron Adam <[EMAIL PROTECTED]> wrote: >> Neil Cerutti wrote: >>> On 2006-10-16, Ron Adam <[EMAIL PROTECTED]> wrote: >>>> I have several applications where I want to sort lists in >>>> alphabetical order.

Re: Need a strange sort method...

2006-10-17 Thread Ron Adam
sequence as a list. """ def iterinner(seq): for s in seq: if hasattr(s, '__iter__'): for i in iterinner(s): yield i else: yield s return list(iterinner(sequence)) Cheers, Ron Adam -- http://mail.python.org/mailman/listinfo/python-list

Re: Need a strange sort method...

2006-10-17 Thread Ron Adam
Ron Adam wrote: > Neil Cerutti wrote: >> On 2006-10-16, Tim Chase <[EMAIL PROTECTED]> wrote: >>> If you need it in a flat list, rather than as a list of >>> chunk_size lists (which are handy for iterating over in many >>> cases), there are ways of obtain

Flexable Collating (feedback please)

2006-10-17 Thread Ron Adam
ed this in *anything* yet, so don't plug it into production code of any type. I also haven't done any performance testing. See the doc tests below for examples of how it's used. Cheers, Ron Adam """ Collate.py A general purpose configurable collate

Re: Flexable Collating (feedback please)

2006-10-18 Thread Ron Adam
Fixed... Changed the collate() function to return None the same as sort() since it is an in place collate. A comment in _test() doctests was reversed. CAPS_FIRST option puts words beginning with capitals before, not after, words beginning with lower case of the same letter. It seems I alw

Re: [OT] a little about regex

2006-10-18 Thread Ron Adam
Fulvio wrote: > *** > Your mail has been scanned by InterScan MSS. > *** > > > Hello, > > I'm trying to get working an assertion which filter address from some domain > but if it's prefixed by '.com'. > Even trying to put the result in a negate test I can

Re: How to convert this list to string?

2006-10-18 Thread Ron Adam
Jia Lu wrote: > Hi all > > I have a list like: > list > [1, 2, 3] list[1:] > [2, 3] > > I want to get a string "2 3" > str(list[1:]) > '[2, 3]' > > How can I do that ? > > thanks Just to be different from the other suggestions... >>> a = [1, 2, 3] >>> str(a[1:]).strip('[]'

Re: Flexable Collating (feedback please)

2006-10-18 Thread Ron Adam
[EMAIL PROTECTED] wrote: > > On Oct 18, 2:42 am, Ron Adam <[EMAIL PROTECTED]> wrote: >> I put together the following module today and would like some feedback on any >> obvious problems. Or even opinions of weather or not it is a good approach. > ,,, >

Re: Flexible Collating (feedback please)

2006-10-18 Thread Ron Adam
ommas in numerals PERIOD_AS_COMMAS-> Periods can separate numerals. * See doctests for examples. Author: Ron Adam, [EMAIL PROTECTED] """ __version__ = '0.02 (pre-alpha) 10/18/2006' import re import locale import string locale.setlocale(locale.LC_AL

Re: Flexable Collating (feedback please)

2006-10-18 Thread Ron Adam
Thanks, But I fixed it already. (almost) ;-) I think I will use strings as you suggest, and verify they are valid so a type don't go though silently. I ended up using string based option list. I agree a space separated string is better and easier from a user point of view. The advantage of

Re: Flexable Collating (feedback please)

2006-10-18 Thread Ron Adam
This is how I changed it... (I edited out the test and imports for posting here.) locale.setlocale(locale.LC_ALL, '') # use current locale settings class Collate(object): """ A general purpose and configurable collator class. """ options = [ 'CAPS_FIRST', 'NUMERICAL', 'HYPHEN

Re: Flexable Collating (feedback please)

2006-10-18 Thread Ron Adam
Gabriel Genellina wrote: > At Wednesday 18/10/2006 03:42, Ron Adam wrote: > >> I put together the following module today and would like some feedback >> on any >> obvious problems. Or even opinions of weather or not it is a good >> approach. >>

Re: Flexible Collating (feedback please)

2006-10-19 Thread Ron Adam
Leo Kislov wrote: > Ron Adam wrote: > >> locale.setlocale(locale.LC_ALL, '') # use current locale settings > > It's not current locale settings, it's user's locale settings. > Application can actually use something else and you will overwrite &g

Re: Flexible Collating (feedback please)

2006-10-19 Thread Ron Adam
[EMAIL PROTECTED] wrote: > Ron Adam: > > Insted of: > > def __init__(self, flags=[]): > self.flags = flags > self.numrex = re.compile(r'([\d\.]*|\D*)', re.LOCALE) > self.txtable = [] > if HYPHEN_AS_SPACE in flag

Re: Flexable Collating (feedback please)

2006-10-19 Thread Ron Adam
Gabriel Genellina wrote: > At Wednesday 18/10/2006 21:36, Ron Adam wrote: >> Maybe changing the CAPS_FIRST to REVERSE_CAPS_ORDER would do? > > At least it's a more accurate name. > There is an indirect way: test locale.strcoll("A","a") and see

Re: [OT] a little about regex

2006-10-19 Thread Ron Adam
Fulvio wrote: > *** > Your mail has been scanned by InterScan MSS. > *** > > > On Wednesday 18 October 2006 15:32, Ron Adam wrote: > >> |Instead of using two separate if's, Use an if - elif and be sure to test > > T

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

2006-10-19 Thread Ron Adam
James Stroud wrote: > Of course, I think str.join can operate on iterators, as Paul Rubin > suggests: > > > print ''.join(reversed(x)) > > This latter approach still seems a little clunky, though. > > James Slices can be named so you could do... >>> reverser = slice(None, None, -1) >>> >

Re: Flexible Collating (feedback please)

2006-10-20 Thread Ron Adam
Leo Kislov wrote: > Ron Adam wrote: >> Leo Kislov wrote: >>> Ron Adam wrote: >>> >>>> locale.setlocale(locale.LC_ALL, '') # use current locale settings >>> It's not current locale settings, it's user's locale setting

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

2006-10-21 Thread Ron Adam
Steven D'Aprano wrote: > On Thu, 19 Oct 2006 20:07:27 -0400, Brad wrote: > >> Steven D'Aprano wrote: >> >>> Gah!!! That's *awful* in so many ways. >> Thanks... I'm used to hearing encouragement like that. After a while you >> begin to believe that everything you do will be awful, so why even >>

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

2006-10-21 Thread Ron Adam
Steven D'Aprano wrote: > On Sat, 21 Oct 2006 01:58:33 -0500, Ron Adam wrote: > >> [You said from an earlier post...] >> >>> (That's a complaint I have about the dis module -- it prints its results, >>> instead of returning them as a string. That makes

Re: PSF Infrastructure has chosen Roundup as the issue tracker for Python development

2006-10-22 Thread Ron Adam
Kay Schluehr wrote: > Anna Ravenscroft wrote: > >> Interestingly enough, the quote of the day from Google on this email was: >> >> Never doubt that a small group of thoughtful, committed citizens can >> change the world; indeed, it's the only thing that ever has. >> Margaret Mead > > Commitment.

Collate Module

2006-10-23 Thread Ron Adam
'nut-pecan', 'Nut' ] collate(tlist, 'caps_first hyphen_as_space') * For more examples see doctests in function test(). Author: Ron Adam, [EMAIL PROTECTED] """ import re import locale import string __version__ = '0.03

Re: Style for modules with lots of constants

2006-11-01 Thread Ron Adam
Neil Cerutti wrote: > On 2006-11-01, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> Neil Cerutti: >>> scriptref = glk.fileref_create_by_prompt('Transcript+TextMode', >>>'WriteAppend', 0) >> That "+" sign seems useless. A space looks enough to me. The >> functions can accept case-agnostic strin

Re: Py3K idea: why not drop the colon?

2006-11-10 Thread Ron Adam
Michael Hobbs wrote: > The same problem that is solved by not having to type parens around the > 'if' conditional, a la C and its derivatives. That is, it's unnecessary > typing to no good advantage, IMHO. I was coding in Ruby for several > months and got very comfortable with just typing the i

Re: Py3K idea: why not drop the colon?

2006-11-10 Thread Ron Adam
Michael Hobbs wrote: > Ron Adam wrote: >> The faq also pointed out a technical reason for requiring the colon. It >> makes >> the underlying parser much easier to write and maintain. This shouldn't be >> taken to lightly in my opinion, because a simpler easer t

Re: Py3K idea: why not drop the colon?

2006-11-10 Thread Ron Adam
Michael Hobbs wrote: > Ron Adam wrote: >> It is also an outline form that frequently used in written languages. >> Something >> python tries to do, is to be readable as if it were written in plain >> language >> where it is practical to do so. So the c

Re: Py3K idea: why not drop the colon?

2006-11-10 Thread Ron Adam
Steven D'Aprano wrote: > On Fri, 10 Nov 2006 21:24:50 +0100, Bjoern Schliessmann wrote: > >> Marc 'BlackJack' Rintsch wrote: >> >>> No it doesn't -- look again at the example given above. It's >>> legal syntax in Python but doesn't have the semantics implied by >>> the example. >> Sorry, I don't

Re: Py3K idea: why not drop the colon?

2006-11-10 Thread Ron Adam
Paul Boddie wrote: > Ron Adam wrote: >> PS. Rather than shav of on character her and ther in pythons programing >> languag, Lets remov all the silent leters from the english languag. That will >> sav thousands mor kestroks over a few yers. > > How about changing Pyt

Re: Py3K idea: why not drop the colon?

2006-11-11 Thread Ron Adam
Steven D'Aprano wrote: > On Sat, 11 Nov 2006 01:13:03 -0600, Ron Adam wrote: > >> Steven D'Aprano wrote: >>> On Fri, 10 Nov 2006 21:24:50 +0100, Bjoern Schliessmann wrote: >>> >>>> Marc 'BlackJack' Rintsch wrote: >>>> >&

Re: Py3K idea: why not drop the colon?

2006-11-11 Thread Ron Adam
Georg Brandl wrote: > Ron Adam wrote: >> Michael Hobbs wrote: >> >>> The same problem that is solved by not having to type parens around the >>> 'if' conditional, a la C and its derivatives. That is, it's unnecessary >>> typing to

Re: Py3K idea: why not drop the colon?

2006-11-11 Thread Ron Adam
Georg Brandl wrote: > Ron Adam wrote: >> Georg Brandl wrote: >>> Ron Adam wrote: >>>> Michael Hobbs wrote: >>>> >>>>> The same problem that is solved by not having to type parens around the >>>>> 'if' condition

Re: Py3K idea: why not drop the colon?

2006-11-11 Thread Ron Adam
[EMAIL PROTECTED] wrote: > > I'm not sure why '\'s are required to do multi-line before the > colon. > Special cases aren't special enough to break the rules. > > Georg > >>> A bit of a circular answer. > >>> > >>> Why the rule? -> So not to break t

Re: Py3K idea: why not drop the colon?

2006-11-13 Thread Ron Adam
Michael Hobbs wrote: > Ron Adam wrote: >> LOL, of course it would. I would expect that too after a suitable amount >> of >> 'brain washing', oops, I mean training and conditioning. ;-) >> > Trust me, my brain is quite filthy and doesn't wash ea

Re: Py3K idea: why not drop the colon?

2006-11-13 Thread Ron Adam
Michael Hobbs wrote: > Ron Adam wrote: >> [EMAIL PROTECTED] wrote: >> >>> >>>>> I'm not sure why '\'s are required to do multi-line before the >>> colon. >>> >>>> Special cases aren't special en

Re: Py3K idea: why not drop the colon?

2006-11-13 Thread Ron Adam
Michael Hobbs wrote: > Ron Adam wrote: >> Michael Hobbs wrote: >> >>> Ron Adam wrote: >>> >>>> LOL, of course it would. I would expect that too after a suitable amount >>>> of >>>> 'brain washing', oops, I

Re: Py3K idea: why not drop the colon?

2006-11-16 Thread Ron Adam
Steve Holden wrote: > I'm always surprised by the amount of energy that's put into this type > of discussion - even the OP has suggested that this isn't a big issue. > If it's not a big issue why is this thread still going? Every language > has a syntax. Why not just accept it as a given and ge

Re: OO on python real life tutorial?

2006-09-02 Thread Ron Adam
filippo wrote: > Hello, > > I coded my +10k lines app using Perl/Tk. It is something like a hotel > software manager, it has a bunch of windows to manage the arrivals, > bills etc etc. I want to port this on Python/WxPython but I'd like to > get benefit of python, not just doing a row by row raw p

Re: Decimal() instead of float?

2006-11-17 Thread Ron Adam
Michael B. Trausch wrote: > On Fri, 2006-11-17 at 21:25 +0100, Fredrik Lundh wrote: >> > Some of the lat/long pairs that I have used seem to come out fine, but >> > some do not. Because the mathmatics used with them involve complex >> > equations when determining distance and the like, any error

Re: sort one list using the values from another list

2006-02-26 Thread Ron Adam
[EMAIL PROTECTED] wrote: > Your solution Steven Bethard looks very intelligent, here is a small > speed test, because sorting a list according another one is a quite > common operation. > (Not all solutions are really the same, as Alex has shown). Try this one. def psort10(s1, s2): d = dict

Re: sort one list using the values from another list

2006-02-26 Thread Ron Adam
Alex Martelli wrote: > Ron Adam <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] wrote: >>> Your solution Steven Bethard looks very intelligent, here is a small >>> speed test, because sorting a list according another one is a quite >>> common ope

Re: sort one list using the values from another list

2006-02-26 Thread Ron Adam
[EMAIL PROTECTED] wrote: >> It's faster on my system because d.keys() is already sorted. But that may >> not be the case on other versions of python.< > > In my version it's a little slower. But what system are you using where > keys is already sorted? IronPython maybe? > > Bye, > bearophile

Re: sort one list using the values from another list

2006-02-26 Thread Ron Adam
Alex Martelli wrote: > Ron Adam <[EMAIL PROTECTED]> wrote: >... >> Considering the number time I sort keys after getting them, It's the >> behavior I would prefer. Maybe a more dependable dict.sortedkeys() >> method would be nice. ;-) > > sorte

Re: sort one list using the values from another list

2006-02-26 Thread Ron Adam
Delaney, Timothy (Tim) wrote: > Ron Adam wrote: > >> Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] >> on win32 >> >> I was a bit surprised by them being sorted. I just happend to try >> d.keys() in place of s2, and it sped up. I wa

Re: sort one list using the values from another list

2006-02-27 Thread Ron Adam
Ron Adam wrote: > Alex Martelli wrote: >> Ron Adam <[EMAIL PROTECTED]> wrote: >>... >>> Considering the number time I sort keys after getting them, It's the >>> behavior I would prefer. Maybe a more dependable dict.sortedkeys() >>> method

Re: sort one list using the values from another list

2006-02-27 Thread Ron Adam
Scott David Daniels wrote: > Ron Adam wrote: >> Ron Adam wrote: >> This probably should be: >> >> def psort11(s1, s2): >> d = dict(zip(s2,s1)) >> assert len(d) == len(s1) >> s1[:] = list(d[v] for v in sorted(d)) > > You could d

Re: sort one list using the values from another list

2006-02-28 Thread Ron Adam
[EMAIL PROTECTED] wrote: > Following Ron Adam solution (and using [] instead of list() in the last > line), this may be a possible solution of the problem, that is often > quite fast: > > def psort16(s1, s2): > try: > d = dict(izip(s2, s1)) > except TypeE

Re: New Python regex Doc

2005-05-07 Thread Ron Adam
Xah Lee wrote: > Let me expose one another fu Hello Xah, I think you will continue to have difficulty getting respect on this matter as long as you show disrespect to those who have come before you. When you refer to the documentation as being f'ing stupid, and other disrespectful terms, y

Re: __brace__ (PEP?)

2005-05-09 Thread Ron Adam
James Stroud wrote: > Hello All, > > If "__call__" allows anobject() and "__getitem__" allows anobject[arange], > why > not have "__brace__" (or some other, better name) for anobject{something}. > Such braces might be useful for cross-sectioning nested data structures: > > anary = [[1,2,3],[4,

Re: Python 2.4 & BLT ?

2005-05-10 Thread Ron Adam
StepH wrote: > Hi, > > I'm not able to install BLT on my Python 2.4 (upgraded to 2.4.1) > distibution... > > I'v try to download btlz-for-8.3.exe, but when i try to install it, i've > a msgbox saying to the file is corrupt... > > Any idea ? > > Thanks. > > StepH. Have you tried blt2.4z-for-

Re: Python Graphing Utilities.

2005-05-10 Thread Ron Adam
Kenneth Miller wrote: > Hello All, > > I am new to Python and i was wondering what graphing utlities would be > available to me. I have already tried BLT and after weeks of unsuccesful > installs i'd like to find something else. Anything someone would recommend? > > Regards, > Ken BLT does

Re: Python 2.4 & BLT ?

2005-05-11 Thread Ron Adam
StepH wrote: > Ron Adam a écrit : > >>StepH wrote: >> >> >>>Hi, >>> >>>I'm not able to install BLT on my Python 2.4 (upgraded to 2.4.1) >>>distibution... >>> >>>I'v try to download btlz-for-8.3.exe, but when

Re: Python 2.4 & BLT ?

2005-05-12 Thread Ron Adam
StepH wrote: > Ron Adam a écrit : > >>StepH wrote: >> >> >>>Ron Adam a écrit : >>> >>> >>>>StepH wrote: >>>> >>>> >>>> >>>>>Hi, >>>>> >>>>>I'm

Re: Python Documentation (should be better?)

2005-05-12 Thread Ron Adam
Steven Bethard wrote: > Skip Montanaro wrote: > >>Mike> Given that Python hides the difference between user-defined >>Mike> objects and built-in objects, it's not clear to me that anything >>Mike> other than the current system, with all the classes/types in one >>Mike> place, make

Re: Python Documentation (should be better?)

2005-05-13 Thread Ron Adam
Steven Bethard wrote: > Ron Adam wrote: > >>What I would like to see is something like the following for each item: >> >>0. reference @ sequence code >>2. "Builtin" | "import " >>3. Type/class: Name/Syntax >>4. Description with ex

Re: Python 2.4 & BLT ?

2005-05-14 Thread Ron Adam
StepH wrote: >> >> A little googling found the following which may give you a clue or >> ideas of further searches. Also run a virus scanner on the file >> before hand. >> >> http://www.noteworthysoftware.com/composer/faq/90.htm > > > Argg... I always find me stupid when i don't have find my

Quick Reference from module doc strings.

2005-05-14 Thread Ron Adam
Does anyone have suggestions on how to improve this further? Cheers, Ron_Adam def getobjs(object, dlist=[], lvl=0, maxlevel=1): """ Retrieve a list of sub objects from an object. """ if object not in dlist: dlist.append(object) if lvl200: s = object[0:

Exception question

2005-05-14 Thread Ron Adam
I'm trying to understand exception handling better and have a question I haven't been able to find an answer too. Which probably means It won't work, but... Do exceptions that take place get stored in a stack or list someplace? For example in: try: try: try: riskyf

Re: Exception question

2005-05-15 Thread Ron Adam
Steven Bethard wrote: > Ron Adam wrote: > >>Do exceptions that take place get stored in a stack or list someplace? > > [snip] > >>I know I can catch the error and store it myself with, >> >>except Exception, exc: >> >>or possibly, >

Re: Precision?

2005-05-15 Thread Ron Adam
tiissa wrote: > Steffen Glückselig wrote: > >1.0 + 3.0 + 4.6 >> >>8.5996 >> >>Ehm, how could I get the intuitively 'correct' result of - say - 8.6? >>;-) > > > You may find annex B of the python tutorial an interesting read: > http://docs.python.org/tut/node16.html In addition t

Re: Quick Reference from module doc strings.

2005-05-15 Thread Ron Adam
I think this deserves a little more of a description than I gave it initially. The routine in the previous message does a little more than just print out __doc__ strings. It outputs a formatted alphabetical list of objects in a module with each objects, name, class or type, and then tries to

Re: Quick Reference from module doc strings.

2005-05-15 Thread Ron Adam
John Machin wrote: > Ron Adam wrote: > >>Does anyone have suggestions on how to improve this further? > > > Not functionally (from me, yet). However if you can bear a stylistic > comment, do read on :-) > > >> elif (isinstance(object,str) >>

Re: Precision?

2005-05-15 Thread Ron Adam
Ron Adam wrote: > tiissa wrote: > >>Steffen Glückselig wrote: >> >> >>>>>>1.0 + 3.0 + 4.6 >>> >>>8.5996 >>> >>>Ehm, how could I get the intuitively 'correct' result of - say - 8.6

Re: Quick Reference from module doc strings.

2005-05-15 Thread Ron Adam
Scott David Daniels wrote: > Althought object is a horrible name for your own value (there is a builtin > object which you use for defining new-style classes), you probably want: Good point, I agree. It's a bad habit to start, sooner or later it would cause a problem. I'll find something else

Re: Quick Reference from module doc strings.

2005-05-16 Thread Ron Adam
Scott David Daniels wrote: > Ron Adam wrote: > >>Do you have any feature suggestions, additional information that could >>go in, something that would extend the content in some way and make it >>more useful? >> >>As it stands now, it could be just a module,

Re: Quick Reference from module doc strings.

2005-05-17 Thread Ron Adam
Michele Simionato wrote: >>Do you have any feature suggestions, additional information that > > could > >>go in, something that would extend the content in some way and make > > it > >>more useful? > > > I have written something similar which I use all the time. It generates > ReST > output w

Re: Quick Reference from module doc strings.

2005-05-17 Thread Ron Adam
Michele Simionato wrote: > Ron Adam: > > >>Sound great! Adding a command line parser, I'm going to add a brief ^---^ That part should have been deleted, I meant your whole program sounded good, not just that part. :-) >>

Re: Quick Reference from module doc strings.

2005-05-17 Thread Ron Adam
Scott David Daniels wrote: > Ron Adam wrote: > >> ...What would be the advantage of using StringIO over list.append with >> ''.join()? > > The advantage is more in using a function that prints as it goes > rather than building up a large string to print.

Re: Representing ambiguity in datetime?

2005-05-17 Thread Ron Adam
John Machin wrote: > On Tue, 17 May 2005 17:38:30 -0500, Terry Hancock > <[EMAIL PROTECTED]> wrote: > > >>What do you do when a date or time is >>incompletely specified? ISTM, that as it is, there is no >>formal way to store this --- you have to guess, and there's >>no way to indicate that the

Re: Quick Reference from module doc strings.

2005-05-17 Thread Ron Adam
Michele Simionato wrote: > Ron Adam: > >>Thats part of what I'm trying to resolve, the doc strings a lot of > > time > >>isn't enough by itself or is missing. So I'm trying to build up a >>complete enough record so if there is no doc string, at

Re: Sorting x lists based on one list ... maybe an example would make sense:

2005-05-18 Thread Ron Adam
Philippe C. Martin wrote: >>Another way would be to merge the three lists into one of 3-tuples, sort, >>and unmerge, similarly to the DSU pattern -- which raises the question: >>why are you using three lists in the first place? > > > :-) Thanks, the lists will evolve and are also stored in 'csv'

<    1   2   3   4   >