Finding decorators in a file

2007-10-26 Thread Andrew West
Probably a bit of weird question. I realise decorators shouldn't be executed until the function they are defined with are called, but is there anyway for me to find all the decorates declared in a file when I import it? Or perhaps anyway to find the decorators by loading the file by other methods

Re: Going past the float size limits?

2007-10-26 Thread Steven D'Aprano
On Fri, 26 Oct 2007 16:29:34 -0700, jimmy.musselwhite wrote: > On Oct 26, 6:56 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: >> On 10/26/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> >> wrote: >> >> > Hello all >> > It would be great if I could make a number that can go beyond current >> > size limita

Re: Iteration for Factorials

2007-10-26 Thread Steven Bethard
Nicko wrote: > If you don't like the rounding errors you could try: > > def fact(n): > d = {"p":1L} > def f(i): d["p"] *= i > map(f, range(1,n+1)) > return d["p"] > > It is left as an exercise to the reader as to why this code will not > work on Py3K Serves yo

Meta-literals

2007-10-26 Thread Carl Banks
On Oct 26, 4:54 am, Lennart Benschop <[EMAIL PROTECTED]> wrote: > Python has had the Decimal data type for some time now. The Decimal data > type is ideal for financial calculations. Using this data type would be > more intuitive to computer novices than float as its rounding behaviour > matches mo

Re: Proposal: Decimal literals in Python.

2007-10-26 Thread Carl Banks
On Oct 26, 7:17 pm, "J. Cliff Dyer" <[EMAIL PROTECTED]> wrote: > Matimus wrote: > >> - Traling characters at the end of a literal are already used (the L > >> for long). > > > The trailing L is going away in Python 3.0. For your consideration may > > I suggest a '$' prefix. Though, I'm not sure I

RE: Finding decorators in a file

2007-10-26 Thread Ryan Ginstrom
> On Behalf Of Andrew West > Basically what I'm looking for is a way to, given a python file, look > through that file and find all the decorators and the associated > functions, that includes any arguments that the decorator has. The inspect module has a function called "findsource" import ins

Re: Proposal: Decimal literals in Python.

2007-10-26 Thread Terry Reedy
"Shane Geiger" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] a buggy hack (copying your top post style) >>> D(123456789.123456789) Decimal("123456789.123") Or what there an unwritten :-)? | D = lambda x: decimal.Decimal(str(x)) | | >> D(3.2) | Decimal("3.2") -- http://mail.

simple question on dictionary usage

2007-10-26 Thread Frank Stutzman
My apologies in advance, I'm new to python Say, I have a dictionary that looks like this: record={'BAT': '14.4', 'USD': '24', 'DIF': '45', 'OAT': '16', 'FF': '3.9', 'C3': '343', 'E4': '1157', 'C1': '339', 'E6': '1182', 'RPM': '996', 'C6': '311', 'C5': '300', 'C4': '349',

resurrected modindex

2007-10-26 Thread skip
A long time ago I wrote a redirector to note and display the most frequently requested modules from the library reference manual's global module index. When Georg Brandl did his massive rewrite of the Python manuals that broke. I finally took the time this evening to resurrect that function. The r

Re: delineating by comma where commas inside quotation marks don't count

2007-10-26 Thread Junior
"Dan Bishop" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Oct 24, 8:56 pm, "Junior" <[EMAIL PROTECTED]> wrote: >> I want to open a text file for reading and delineate it by comma. I also >> want any data >> surrounded by quotation marks that has a comma in it, not to count th

Re: simple question on dictionary usage

2007-10-26 Thread Edward Kozlowski
On Oct 26, 11:29 pm, Frank Stutzman <[EMAIL PROTECTED]> wrote: > My apologies in advance, I'm new to python > > Say, I have a dictionary that looks like this: > > record={'BAT': '14.4', 'USD': '24', 'DIF': '45', 'OAT': '16', > 'FF': '3.9', 'C3': '343', 'E4': '1157', 'C1': '339', > '

Re: simple question on dictionary usage

2007-10-26 Thread Karthik Gurusamy
On Oct 26, 9:29 pm, Frank Stutzman <[EMAIL PROTECTED]> wrote: > My apologies in advance, I'm new to python > > Say, I have a dictionary that looks like this: > > record={'BAT': '14.4', 'USD': '24', 'DIF': '45', 'OAT': '16', > 'FF': '3.9', 'C3': '343', 'E4': '1157', 'C1': '339', > 'E

Re: Python Windows Installation

2007-10-26 Thread Tim Roberts
Bjoern Schliessmann <[EMAIL PROTECTED]> wrote: > >The last app I saw that had problems with whitespace was Worms 2 >(1997). YMMV (and I'm interested in it). If only. Even the very latest Microsoft WDK (Windows Driver Kit, formerly known as the DDK) cannot successfully build drivers if the source

Re: Bypassing __getattribute__ for attribute access

2007-10-26 Thread Michele Simionato
On Oct 25, 5:07 pm, Adam Donahue <[EMAIL PROTECTED]> wrote: > As an exercise I'm attempting to write a metaclass that causes an > exception to be thrown whenever a user tries to access > 'attributes' (in the traditional sense) via a direct reference. Well, now thanks to Bruno and the others you kn

RE: simple question on dictionary usage

2007-10-26 Thread Ryan Ginstrom
> On Behalf Of Edward Kozlowski > I think this should do the trick. There's probably something > more concise than this, but I can't think of it at the moment. > > egt = {} > for key in record: > if key.startswith('E'): > egt[key] = record[key] Not much more concise, but another way

Re: Proposal: Decimal literals in Python.

2007-10-26 Thread Marc 'BlackJack' Rintsch
On Fri, 26 Oct 2007 19:29:47 -0400, J. Cliff Dyer wrote: > Ben Finney wrote: >> So, the original poster might get further by proposing an '0dNNN.NNN' >> syntax for 'decimal.Decimal' literals. > It would rather be remarkably inconsistent and confusing. > > Python 3.0a1 (py3k:57844, Aug 31 2007,

transmit an array via socket

2007-10-26 Thread Jeff Pang
I want to transmit an array via socket from a host to another. How to do it? thank you. --jeff _ Largest network of startups. Find new startup opportunities. Click here. http://thirdpartyoffers.juno.com/TGL2111/fc/Ioyw6iieVGxKk95ANW9UY46Z

Re: simple question on dictionary usage

2007-10-26 Thread Frank Millman
Frank Stutzman wrote: > My apologies in advance, I'm new to python > > Say, I have a dictionary that looks like this: > > record={'BAT': '14.4', 'USD': '24', 'DIF': '45', 'OAT': '16', > 'FF': '3.9', 'C3': '343', 'E4': '1157', 'C1': '339', > 'E6': '1182', 'RPM': '996', 'C6': '311',

Re: simple question on dictionary usage

2007-10-26 Thread Frank Millman
> > This should work - > > egt = dict([i for i in d.items() if i[0].startswith('E')]) > Of course I meant record.items(), not d.items(). Sorry. Frank -- http://mail.python.org/mailman/listinfo/python-list

Re: Proposal: Decimal literals in Python.

2007-10-26 Thread Paul Rubin
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > assert 0b1 is 0x1 > That this doesn't raise `AssertionError` is an implementation detail. > It's not guaranteed the two objects are really the same. I think Ben is getting at 0b1 and 0x1 being the same type, while the proposed 0d1 is a d

Re: tuples within tuples

2007-10-26 Thread korovev76
On 26 Ott, 23:33, Stargaming <[EMAIL PROTECTED]> wrote: > He certainly is -- *you* are misreading *him*. The nit he's picking is > the non-terminated string (quotation mark/apostrophe missing). > right, now i got it! beside this, i'm trying to use the reduceXML function proposed by Larry.. but I

Re: Finding decorators in a file

2007-10-26 Thread Kay Schluehr
On Oct 27, 3:14 am, Andrew West <[EMAIL PROTECTED]> wrote: > Probably a bit of weird question. I realise decorators shouldn't be > executed until the function they are defined with are called, but is > there anyway for me to find all the decorates declared in a file when > I import it? Or perhaps

Re: simple question on dictionary usage

2007-10-26 Thread Frank Millman
On Oct 27, 8:02 am, Frank Millman <[EMAIL PROTECTED]> wrote: > > This should work - > > > egt = dict([i for i in d.items() if i[0].startswith('E')]) > > Of course I meant record.items(), not d.items(). Sorry. > > Frank On reflection, although my solution is a bit shorter than some others, it may n

<    1   2