Paolino wrote:
> Steven D'Aprano wrote:
>
> > def translate(text):
> > import string
> > all=string.maketrans('','')
> > badcars=all.translate(all,string.letters+string.digits)
> > table=string.maketrans(badcars,'_'*len(badcars))
> > return text.translate(table)
> >
> > No pollu
Paolino wrote:
> >>Even worse I get with methods and function namespaces.
> >
> > What is "even worse" about them?
> >
> For my thinking, worse is to understand how they derive their pattern
> from generic namespaces.
> Methods seems not to have a writeble one,while functions as George and
> Rob r
Franz Steinhaeusler wrote:
> Hello NG,
>
> I want to retrieve the members of a class
> with a baseclass.
> But the problem is, how to get the non derived
> members.
>
> class a:
> def who(self):
> print "who"
> def __init__(self):
> self._a = 3
>
> class b(a):
> def who
Franz Steinhaeusler wrote:
> Is there any possibility to simply get out
> the classes and baseclasses of a class?
>
> somfunc (y) => class A, B (where B is last).
If you use "new-style" classes, i.e. classes inheriting from object, it
is trivial:
class X(object):
pass
class Y1(X):
pass
"Lenny G." <[EMAIL PROTECTED]> wrote:
> Suppose I have a python module named Hippo. In the Hippo module is a
> class named Crypto. The Crypto class wants to 'from Crypto.Hash import
> SHA' which refers to the module/classes in python-crypto. Other
> classes in the Hippo module want to 'import C
"Terry Hancock" <[EMAIL PROTECTED]> wrote:
> On Monday 12 September 2005 10:09 pm, [EMAIL PROTECTED] wrote:
> > I like to keep my classes each in a separate file with the same name of
> > the class. The problem with that is that I end up with multiple imports
> > in the beginning of each file, lik
"Terry Hancock" <[EMAIL PROTECTED]> wrote:
> On Tuesday 13 September 2005 12:46 pm, George Sakkis wrote:
> > Or even better, forget about the braindead java restriction of one
> > class per file and organize your code as it makes more sense to you.
>
> W
Another epileptic seizure on the keyboard. Apart from clue deficit
disorder, this guy seems to suffer from some serious anger management
problems...*plonk*
"Xah Lee" <[EMAIL PROTECTED]> wrote:
> Python Doc Problem Example
>
> Quote from:
> http://docs.python.org/lib/module-os.path.html
>
"Chris" <[EMAIL PROTECTED]> wrote:
> Is there a way to make python create a list of Mondays for a given year?
>
> For example,
>
> mondays = ['1/3/2005','1/10/2005','1/17/2005','1/24/2005',
> '1/31/2005','2/7/2005', ... ]
Get the dateutil package (https://moin.conectiva.com.br/DateUtil):
impor
"Jason" <[EMAIL PROTECTED]> wrote:
> Please don't laugh, this is my FIRST Python script where I haven't
> looked at the manual for help...
Sooner or later you should ;)
> import string
Don't need it it modern python; use string methods instead.
> import random
>
> class hiScores:
The common c
"Peter Hansen" <[EMAIL PROTECTED]> wrote:
> George Sakkis wrote:
> > "Chris" <[EMAIL PROTECTED]> wrote:
> >>Is there a way to make python create a list of Mondays for a given year?
> >
> > Get the dateutil package (https://moin.cone
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Sorry, my description was not very good, I meant something behaving as:
>
> >>>example=Liter("abc","12345","XY")
> >>>for x in example: print x,
>
> a 1 X b 2 Y c 3 4 5
>
> or for that append() method,
>
> >>>example=Liter("abc", "12345"
"Jordan Rastrick" <[EMAIL PROTECTED]> wrote:
> I've written this kind of iterator before, using collections.deque,
> which personally I find a little more elegant than the list based
> approach:
Nice, that's *much* more elegant and simple ! Here's the class-based version
with append; note that
i
"Peter Hansen" <[EMAIL PROTECTED]> wrote:
> yoda wrote:
> > This feels like a stupid question but I'll ask it anyway.
> >
> > How can I process files chronologically (newest last) when using
> > os.walk()?
>
> Do you want the ordering to apply just to files within each directory,
> or to all the f
"Tony Houghton" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Can anyone recommend a good book for intermediate up to expert level?
> I'm an experienced C programmer and I learnt Python from the "Learning
> Python" O'Reilly book because it had good reviews. I was disappointed
> th
"Steven Bethard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Randall Smith wrote:
> > Jive Dadson wrote:
> >
> >> The traceback routine prints out stuff like,
> >>
> >> NameError: global name 'foo' is not defined
> >>
> >> NameError is a standard exception type.
> >>
> >> Wha
"Steven Bethard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Is there a good way to determine if an object is a numeric type?
> Generally, I avoid type-checks in favor of try/except blocks, but I'm
> not sure what to do in this case:
>
> def f(i):
> ...
> i
"Michael Hartl" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> As luck would have it, isnumber is a built-in Python function:
>
> >>> isnumber(1)
> True
> >>> isnumber(1.0)
> True
> >>> isnumber('1')
> False
>
> Michael
>
> --
> Michael D. Hartl, Ph.D.
> Chief Technology Officer
> h
> George Sakkis wrote:
> > "Steven Bethard" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >
> >>Is there a good way to determine if an object is a numeric type?
> >
> > In your example, what does your application consid
> > So what you're saying is that 3 <= "3.0" should not be allowed, but
> > 3 <= SomeUserDefinedNumericClass(3) is ok, although your program knows
> > nothing a priori about SomeUserDefinedNumericClass. The idea suggested
> > before, try if "x+1" fails or not does not get you far; any class that
>
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Hi,
>
> I am new to Python and coming from the EDA/VLSI Design background.
>
> I wanted to know if there are some active projects going on EDA modules
> written in Python.
>
> Usually, use of scripting tools in VLSI Design is on a per-pr
"Roose" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> I need this a lot: a one line way to do a n-ary and or 'or'.
>
> e.g.,
>
> result = True
> for x in L:
> if not boolean_function(x):
> result = False
>
> or
>
> >>> reduce(operator.__and__, [boolean_function(x) for x in L)
"Frans Englich" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Hello,
>
> I have trouble installing a data directory which is not a child of my package
> directory in the source directory.
>
> My source directory looks like this:
>
> ./setup.py
> schemas/*.xsd
> foo/*.py
>
> And w
"David M. Cooke" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "Pete Havens" <[EMAIL PROTECTED]> writes:
>
> > The is awesome! Thanks. I did notice one thing while reading it. In the
> > "File Object" section, it states:
> >
> > "Created with built-in functions open() [preferred] o
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Thank you Hans. Could you give me a simple sample of using inspect?
>
http://www.python.org/doc/current/lib/module-inspect.html
George
--
http://mail.python.org/mailman/listinfo/python-list
"Ilias Lazaridis" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Nick Vargish wrote:
> > You can excuse yourself from this one and stop replying to comments,
> > but you don't get to unilaterally declare a discussion over.
> [...]
>
> The discussion is over.
>
> At least the in-topi
"Ilias Lazaridis" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Grant Edwards wrote:
> [...]
> > Um, you realize that nobody in this thread takes you the least
> > bit seriously and people are just poking you with a stick to
> > watch you jump?
>
> jump:
>
> [EVALUATION] - E02 - Sup
"Dave Zhu" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello All,
>
> Is there any survey on scripting languages? I would
> like to get information on several scripting languages
> including Python, Perl, Ruby, Tcl, etc.
>
> Thanks
>
> Dave
After a little googling, that's what I
"Bill Mill" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Fri, 4 Mar 2005 22:35:48 +0100, [EMAIL PROTECTED]
> <[EMAIL PROTECTED]> wrote:
> > Hello NG,
> >
> > I was wondering if there is a way to obtain, from a list of floats,
> > a list of integers without loops. Probably i
Is it possible to start a new process by specifying a function call (in similar
function to thread
targets) instead of having to write the function in a separate script and call
it through os.system
or os.spawn* ? That is, something like
def foo(): pass
os.spawn(foo)
Thanks in advance,
George
The S-expression parser below works, but I wonder if it can be simplified; it's
not as short and
straightforward as I would expect given the simplicity of S-expressions. Can
you see a simpler
non-recursive solution ?
George
# usage
>>> parseSexpression("(a (b c) (d))")
['a', ['b', 'c'], ['d']]
"Raymond Hettinger" <[EMAIL PROTECTED]> wrote:
> [Jeff Epler]
> > Maybe something for sets like 'appendlist' ('unionset'?)
>
> While this could work and potentially be useful, I think it is better to keep
> the proposal focused on the two common use cases. Adding a third would reduce
> the chance
"Aahz" <[EMAIL PROTECTED]> wrote:
> In article <[EMAIL PROTECTED]>,
> Raymond Hettinger <[EMAIL PROTECTED]> wrote:
> >
> >The proposed names could possibly be improved (perhaps tally() is more active
> >and clear than count()).
>
> +1 tally()
-1 for count(): Implies an accessor, not a mutator.
-1
> -1 form me.
>
> I'm not very glad with both of them ( not a naming issue ) because i
> think that the dict type should offer only methods that apply to each
> dict whatever it contains. count() specializes to dict values that are
> addable and appendlist to those that are extendable. Why not
> su
Michael Spencer wrote:
> Raymond Hettinger wrote:
> > I would like to get everyone's thoughts on two new dictionary
methods:
> >
> > def count(self, value, qty=1):
> > try:
> > self[key] += qty
> > except KeyError:
> > self[key] = qty
"John Machin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> George Sakkis wrote:
> > +1 on this. The new suggested operations are meaningful for a subset
> of all valid dicts, so they
> > should not be part of the base dict API. If any v
> > +1 on this. The new suggested operations are meaningful for a subset
> of all
> > valid dicts, so they
> > should not be part of the base dict API. If any version of this is
> approved, > it will clearly be an
> > application of the "practicality beats purity" zen rule, and the
> > justificatio
"Michael Spencer" <[EMAIL PROTECTED]> wrote:
> I could imagine a class: accumulator(mapping, default, incremetor) such that:
> >>> my_tally = accumulator({}, 0, operator.add)
> or
> >>> my_dict_of_lists = accumulator({}, [], list.append)
> or
> >>> my_dict_of_sets = accumulator({}, set(),
I'm sure there must have been a past thread about this topic but I don't know
how to find it: How
about extending the "for in" syntax so that X can include default arguments
? This would be very
useful for list/generator comprehensions, for example being able to write
something like:
[x*y-z fo
"Kay Schluehr" <[EMAIL PROTECTED]> wrote:
> George Sakkis wrote:
>
> > This would be very
> > useful for list/generator comprehensions, for example being able to
> write something like:
> >
> > [x*y-z for (x,y,z=0) in (1,2,3), (4,5), (6,7,8)]
"Matteo Dell'Amico" <[EMAIL PROTECTED]> wrote:
> George Sakkis wrote:
> > I'm sure there must have been a past thread about this topic but I don't
> > know how to find it:
How
> > about extending the "for in" syntax so that X can
"Heiko Wundram" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> On Sunday 20 March 2005 20:47, George Sakkis wrote:
> > Not always. Say for example that you're doing some 2D geometry stuff, and
> > later you have to extend it to 3D. In this
"Heiko Wundram" <[EMAIL PROTECTED]> wrote:
> Am Sonntag, 20. März 2005 22:22 schrieb George Sakkis:
> > Once more, the 2D/3D example was just that, an example; my point was not to
> > find a specific solution to a specific problem.
>
> And my point being:
"Antoon Pardon" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Well at least I find them missing.
>
> For the moment I frequently come across the following cases.
>
> 1) Two files, each with key-value pairs for the same dictionary.
> However it is an error if the second file contains
"Ron" <[EMAIL PROTECTED]> wrote:
> How would this examples work?
>
> for x=5,y,z in (123),(4,5),(6,7,8,9)
>
> Would the x default over ride the first value?
> Should, the 4 element in the third tuple be dropped without an error?
It has already been clarified twice in the thread that the default v
"Michele Simionato" <[EMAIL PROTECTED]> wrote:
> FWIW, here is my take on the defaultdict approach:
>
> def defaultdict(defaultfactory, dictclass=dict):
> class defdict(dictclass):
> def __getitem__(self, key):
> try:
> return super(defdict, self).__getitem_
How about overloading curly braces for set literals, as in
>>> aSet = {1,2,3}
- It is the standard mathematic set notation.
- There is no ambiguity or backwards compatibility problem.
- Sets and dicts are in many respects similar data structures, so why not share
the same delimiter ?
*ducks*
> - There is no ambiguity or backwards compatibility problem.
...at least if it wasn't for the empty set.. hmm...
--
http://mail.python.org/mailman/listinfo/python-list
"Delaney, Timothy C (Timothy)" <[EMAIL PROTECTED]> wrote:
> > How about overloading curly braces for set literals, as in
> >
> aSet = {1,2,3}
> >
> > - It is the standard mathematic set notation.
> > - There is no ambiguity or backwards compatibility problem.
> > - Sets and dicts are in many
[EMAIL PROTECTED]> wrote:
> +1 from me.
>
> The other possible meaning for {1,2,3} would be {1:None,2:None,3:None},
> but that is usually meant to be a set anyway (done with a dict).
>
> So what is this: {1:2, 3, 4 } (apart from "nearly useless") ?
Syntax error; you'll have to decide whether you
"Anthony Liu" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> --- Scott David Daniels <[EMAIL PROTECTED]> wrote:
> > Anthony Liu wrote:
> > > mydict = {'the':358, 'they':29, 'went':7,
> > 'said':65}
> > > Is there an easy to sort this dictionary and get a
> > > list like the followi
"Ron" <[EMAIL PROTECTED]> wrote:
> On Tue, 22 Mar 2005 21:56:57 GMT, Ron <[EMAIL PROTECTED]> wrote:
>
> >Why should a function not create a local varable of an argument if the
> >varable doesn't exist and a default value is given?
>
> ok... thought it out better. :)
>
> Getting a default into a fun
"bruno modulix" <[EMAIL PROTECTED]> wrote: in message news:[EMAIL PROTECTED]
> Ron wrote:
> >>The problem here is that Kay's proposition mixes two points: flexible
> >>tuple unpacking and a new syntax for anonymous functions.
> >
> >
> > Yes, two different problems. I don't think anything needs to
B
"Ben" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm currently trying to develop a demonstrator in python for an
> ontology of a football team. At present all the fit players are
> exported to a text document.
>
> The program reads the document in and splits each line into a st
"Kay Schluehr" <[EMAIL PROTECTED]> wrote:
> [snipped]
>
> Wouldn't it be fun to use in Python?
>
> Only drawback: does not look like executable pseudo-code anymore :(
>
>
> Regards Kay
I don't know if it would be fun, but it certainly doesn't look accessible to
mere mortals :-) I'm
not sure if th
"Michael Spencer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> An Abridged Python Tutorial
>
> There are tips for the novice and tricks
> that will add to your programming kicks.
> But the cardinal rule
> that you must learn at school
> is that spaces and tabs never mix.
"Kay Schluehr" <[EMAIL PROTECTED]> wrote:
> To make my intention clear for another time, also for George who
> mistrusts these exercises alltogether. I want to derive a syntax and
> semantics for anonymus functions ( called "tuple-actions" ) that are
> generalizations of rules that are already use
"Ron_Adam" <[EMAIL PROTECTED]> wrote:
> On 25 Mar 2005 10:09:50 GMT, Duncan Booth
> <[EMAIL PROTECTED]> wrote:
>
>
> >I've never found any need for an is_defined function. If in doubt I just
> >make sure and initialise all variables to a suitable value before use.
> >However, I'll assume you have
"cjl" <[EMAIL PROTECTED]> wrote:
> Hey all:
>
> I want to convert strings (ex. '3', '32') to strings with left padded
> zeroes (ex. '003', '032'), so I tried this:
>
> string1 = '32'
> string2 = "%03s" % (string1)
> print string2
>
> >32
>
> This doesn't work.
Actually in this case string2 is pad
"M.E.Farmer" <[EMAIL PROTECTED]> wrote:
>
> [snipped]
>
> Be sure to study up on string methods, it will save you time and
> sanity.
> Py> dir('')
> ['__add__', '__class__', '__contains__', '__delattr__', '__doc__',
> '__eq__', '__ge__', '__getattribute__', '__getitem__', '__getslice__',
> '__gt__'
"Larry Bates" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Once it is in everyone is hesitant to take it out for fear of
> breaking someone's code that uses it (no matter how obscure).
> Putting in new methods should be difficult and require lots
> of review for that reason and so
"Steven Bethard" <[EMAIL PROTECTED]> wrote:
>
> [snip]
>
> I guess the real questions are[1]:
> * How much does iter feel like a type?
> * How closely are the itertools functions associated with iter?
>
> STeVe
>
> [1] There's also the question of how much you believe in OO tenets like
> "functions
"Terry Reedy" <[EMAIL PROTECTED]> wrote:
>
> "Steven Bethard" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > True it's not a huge win. But I'd argue that for the same reasons that
> > dict.fromkeys is a dict classmethod, the itertools methods could be iter
> > classmethods (or s
It turns out it's not a "how to inflate tires with a hammer" request;
I've actually written an optional type checking module using
decorators. The implementation details are not easy to grok, but the
usage is straightforward:
from typecheck import *
@returns(listOf(int, size=3))
@expects(x=str, y=
Jeremy Bowers wrote:
> On Fri, 01 Apr 2005 14:20:51 -0800, RickMuller wrote:
>
> > I'm trying to split a string into pieces on whitespace, but I want
to
> > save the whitespace characters rather than discarding them.
> >
> > For example, I want to split the string '12' into ['1','
','2'].
> > I
Yes, it is possible to turn off type checking at runtime; just add this
in the beginning of your define:
def define(func):
if not ENABLE_TYPECHECKING:
return lambda func: func
# else decorate func
where ENABLE_TYPECHECKING is a module level variable that can be
exposed to the modu
>def define(func):
>if not ENABLE_TYPECHECKING:
>return lambda func: func
># else decorate func
A small correction: The argument of the decorator is not 'func' but the
parameter checks you want to enforce. A template for define would be:
def define(inputTypes, outputType):
if
How one goes on testing a threaded program, apart from doing a few
successful runs and crossing his fingers that it at least follows the
'correct 99.% of the time' rule ? I've written a stripped-down
python version of Doug Lea's PooledExecutor thread pool class
(http://gee.cs.oswego.edu/dl/clas
I'm looking for a design to a problem I came across, which goes like
this (no, it's not homework):
1. There is a (single inheritance) hierarchy of domain classes, say
A<-B<-..<-Z (arrows point to the parent in the inheritance tree).
2. This hierarchy evolved over time to different versions for eac
> Err, you might want to explain what these things do instead of an
> abstract description of how you are doing it. It looks like you are
> using inheritance in the normal way _and_ you are using it to handle
> versioning of some kind (maybe stable interface releases? I don't
know).
>
> Let us kno
>
I'm not sure if it was clear to you, but my problem is the dummy
WorldModel_v1.MovableObject class. It doesn't do anything by itself,
but it has to be in the inheritance chain to make its descendants work
properly.
> Are you using the *_v1 naming convention for backwards compatibility?
> Backw
"Brian Kazian" wrote:
> I want to insure that all subclasses implement a certain method, but
could
> not find anything that would do this for me. Is there anyway in
Python to
> implement this check? Thanks!
Check out PyProtocols (http://peak.telecommunity.com/PyProtocols.html).
Protocols in a
"Michael Spencer" <[EMAIL PROTECTED]> wrote:
>
> George,
>
> since you explicit allowed metaprogramming hacks :-), how about
something like
> this (not tested beyond what you see):
>
> [snipped]
>
Nice try, but ideally all boilerplate classes would rather be avoided
(at least being written explici
> On second thought, I had doubts. Consider the following scenario:
>
>A2 | f <- A3
>^ ^
>| |
>B2 | f <- B3
>^ ^
>| |
>C2 <- C3 | g
>
> Assume g calls f. Since f is defined in B version 2, it should taken
>
> Have you considered a 'macro' solution composing source? If I were
handling so
> many versions, I would want a complete class definition for each
version rather
> than having to scan many sources for each implementation.
Can you elaborate on this a little ? You mean something like a
template-ba
"Bengt Richter" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> See if this does what you want:
>
> [snipped]
>
Yes, that's pretty much what I had in mind. I particularly liked the
idea of mirroring automagically the nested class inheritance in each
version. So I tried to refine th
Use 'global':
def change_filename():
global filename
filename=raw_input()
def change_path():
global path
path=raw_input()
Even better, don't use globals at all; in 99% if the time, there are
better ways to achieve the same effect.
George
--
http://mail.python.org/mailman/listinf
François Pinard wrote:
> The most useful place for implicit tuple unpacking, in my experience,
> is likely at the left of the `in' keyword in `for' statements (and
> it is even nicer when one avoids extraneous parentheses).
... and would be nicest (IMO) if default arguments and *varargs were
all
"François Pinard" wrote:
>
> I started recently to study the R system and language, and saw many
good
> ideas in there about argument passing. Translated in Python terms,
it
> would mean that `*varargs' and `**keywords' are not necessary last,
> that named keywords may be intermixed with positiona
"François Pinard" wrote:
> > > keywords may be abbreviated, and much more hairy,
>
> > Hmm.. -1 on this. It may save a few keystrokes, but it's not good
for
> > readability and maintenability.
>
> That was my first impression too. Yet, interactively, I found that
> feature very convenient. Alread
Searching the archives for something related to the title, I found a
few relevant threads (e.g. http://tinyurl.com/avyg6 or
http://tinyurl.com/b5b6v); however they don't seem to give a
satisfactory answer, so here it goes again: What's the equivalent
new-style Delegate class ?
class Delegate:
Probably you're looking for Beautiful Soup:
http://www.crummy.com/software/BeautifulSoup/
George
--
http://mail.python.org/mailman/listinfo/python-list
Is there a general way of injecting code into a function, typically
before and/or after the existing code ? I know that for most purposes,
an OO solution, such as the template pattern, is a cleaner way to get
the same effect, but it's not always applicable (e.g. if you have no
control over the desi
"Lonnie Princehouse" wrote:
> I expect you could combine the following with decorators as an easy
way
> to grab a function's locals just before it exits... you could also
use
> exec or eval to execute code in the function's local namespace.
> ---
>
> # Try it:
> I've a function that needs to maintain an ordered sequence between
> calls.
>
> In C or C++, I'd declare the pointer (or collection object) static at
> the function scope.
>
> What's the Pythonic way to do this?
>
> Is there a better solution than putting the sequence at module scope?
Yes, there
> "J. W. McCall" <[EMAIL PROTECTED]> writes:
> >
> > I need to split a string as per string.strip(), but with a
> > modification: I want it to recognize quoted strings and return them
as
> > one list item, regardless of any whitespace within the quoted
string.
> >
> > For example, given the string:
> import re
> regex = re.compile(r'''
>'.*?' | # single quoted substring
>".*?" | # double quoted substring
>\S+ # all the rest
>''', re.VERBOSE)
Oh, and if your strings may span more than one line, replace re.V
> Oh, I overlooked this. Then the solution becomes simple:
>
>sys._getframe().f_trace
>
> Test:
>
> >>> an = Analyzer()
> >>> sys.settrace(an.trace_returns)
> >>> sys._getframe().f_trace
> 0x010015D0>>
Does this work for you non-interactively ? I tried running it from a
script or importing it
> I'm not clear on what your real goal is, but if you just want a
snapshot
> of what locals() is just before exiting func, that could be done with
> a byte-code-hacking decorator with usage looking something like
>
> #func defined before this
> func_locals = {}
> @getlocals(func, func_l
I downloaded the latest Komodo (3.1) and configured it for python 2.4
so that it doesn't show decorators and genexps as syntax errors, but
background syntax checking doesn't seem to work at all for python 2.4.
Even for correct files, it shows a "Syntax checking error: Error
checking syntax: retval
"Trent Mick" wrote:
> George,
>
> My suspicion is that the difference is that you are using a Cygwin
> Python and it is using Un*x-style process return values. What do the
> following return for your Python.
>
> For me on Windows (with ActivePython 2.4):
> >>> import os
> >>> os.system("ex
wrote in message
news:[EMAIL PROTECTED]
> Reports to [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED],
> [EMAIL PROTECTED], [EMAIL PROTECTED]
>
> And do not feed the troll!
I'm afraid he's not a troll. He's just a lame spammer, doesn't need
feeding to survive...
In any case, the hell with
What's the fastest and most elegant equivalent of zip() in
Numeric/Numarray between two equally sized 1D arrays ? That is, how to
combine two (N,)-shaped arrays to one (N,2) (or (2,N)) shaped ? I
expect the fastest and the most elegant idiom to be identical, as it is
usually the case in this excell
Livin wrote:
> I'm a noobie so please be easy on me. I have searched a ton and did not find
> anything I could understand.
>
> I'm using py2.3
>
> I've been using Try/Except but this gets long with multiple dictionaries.
>
> I found some code on web pages and such but cannot get them to work. Any
A cleaner, though not shorter, rewriting could be:
from itertools import chain
def ancestors(path):
while True:
yield path
parent = os.path.dirname(path)
if parent == path:
break
path = parent
for dir in chain([os.environ['HOME']],
[EMAIL PROTECTED] wrote:
> Robert Hicks wrote:
> > [EMAIL PROTECTED] wrote:
> > > T. Bryan wrote:
> > > > Thomas Heller wrote:
> > > >
> > > > > I cannot connect to starship.python.net: neither http, nor can I login
> > > > > interactively with ssl (and the host key seems to have changed as
> > >
neoedmund wrote:
> python use multiple inheritance.
> but "inheritance" means you must inherite all methods from super type.
> now i just need "some" methods from one type and "some" methods from
> other types,
> to build the new type.
> Do you think this way is more flexible than tranditional inh
[EMAIL PROTECTED] wrote:
> Hello,
> I have thousands of files that look something like this:
>
> wisconsin_state.txt
> french_guiana_district.txt
> central_african_republic_province.txt
>
> I need to extract the string between the *last* underscore and the
> extention.
> So based on the files abov
Michele Simionato wrote:
> Lee Harr wrote:
> > I understand how to create a property like this:
> >
> > class RC(object):
> > def _set_pwm(self, v):
> > self._pwm01 = v % 256
> > def _get_pwm(self):
> > return self._pwm01
> > pwm01 = property(_get_pwm, _set_pwm)
> >
> >
Carl Banks wrote:
> Lee Harr wrote:
> > I understand how to create a property like this:
> >
> > class RC(object):
> > def _set_pwm(self, v):
> > self._pwm01 = v % 256
> > def _get_pwm(self):
> > return self._pwm01
> > pwm01 = property(_get_pwm, _set_pwm)
> >
> >
> > But
201 - 300 of 1186 matches
Mail list logo