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: 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: 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: 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: 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: 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

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: 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

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-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: python admin abuse complaint

2010-02-06 Thread Ron Adam
Xah Lee wrote: For anyone reading this thread and interested in my opinions, i have written many essays related to this and netiquette. Many of which detail other similar incidences that i personally experienced, such as freenode's irc ban in #emacs channel. If you are interested, they can be

Re: Intra-package References?? (again)

2008-01-29 Thread Ron Adam
[EMAIL PROTECTED] wrote: > Hi Python list, > > I have been struggleling with this before, but have never been able to > find a good solution. > The thing I dont understand is, I follow the guide here: > http://docs.python.org/tut/node8.html#SECTION00842 > And have the same setup

Re: time.time or time.clock

2008-01-13 Thread Ron Adam
Fredrik Lundh wrote: > John Machin wrote: > >> AFAICT that was enough indication for most people to use time.clock on >> all platforms ... > > which was unfortunate, given that time.clock() isn't even a proper clock > on most Unix systems; it's a low-resolution sample counter that can > happi

Re: time.time or time.clock

2008-01-13 Thread Ron Adam
John Machin wrote: > On Jan 14, 7:05 am, Ron Adam <[EMAIL PROTECTED]> wrote: >> I'm having some cross platform issues with timing loops. It seems >> time.time is better for some computers/platforms and time.clock others, but > > Care to explain why it seems

time.time or time.clock

2008-01-13 Thread Ron Adam
I'm having some cross platform issues with timing loops. It seems time.time is better for some computers/platforms and time.clock others, but it's not always clear which, so I came up with the following to try to determine which. import time # Determine if time.time is better than t

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-23 Thread Ron Adam
Scott David Daniels wrote: > Ron Adam wrote: >> Scott David Daniels wrote: >>> Ron Adam wrote: >>>> How about this? >>>> def integrate(fn, x1, x2, n=100):... >>> The point was a pedagogic suggestion, ... >> I understood your point.

Re: Factory function with keyword arguments

2007-09-23 Thread Ron Adam
Steven D'Aprano wrote: > On Sun, 23 Sep 2007 03:55:45 -0500, Ron Adam wrote: > >> Steven D'Aprano wrote: >>> I'm writing a factory function that needs to use keywords in the >>> produced function, not the factory. Here's a toy example: > >

Re: Factory function with keyword arguments

2007-09-23 Thread Ron Adam
Steven D'Aprano wrote: > I'm writing a factory function that needs to use keywords in the produced > function, not the factory. Here's a toy example: > I thought of doing this: > > def factory(flag): > if flag: kw = 'spam' > else: kw = 'ham' > def foo(obj, arg): > kwargs =

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-23 Thread Ron Adam
Scott David Daniels wrote: > Ron Adam wrote: >> >> Scott David Daniels wrote: >>> Cristian wrote: >>>> On Sep 21, 3:44 pm, Ron Adam <[EMAIL PROTECTED]> wrote: >>>> >>>>> I think key may be to discuss names and name binding

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-22 Thread Ron Adam
Scott David Daniels wrote: > Cristian wrote: >> On Sep 21, 3:44 pm, Ron Adam <[EMAIL PROTECTED]> wrote: >> >>> I think key may be to discuss names and name binding with your friend. > > Here's an idea: > > import math > > def sin_inte

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread Ron Adam
Cristian wrote: > On Sep 21, 3:44 pm, Ron Adam <[EMAIL PROTECTED]> wrote: > >> I think key may be to discuss names and name binding with your friend. How >> a name is not the object it self, like a variable is in other languages. >> For example show him how an

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread Ron Adam
Cristian wrote: > My hope is to subtly reinforce the notion that functions are data > and can be passed around. The current function declaration doesn't > help with this. Creating a function and assigning it to a name is > exactly what Python does, why not have it come out in the syntax? It's > n

Re: Python 3K or Python 2.9?

2007-09-21 Thread Ron Adam
Bruno Desthuilliers wrote: > Ron Adam a écrit : >> >> TheFlyingDutchman wrote: >> >>> I am not talking about the way it does it, but rather, the way it >>> could do it or... could have done it. That requires no knowledge of >>> how the int

Re: Python 3K or Python 2.9?

2007-09-21 Thread Ron Adam
TheFlyingDutchman wrote: > I am not talking about the way it does it, but rather, the way it > could do it or... could have done it. That requires no knowledge of > how the interpreter currently does it unless I am proposing something > that no interpreter in the world could ever do. Yes, there

Re: Break up list into groups

2007-07-20 Thread Ron Adam
Matimus wrote: > Excellent work! One more modification and I get below 10us/pass: > > def getgroups(seq): > groups = [] > push = groups.append > iseq = iter(xrange(len(seq))) > for start in iseq: > if seq[start] & 0x80: > for stop in iseq: >

Re: Break up list into groups

2007-07-17 Thread Ron Adam
Matt McCredie wrote: > That certainly is fast, unfortunately it doesn't pass all of the tests. > I came up with those tests so I don't know how important they are to the > original poster. I modified it and came up with a generator and a > non-generator version based (roughly) on your algorith

Re: Break up list into groups

2007-07-17 Thread Ron Adam
Matimus wrote: > I did some more experimenting and came up with the code below. It > shows several methods. When run, the script tests the robustness of > each method (roughly), and profiles it using timeit. The results from > running on my laptop are shown below the code. Try this one... def g

Re: webbrowser module bug?

2007-05-26 Thread Ron Adam
Paul Boddie wrote: > Ron Adam wrote: >> Reseting the default browser with the gnome default application window >> confirmed this. The browser selection can either have the quotes around >> the args "%s" paremteter, or not depending on how and what sets it. >&g

Re: webbrowser module bug?

2007-05-25 Thread Ron Adam
Ron Adam wrote: > Got it. > > It looks like the problem started when I told firefox to make itself > the default browser. That changed the way webbrowser.py figured out the > browser to use. So instead of trying them in order, it asked the gnome > configure too

Re: webbrowser module bug?

2007-05-25 Thread Ron Adam
Ron Adam wrote: > Paul Boddie wrote: >> On 25 May, 00:03, Ron Adam <[EMAIL PROTECTED]> wrote: >>> Is anyone else having problems with the webbrowser module? >>> >>> Python 2.5.1c1 (release25-maint, Apr 12 2007, 21:00:25) >>> [GCC 4.1.2 (Ubuntu 4.1

Re: webbrowser module bug?

2007-05-25 Thread Ron Adam
Paul Boddie wrote: > On 25 May, 00:03, Ron Adam <[EMAIL PROTECTED]> wrote: >> Is anyone else having problems with the webbrowser module? >> >> Python 2.5.1c1 (release25-maint, Apr 12 2007, 21:00:25) >> [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2 >> Type &qu

Re: webbrowser module bug?

2007-05-25 Thread Ron Adam
Steve Holden wrote: > Ron Adam wrote: >> [EMAIL PROTECTED] wrote: >>> On May 24, 5:03 pm, Ron Adam <[EMAIL PROTECTED]> wrote: >>>> Is anyone else having problems with the webbrowser module? >>>> >>>> Python 2.5.1c1 (release25-maint, A

Re: webbrowser module bug?

2007-05-25 Thread Ron Adam
Brian van den Broek wrote: > Ron Adam said unto the world upon 05/25/2007 12:28 PM: >> [EMAIL PROTECTED] wrote: >>> On May 24, 5:03 pm, Ron Adam <[EMAIL PROTECTED]> wrote: >>>> Is anyone else having problems with the webbrowser module? >>>> >>

Re: webbrowser module bug?

2007-05-25 Thread Ron Adam
[EMAIL PROTECTED] wrote: > On May 24, 5:03 pm, Ron Adam <[EMAIL PROTECTED]> wrote: >> Is anyone else having problems with the webbrowser module? >> >> Python 2.5.1c1 (release25-maint, Apr 12 2007, 21:00:25) >> [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2 >>

webbrowser module bug?

2007-05-24 Thread Ron Adam
Is anyone else having problems with the webbrowser module? Python 2.5.1c1 (release25-maint, Apr 12 2007, 21:00:25) [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import webbrowser >>> webbrowser.open('http://www.python.o

Re: PYDOC replacement. (Was:Sorting attributes by catagory)

2007-05-10 Thread Ron Adam
Nick Vatamaniuc wrote: > Thanks for the info, Ron. I had no idea pydoc was that powerful! > -Nick Change *was* to *will be*. It really needed to be re factored. ;-) Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: PYDOC replacement. (Was:Sorting attributes by catagory)

2007-05-09 Thread Ron Adam
Nick Vatamaniuc wrote: > Ron, > > Consider using epydoc if you can. Epydoc will sort the methods and it > will also let you use custom CSS style sheets for the final HTML > output. Check out the documentation of my PyDBTable module. > http://www.psipy.com/PyDBTable > > -Nick Vatamaniuc Hi Nick

Sorting attributes by catagory

2007-05-09 Thread Ron Adam
This is for a new version of pydoc if I can get the class attributes sorted out. The module level attributes aren't too difficult to categorize. (I might be just too tired to see the obvious.) The original pydoc did this a somewhat round about way, so I would like to find a more direct method

Re: pydoc and imported modules

2007-04-25 Thread Ron Adam
[EMAIL PROTECTED] wrote: > When I "from foo import *" in my __init__.py, sometimes module foo's > docs will be expanded in the pydocs. It seems to depend in what > language foo was implemented. > > For example, if you "from math import *" in your __init__.py, you will > see math's members will app

Re: Pydoc Rewrite Discussion at doc-sig list.

2007-04-14 Thread Ron Adam
Colin J. Williams wrote: > Ron Adam wrote: >> If anyone is interested in participating in discussing the details of the >> PyDoc rewrite/refactoring I've been working on, a discussion is being >> started on the doc-sig list. >> >> [EMAIL PROTECTED] >

Pydoc Rewrite Discussion at doc-sig list.

2007-04-13 Thread Ron Adam
an be submitted and a final discussion can take place on the python-dev list at a later date. Thanks and Regards, Ron Adam -- http://mail.python.org/mailman/listinfo/python-list

Re: from __future__ import absolute_import ?

2007-02-09 Thread Ron Adam
Peter Otten wrote: > Ron Adam wrote: > >> Peter Otten wrote: >>> Ron Adam wrote: >>> >>>> work >>>> | >>>> |- foo.py# print "foo not in bar" >>>> | >>>> `- bar

Re: PYTHONPATH or any other way to set seachpath (winXP) ?

2007-02-04 Thread Ron Adam
Stef Mientki wrote: >> Do you mean something like that? >> > import some_module >> Traceback (most recent call last): >> File "", line 1, in ? >> ImportError: No module named some_module > import sys > sys.path.append("..") > import some_module > Rob, > thank you very much, > that

Re: from __future__ import absolute_import ?

2007-02-03 Thread Ron Adam
Peter Otten wrote: > Ron Adam wrote: > >> >> work >> | >> |- foo.py# print "foo not in bar" >> | >> `- bar >> | >> |- __init__.py >> | >> |- foo.py# print "foo in

Re: from __future__ import absolute_import ?

2007-02-02 Thread Ron Adam
Peter Otten wrote: > Ron Adam wrote: > >> from __future__ import absolute_import >> >> Is there a way to check if this is working? I get the same results with >> or without it. >> >> Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) >> [MS

from __future__ import absolute_import ?

2007-02-02 Thread Ron Adam
from __future__ import absolute_import Is there a way to check if this is working? I get the same results with or without it. Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win 32 _Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Module name to filename and back?

2007-01-18 Thread Ron Adam
Ron Adam wrote: > Is there a function to find a filename from a dotted module (or package) name > without importing it? > > The imp function find_module() doesn't work with dotted file names. And it > looks like it may import the file as it raises an ImportError error exc

Module name to filename and back?

2007-01-18 Thread Ron Adam
Is there a function to find a filename from a dotted module (or package) name without importing it? The imp function find_module() doesn't work with dotted file names. And it looks like it may import the file as it raises an ImportError error exception if it can't find the module. (Shouldn

Re: assert versus print [was Re: The curious behavior of integer objects]

2007-01-16 Thread Ron Adam
Neil Cerutti wrote: > On 2007-01-16, Ron Adam <[EMAIL PROTECTED]> wrote: >> I have to admit that part of why assert seems wrong to me is >> the meaning of the word implies something you shouldn't be able >> to ignore. While warnings seem like somet

Re: assert versus print [was Re: The curious behavior of integer objects]

2007-01-16 Thread Ron Adam
Carl Banks wrote: > Ron Adam wrote: >> There have been times where I would like assert to be a little more assertive >> than it is. :-) >> >> ie.. not being able to turn them off with the -0/-00 switches, and having >> them >> generate a more verbose traceb

Re: assert versus print [was Re: The curious behavior of integer objects]

2007-01-15 Thread Ron Adam
Steven D'Aprano wrote: > On Mon, 15 Jan 2007 21:01:35 -0600, Ron Adam wrote: > > >> There have been times where I would like assert to be a little more >> assertive >> than it is. :-) >> >> ie.. not being able to turn them off with the -0/-00 switc

Re: assert versus print [was Re: The curious behavior of integer objects]

2007-01-15 Thread Ron Adam
Calvin Spealman wrote: > On 1/15/07, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> On Mon, 15 Jan 2007 17:50:56 -0500, Calvin Spealman wrote: >> >>> assert foo(0x10) == 0 # Assertions are much better tests than prints :-) >> I dispute that assertion (pun intended). > > Hah! > >> Firstly, print s

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: 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: 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-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: >> 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-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-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
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
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-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-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
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
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: > 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: 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

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: 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.

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: 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: 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-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: [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: 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: 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: 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: 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: 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
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: 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
[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: 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: [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: 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

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: 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

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: 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: 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 >

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: 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

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: 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: 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

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: 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

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: MS VC++ Toolkit 2003, where?

2006-04-25 Thread Ron Adam
Alex Martelli wrote: > Ron Adam <[EMAIL PROTECTED]> wrote: >... >> I still get the following with the tinyurl link: >> >> ~~~ >> The download you requested is unavailable. If you continue to see this >> message when trying to access this download, go

Re: MS VC++ Toolkit 2003, where?

2006-04-24 Thread Ron Adam
Alex Martelli wrote: > "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > >> Alex Martelli wrote: >>> As suggested to me by David Rushby 10 hours ago, >>> >>> http://www.microsoft.com/downloads/details.aspx?FamilyId=272BE09D-40BB-4 >>> 9FD-9CB0-4BFA122FA91B&displaylang=en >>> >>> does work. >> Can you

  1   2   3   4   >