Re: python for loop

2009-04-01 Thread andrew cooke
/moderate size library of 600 lines (including blanks and comments, but excluding tests and exploratory code) the only time i have used range with array indices i was either unhappy with the code, or implementing a complex data structure. andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: python for loop

2009-04-01 Thread andrew cooke
andrew cooke wrote: [...] > so in a small/moderate size library of 600 lines (including blanks and 6000 > comments, but excluding tests and exploratory code) the only time i have > used range with array indices i was either unhappy with the

Re: Regex trouble

2009-04-01 Thread andrew cooke
ed with a simple finite automaton. disclaimer: this is all fairly new to me as i just recently implemented a regular expression matcher myself, and i may be wrong on some of the details. andrew akshat agarwal wrote: > Hi, > > I am trying to use the following snippet of code to print a r

Re: Regex trouble

2009-04-01 Thread andrew cooke
more exactly, my guess is perl has a special case for this that avoids doing a search over all possible matchers via the pushdown stack. andrew cooke wrote: > > ".*?" is a "not greedy" match, which is significantly more difficult to > handle than a normal ".*&qu

Re: List of paths

2009-04-01 Thread andrew cooke
Nico Grubert wrote: >> May be not so much pythonic, but works >> >> for i in range(len(q)): >> for x in q[i:]: >>if x.startswith(q[i]) and x!=q[i]: >>q.remove(x) > > ...but works fine. Thanks, Eugene. > Also thanks to Andrew. Y

Re: python for loop

2009-04-01 Thread andrew cooke
he total "pile" is rather than counting (do they know the difference between two small things and one big thing, for example). that experiment doesn't seem to address this. andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Beazley on Generators

2009-04-01 Thread andrew cooke
ith-nice-syntax.html > > Peters implementation can be simplified but it already contains all > relevant ideas. oh that's neat. thanks for that. andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Alpha/For Discussion: RPMs for around 3,000 PyPI packages.

2009-04-01 Thread andrew cooke
es. neat idea. the info for each package includes information on which python versions it is compatible with. wouldn't it make sense to use that? might explain a lot of failures. andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: A design problem I met again and again.

2009-04-02 Thread andrew cooke
n)) access time. in contrast a single file means a linear scan, O(n). (i am talking about human use here - people reading and trying to understand code, perhaps during debugging or code review or whatever). andrew (you could argue that the file contents can be sorted in some way - you coul

Re: simple iterator question

2009-04-02 Thread andrew cooke
single in together: yield single seems like it should work (warning: untried). will terminate on shortest length doodah. andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Class methods read-only by default?

2009-04-02 Thread andrew cooke
class, not the instance). so you may be able to delete the method from the class, but then it will affect all instances. you can't delete it from one instance because it's not in that instance. as i said, just a guess, based on vague ideas about how python works. andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: simple iterator question

2009-04-02 Thread andrew cooke
Sion Arrowsmith wrote: > Neal Becker wrote: >>How do I interleave 2 sequences into a single sequence? >> >>How do I interleave N sequences into a single sequence? > > itertools.chain(*itertools.izip(*Nsequences)) aha! thanks. andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: league problem in python

2009-04-02 Thread Andrew Henshaw
"Ross" wrote in message news:d5cc0ec7-5223-4f6d-bab4-3801dee50...@r37g2000yqn.googlegroups.com... ... snip ... > I would like to create a simple program where the pro could enter in > how many people were in the league, the number of courts available, > and the number of weeks the schedule would

Re: Python Goes Mercurial

2009-04-02 Thread andrew cooke
;m happy with svn - but i am curious about what the advantages and disadvantages might be. thanks, andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-02 Thread andrew cooke
emy, but i am sure other packages do something similar. it's described in the python docs. andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-02 Thread andrew cooke
andrew cooke wrote: > Chris Withers wrote: >> Martin v. Löwis wrote: >>> I propose the following PEP for inclusion to Python 3.1. >>> Please comment. >> >> Would this support the following case: >> >> I have a package called mortar, which def

Re: Iteratoration question

2009-04-02 Thread andrew cooke
new instance each time it is called. BUT while what you are doing is interesting, it is not the same as Python's iterators, which use "yield" from a function and don't require storing a value in a class. look for "yield" in the python docs. this comment may be irrelevant; i am just worried you are confusing the above (which apart from the mistake about instances is perfectly ok) and python's iterators (which use next(), yield, etc). andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Iteratoration question

2009-04-02 Thread andrew cooke
#x27;value' like in the following > >>>> for x in value: > ... print x > ... > Traceback (most recent call last): > File "", line 1, in ? > TypeError: iteration over non-sequence > > But yet, I can do... > >>>> value.next() >

Re: Iteratoration question

2009-04-02 Thread andrew cooke
ction that returns a value. What he > needs > is an __iter__() method that returns self. Alternately, __iter__ could be yeah, sorry, i was in a rush and not thinking straight. andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Iteratoration question

2009-04-02 Thread andrew cooke
7;extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'] >>> l.__iter__ >>> i = l.__iter__() >>> dir(i) ['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__iter__', '__length_hint__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', 'next'] >>> i.next() 1 >>> i.next() 2 note that the list only has __iter__, not next. calling __iter__() returns an iterator (something that has a next method) and calling next on that gives you the same result. dir() just shows all the attributes of an object. andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Iteratoration question

2009-04-02 Thread andrew cooke
gt;> x = count() >>> dir(x) ['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__iter__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', 'close', 'gi_frame', 'gi_running', 'next', 'send', 'throw'] >>> i = x.__iter__() >>> i.next() 0 >>> i.next() 1 andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Iteratoration question

2009-04-02 Thread andrew cooke
7;s pretty > much the definition of it. You have read the iteration protocol > after it's been mentioned so many times now, haven't you? argh. when i said "yes" i meant that something calls them - that they realy do exist behind the scenes. but rhodri is right (again), it

Re: A design problem I met again and again.

2009-04-03 Thread andrew cooke
ll the other uncertainties in software development, that i cannot see why people are even discussing it (well, i can understand, because human nature is what it is, and software development seems to attract a certain kind of pedantic, rigid mind, but even so...) andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Module caching

2009-04-03 Thread andrew cooke
are you an experienced python programmer? a lot of newbies post here with problems related to unexpected results because they make "the usual" mistakes about list mutability and default function arguments. i suspect that's not the case here, but it seemed worth mentioning, just i

Re: A design problem I met again and again.

2009-04-04 Thread andrew cooke
ave a ', if type(x) is Foo: print 'furry foo' elif type(x) is Bar: print 'bubbly Bar; else: print 'strange beast' might be refactored as class MyPrintable(object): def my_print(self): print 'i have a ', self.describe() class Foo(MyPrintable): def describe(self): return 'furry Foo' etc etc. it's not always possible, but any type() or isinstance() in an OO program is a big red flag that the design is wrong. andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: A design problem I met again and again.

2009-04-04 Thread andrew cooke
andrew cooke wrote: [...] >>> > #= >>> > def start(type, id): >>> > if(type == "XXX"): >>> > pass >>> > else if(type == "YYY"): >>> > pass >>> >

Re: Testing dynamic languages

2009-04-04 Thread andrew cooke
ove just my experience. i tend to use java for the server side and python for getting data into the database, so each plays to its strengths. andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: How to free /destroy object created by PyTuple_New

2009-04-04 Thread Andrew Svetlov
To destroy every python object you need to call Py_DECREF. To call python code fron you C thread you need to use pair PyGILState_Ensure/PyGILState_Release. -- http://mail.python.org/mailman/listinfo/python-list

Re: Testing dynamic languages

2009-04-04 Thread andrew cooke
andrew cooke wrote: > if you are going to do that, stay with java. seriously - i too, am a java > developer about half the time, and you can make java pretty dynamic if you > try hard enough. look at exploiting aspects and functional programming > libraries, for example. also, of c

Re: Why doesn't StopIteration get caught in the following code?

2009-04-04 Thread andrew cooke
n you define a function or a method that contains "yield". the above doesn't, so it's not rewritten and there's no magic. more exactly: http://docs.python.org/reference/datamodel.html#index-1747 andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Spring-like IoC in python?

2009-04-05 Thread andrew cooke
you are already in a scripting language. but maybe i have missed something, given that this stuff exists (hence me trying to understand it). andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: speed of string chunks file parsing

2009-04-06 Thread andrew cooke
t try to avoid having multiple occurrences of ".*". see the timeit package for testing the speed of small chunks of code. andrew Hyunchul Kim wrote: > Hi, all > > I have a simple script. > Can you improve algorithm of following 10 line script, with a view point > of speed

Re: Best way to start

2009-04-06 Thread andrew cooke
Avi wrote: > What is a good way to learn Python? > > Do you recommend going by a book (suggestions welcome) or learning > with tutorials? Both? how do you like to learn and how much experience do you have programming in other languages? andrew -- http://mail.python.org/mailman/lis

Re: Returning different types based on input parameters

2009-04-06 Thread andrew cooke
(as opposed to input parameters). [...] you probably want to look up substitutability: http://www.google.cl/search?q=substitutability+principle andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Returning different types based on input parameters

2009-04-06 Thread andrew cooke
andrew cooke wrote: > George Sakkis wrote: >> That's more of a general API design question but I'd like to get an >> idea if and how things are different in Python context. AFAIK it's >> generally considered bad form (or worse) for functions/methods to

Re: in place list modification necessary? What's a better idiom?

2009-04-07 Thread andrew cooke
ic. just return the cast value or catch the exception: [...] try: dimensions.append(float(s)) except: dimensions.append(float(quantization[s])) (not sure float() is needed there either if you're using a recent version of python - only reason i can think of is to avoid integer division in older versions). andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: in place list modification necessary? What's a better idiom?

2009-04-07 Thread andrew cooke
convert('1,2,red') [1.0, 2.0, 0] >>> convert('1,2,blue') [1.0, 2.0, 1] >>> convert('1,2,blue,blue') [1.0, 2.0, 1, 0] andrew cooke wrote: > Carl Banks wrote: >> import collections >> import itertools >> >> def createIniti

Re: in place list modification necessary? What's a better idiom?

2009-04-07 Thread andrew cooke
d be better catching a specific exception. as a general rule, maybe, but in this particular case i can't see a reason - so i'm not sure if you're just pedantically following rules or if i've missed something i should know. andrew -- http://mail.python.org/mailman/listinfo/python-list

PyXML and Python-2.6

2009-04-07 Thread Andrew MacKeith
Is there a guide to porting projects that depend on PyXML to Python-2.6? Andrew MacKeith -- http://mail.python.org/mailman/listinfo/python-list

Re: in place list modification necessary? What's a better idiom?

2009-04-07 Thread andrew cooke
MRAB wrote: > andrew cooke wrote: >> R. David Murray wrote: >>>> [...] >>>> try: >>>> dimensions.append(float(s)) >>>> except: >>>> dimensions.append(float(quantization[s])) >>> No, no, no; never use a b

Re: Creating Linked Lists in Python

2009-04-07 Thread andrew cooke
l.TaggedFragments-class.html) hope that makes sense. it could probably be more efficient (does an O(n) scan of all intervals each time a new interval is added so is O(n^2)), but since this is used in the "compile" part of a regexp, speed may not be as important as in the "match" phase. andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Why does Python show the whole array?

2009-04-08 Thread andrew cooke
wo strings match at the start. the problem is that the method return isn't consistent with implicit conversion to boolean; python does convert non-zero to True. andrew > print test > -- > http://mail.python.org/mailman/listinfo/python-list > > -- http://mail.python.org/mailman/listinfo/python-list

Re: nested looping

2009-04-08 Thread andrew cooke
bit late here, but if it's as simple as you say, i think it would be much more efficient (because you only scan checklist and alist once each) to do: known = set() for check in checklist: known.add(check[0:-1]) missing = filter(lambda alpha: alpha not in known, alist) andrew PK

Re: Retrieving a specific object from a list?

2009-04-09 Thread andrew cooke
andrew cooke wrote: [...] > but when you need to access instances by more than one value (.bar and > .baz) then typically that's a hard problem, and there's a trade-off > somewhere. you might find writing a special container that contains two > dicts is useful. if so, you

Re: Retrieving a specific object from a list?

2009-04-09 Thread andrew cooke
inking at a high enough level about the algorithm - even though my third suggestion (deque) sounds rather obscure you may find that once you look at you algorithm more carefully it can be rewritten in that way. i think i've seen this in my own code as i improve at integrating what might be more "functional" idioms into python in a "natural" (pythonic) way. andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: Why does Python show the whole array?

2009-04-09 Thread andrew cooke
ike myself, it's not easy to remember - i keep forgetting it! i think it's because i associate "in" with iteration, and assume everything else will be method calls or functions (and from earlier discussions here, it's clear some people are even more blinkered, and think everything

Re: Scrap Posts

2009-04-09 Thread andrew cooke
this discussion has happened before, here and on -dev, and people have generally acclaimed the list filtering). andrew Avi wrote: > Hey Folks, > > I love this group and all the awesome and python savvy people who post > here. However I also see some dumb posts like 'shoes' or

Re: Recommendations on Pythonic tree data structure design techniques

2009-04-09 Thread andrew cooke
umeric keys. This doesn't make sense to me. It sounds like you are re-inventing lists (arrays). Andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is it that *dbm modules don't provide an iterator? (Language design question)

2009-04-09 Thread andrew cooke
http://bugs.python.org/issue662923 imply that there *was* suitable code (for 2.4)? So is this a regression? And should that issue be re-opened? Andrew > For gdbm, you can also use the firstkey/nextkey methods. > > Regards, > Martin > -- > http://mail.python.org/mailman/listi

Re: ANN: PyGUI 2.0.1

2009-04-13 Thread Andrew MacKeith
-packages\GUI\Generic c:\python26\Lib\site-packages\GUI\Resources c:\python26\Lib\site-packages\GUI\Resources\cursors c:\python26\Lib\site-packages\GUI\Win32 Andrew MacKeith -- http://mail.python.org/mailman/listinfo/python-list

Re: Automatically generating arithmetic operations for a subclass

2009-04-14 Thread andrew cooke
self, other): > return type(self)(int.__%s__(self, other)) > """ > > unop_meth = """ > def __%s__(self): > return type(self)(int.__%s__(self)) > """ > > class MyInt(int): > for op in binops: > exec binop_meth % (op, op) > for op in unops: > exec unop_meth % (op, op) > del op what's the "del" for? curious, andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Automatically generating arithmetic operations for a subclass

2009-04-14 Thread andrew cooke
Arnaud Delobelle wrote: > "andrew cooke" writes: >> Arnaud Delobelle wrote: >>> class MyInt(int): >>> for op in binops: >>> exec binop_meth % (op, op) >>> for op in unops: >>> exec unop_meth % (op,

Re: [OT] large db question about no joins

2009-04-17 Thread andrew cooke
on the more general point about exactly how to handle large data sets, i found this article interesting - http://highscalability.com/unorthodox-approach-database-design-coming-shard andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a maximum size to a Python program?

2009-04-27 Thread andrew cooke
t you can use sql directly when it's the best solution, and mapped objects when they are more useful). these are both kind-of obvious, but that's all i needed to handle fairly large data volumes with sqlalchemy. andrew Carbon Man wrote: > I have a program that is generated fro

Re: The whole story

2009-04-28 Thread andrew cooke
Paul Hemans wrote: > Hi Andrew, > The reason I am using mapped objects is that I need to abstract from the > database implementation allowing the replication to target a number of > different platforms. This will definitely slow things down. have you looked at sqlalchemy's ge

Tkinter Caesar Cipher GUI (speed errors?)

2009-05-06 Thread Andrew Free
/8adfdc83e9b5a2e9e7af1f557a97a3ee.png?direct That just makes no sense at all. Is 100 to fast for it to run? I would think it would wait for it to finish and update the GUI before it moved on. Thanks, Andrew-- http://mail.python.org/mailman/listinfo/python-list

Re: Statically linked extension and relative import

2009-05-07 Thread Andrew MacIntyre
ot in the foo package namespace (which is why "import bar" works), so should be imported as bar in foo's __init__.py. from foo import bar should then work from other code by virtue of the package namespace (instantiated by __init__.py) then having a bar symbol. -- ----

Re: SQL and CSV

2009-05-08 Thread andrew cooke
_str__ or __float__ or whatever? And you would still use the library to give safety with other values. Maybe you could give an example of the kind of problem you're thinking of? Thanks, Andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: SQL and CSV

2009-05-08 Thread andrew cooke
o be some kind of cryptic argument against parameters. andrew Nick wrote: > On May 8, 1:49 pm, "andrew cooke" wrote: >> Lawrence D'Oliveiro wrote: >> > In message , Peter Otten wrote: >> >> >> While it may not matter here using placeholders instead

Re: New to python, can i ask for a little help?

2009-05-14 Thread Andrew Chung
in the past? Again, thank you to all of you who responded so quickly to my question. It helped alot. Andrew On Wed, May 13, 2009 at 1:58 PM, Chris Rebert wrote: > On Wed, May 13, 2009 at 12:22 PM, [email protected] > wrote: > > On May 12, 9:27 pm, Chris Rebert wrote: > &g

Configure options for minimal Python 2.6

2009-05-15 Thread Andrew Malcolmson
ere a list of the feature/package names of the other optional components? --- Andrew Malcolmson -- http://mail.python.org/mailman/listinfo/python-list

Re: Generic web parser

2009-05-18 Thread andrew cooke
http://groups.google.com/group/beautifulsoup/browse_thread/thread/d416dd19fdaa43a6 http://jjinux.blogspot.com/2008/10/python-some-notes-on-lxml.html andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Building Python with icc on 64-bit Linux

2009-05-28 Thread Andrew MacIntyre
he libffi source and adjusting its configure script to properly handle the problematic case. Unless you need ctypes, this may be something you can skip over... -- ----- Andrew I MacIntyre "These

Most pythonic way to truncate unicode?

2009-05-28 Thread Andrew Fong
e an orphaned byte. So truncate(u'\u4000\u4001\u4002 abc',4) == u'\u4000' ... as opposed to getting UnicodeDecodeError. I'm using Python2.6, so I have access to things like bytearray. Are there any built-in ways to do something like this already? Or do I just have to iter

Re: import sqlite3

2009-06-03 Thread Andrew McNamara
On 04/06/2009, at 3:15 PM, willgun wrote: When i run the following in IDLE: IDLE 2.6.1 import sqlite3 con =sqlite3.connect (r'g:\db1') everything goes well,but when i save these to a .py file and run it: Traceback (most recent call last): File "C:\Users\hp\Desktop\SQLite3\sqlite3.py", l

Re: import sqlite3

2009-06-03 Thread Andrew McNamara
On 04/06/2009, at 4:14 PM, willgun wrote: What did you call the .py file? sqlite3.py? If so, you've just imported your own module again. 8-) After the import, try "print sqlite3.__file__", which will tell you where the module came from. Thank you all the same. I'm a student from China.It'

Re: import sqlite3

2009-06-04 Thread Andrew McNamara
On 04/06/2009, at 9:45 PM, willgun wrote: By the way ,what does 'best regards' means at the end of a mail? The correspondent is wishing you well. You'll also see things like "kind regards", "best wishes" and so on. "Regard" essentially means respect. -- http://mail.python.org/mailman/lis

RE: exists=false, but no complaint when i open it!?

2008-05-15 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Reedick, Andrew > Sent: Thursday, May 15, 2008 12:11 PM > To: globalrev; [email protected] > Subject: RE: exists=false, but no complaint when i open it!? > > &g

RE: exists=false, but no complaint when i open it!?

2008-05-15 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of globalrev > Sent: Thursday, May 15, 2008 12:04 PM > To: [email protected] > Subject: exists=false, but no complaint when i open it!? > > print os.path.exists('C:\Users\saftarn\Desktop\NetFl

Re: Markov Analysis Help

2008-05-22 Thread Andrew Lee
dave wrote: Hi Guys, I've written a Markov analysis program and would like to get your comments on the code As it stands now the final input comes out as a tuple, then list, then tuple. Something like ('the', 'water') ['us'] ('we', 'took')..etc... I'm still learning so I don't know any ad

Re: Python is slow

2008-05-22 Thread Andrew Lee
cm_gui wrote: Python is slow.Almost all of the web applications written in Python are slow. Zope/Plone is slow, sloow, so very slooow. Even Google Apps is not faster. Neither is Youtube. Facebook and Wikipedia (Mediawiki), written in PHP, are so much faster than Python. Okay, they probab

Re: Why is math.pi slightly wrong?

2008-05-22 Thread Andrew Lee
Mensanator wrote: On May 22, 11:32 am, "Dutton, Sam" <[EMAIL PROTECTED]> wrote: I've noticed that the value of math.pi -- just entering it at the interactive prompt -- is returned as 3.1415926535897931, whereas (as every pi-obsessive knows) the value is 3.1415926535897932... (Note the 2 at the

Re: Why is math.pi slightly wrong?

2008-05-22 Thread Andrew Lee
Dan Upton wrote: On Thu, May 22, 2008 at 2:53 PM, Mensanator <[EMAIL PROTECTED]> wrote: On May 22, 11:32 am, "Dutton, Sam" <[EMAIL PROTECTED]> wrote: I've noticed that the value of math.pi -- just entering it at the interactive prompt -- is returned as 3.1415926535897931, whereas (as every pi-

Re: MVC

2008-05-22 Thread Andrew Lee
George Maggessy wrote: Hi Gurus, I'm a Java developer and I'm trying to shift my mindset to start programming python. So, my first exercise is to build a website. However I'm always falling back into MVC pattern. I know it's a standard, but the implementation language affects the use of design p

Re: Write bits in file

2008-05-23 Thread Andrew Lee
Tim Roberts wrote: Monica Leko <[EMAIL PROTECTED]> wrote: I have a specific format and I need binary representation. Does Python have some built-in function which will, for instance, represent number 15 in exactly 10 bits? For the record, I'd like to point out that even C cannot do this. You

Re: can python do some kernel stuff?

2008-05-23 Thread Andrew Lee
Jimmy wrote: Hi to all python now has grown to a versatile language that can accomplish tasks for many different purposes. However, AFAIK, little is known about its ability of kernel coding. So I am wondering if python can do some kernel coding that used to be the private garden of C/C++. For e

Re: [Regexes] Stripping puctuation from a text

2008-05-23 Thread Andrew Lee
shabda raaj wrote: I want to strip punctuation from text. So I am trying, p = re.compile('[a-zA-Z0-9]+') p.sub('', 'I love tomatoes!! hell yeah! ... Why?') ' !! ! ... ?' Which gave me all the chars which I want to replace. So Next I tried by negating the regex, p = re.compile('^[a-zA-Z0

Re: php vs python

2008-05-23 Thread Andrew Lee
notbob wrote: I'm not posting this just to initiate some religious flame war, though it's the perfect subject to do so. No, I actaully want some serious advice about these two languages and since I think usenet is the best arena to find it, here ya' go. So, here's my delimna: I want to start a

Re: can python do some kernel stuff?

2008-05-23 Thread Andrew Lee
Jimmy wrote: On May 23, 3:05 pm, Andrew Lee <[EMAIL PROTECTED]> wrote: Jimmy wrote: Hi to all python now has grown to a versatile language that can accomplish tasks for many different purposes. However, AFAIK, little is known about its ability of kernel coding. So I am wondering if pyth

Re: can python do some kernel stuff?

2008-05-23 Thread Andrew Lee
Diez B. Roggisch wrote: Jimmy schrieb: On May 23, 3:05 pm, Andrew Lee <[EMAIL PROTECTED]> wrote: Jimmy wrote: Hi to all python now has grown to a versatile language that can accomplish tasks for many different purposes. However, AFAIK, little is known about its ability of kernel coding

Re: can python do some kernel stuff?

2008-05-23 Thread Andrew Lee
Diez B. Roggisch wrote: Andrew Lee schrieb: Diez B. Roggisch wrote: Jimmy schrieb: On May 23, 3:05 pm, Andrew Lee <[EMAIL PROTECTED]> wrote: Jimmy wrote: Hi to all python now has grown to a versatile language that can accomplish tasks for many different purposes. However, AFAIK, lit

RE: webspider, regexp not working, why?

2008-05-23 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of > [EMAIL PROTECTED] > Sent: Friday, May 23, 2008 12:43 PM > To: [email protected] > Subject: webspider, regexp not working, why? > > url = re.compile(r"^((ht|f)tp(s?)\:\/\/|~/|/)?([\w]+:\

method-wrapper?

2008-05-31 Thread andrew cooke
[...] What is "method-wrapper"? Google turns up hardly any hits, same with searching python.org. Thanks, Andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's doc problems: sort

2008-06-01 Thread Andrew Koenig
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I want to emphasize a point here, as i have done quite emphatically in > the past. The Python documentation, is the world's worst technical > writing. As far as technical writing goes, it is even worse than > Perl's in my opinion. I t

RE: regex help

2008-06-03 Thread Reedick, Andrew
> From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > On Behalf Of Support Desk > Sent: Tuesday, June 03, 2008 9:32 AM > To: [email protected] > Subject: regex help > > I am trying to put together a regular expression that will > rename users address books on our server due to a recent >

RE: New variable?

2008-06-03 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of tmallen > Sent: Tuesday, June 03, 2008 2:41 PM > To: [email protected] > Subject: New variable? > > What's the proper way to instantiate a new variable? x = ""? I've always used X

Duplicate widget with threads

2008-06-07 Thread Andrew Burton
hread ( threading.Thread ): def run (self): root = Tk() app = App(root) root.mainloop() class CpThread ( threading.Thread ): def run (self): cherrypy.root = HelloWorld() cherrypy.server.start() CpThread().start() TkThread().start() --- STOP CODE

RE: Iterate creating variables?

2008-06-13 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Diez B. Roggisch > Sent: Friday, June 13, 2008 11:21 AM > To: [email protected] > Subject: Re: Iterate creating variables? > > [EMAIL PROTECTED] schrieb: > > I have twenty-five checkboxes

RE: Iterate creating variables?

2008-06-13 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] > Sent: Friday, June 13, 2008 11:11 AM > To: [email protected] > Subject: Iterate creating variables? > > I have twenty-five checkboxes I need to create (don't ask): >

RE: Freeze problem with Regular Expression

2008-06-25 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Kirk > Sent: Wednesday, June 25, 2008 11:20 AM > To: [email protected] > Subject: Freeze problem with Regular Expression > > Hi All, > the following regular expression matching seems to en

Re: ImportError: DLL load failed

2008-06-27 Thread Andrew MacIntyre
d. Use the -v option on the Python command line to identify which DLL is actually being imported. You can then decide to move/rename.delete it or your own module as best fits your circumstances. -- ----- Andrew I MacIntyre

RE: How make regex that means "contains regex#1 but NOT regex#2" ??

2008-07-01 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of > [EMAIL PROTECTED] > Sent: Tuesday, July 01, 2008 2:29 AM > To: [email protected] > Subject: How make regex that means "contains regex#1 but NOT regex#2" > ?? > > I'm looking over the do

RE: How make regex that means "contains regex#1 but NOT regex#2" ??

2008-07-01 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Reedick, Andrew > Sent: Tuesday, July 01, 2008 10:07 AM > To: [EMAIL PROTECTED]; [email protected] > Subject: RE: How make regex that means "contains re

Getting a path from a file object

2008-07-04 Thread Andrew Fong
Newbie question: Let's say I open a new file for writing in a certain path. How do I get that path back? Example: >>> f = open('/some/path/file.ext') >>> some_function(f) '/some/path/file.ext' Does some_function(f) already exist? And if not

Re: Python Agile Software Development Tools Screencasts

2008-07-07 Thread Andrew Freeman
s: http://videos1.showmedo.com/ShowMeDos/291.flv I hope the presenter doesn't mind, but it is quite simple to discover using open source tools like firebug. As for playing back flvs with free software, there is Gnash -- an open source flash player -- http://www.gnu.org/software/gnash

Re: Python Agile Software Development Tools Screencasts

2008-07-07 Thread Andrew Freeman
Ben Finney wrote: > Andrew Freeman <[EMAIL PROTECTED]> writes: > >> http://videos1.showmedo.com/ShowMeDos/291.flv >> > > Which leads one to wonder why they don't just present that URL for > download instead of behind a "log in" gate.

Re: Retrieving BSTR * from a DLL

2008-07-10 Thread Andrew MacIntyre
ht like to join the ctypes-users mailing list at sourceforge. -- ----- Andrew I MacIntyre "These thoughts are mine alone..." E-mail: [EMAIL PROTECTED] (pref) | Snail: PO Box 370 [EMAIL PROTECTED] (alt) |Belconnen ACT 2616 We

Re: paypal wholesale men jordans 17 (paypal accept)(www super-saler com

2008-07-11 Thread Andrew Thompson
do not read it, and do not care too much to see any replies. -- Andrew Thompson http://pscode.org/ -- http://mail.python.org/mailman/listinfo/python-list

RE: 'if name is not None:' v. 'if name:'

2008-07-15 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Victor Noagbodji > Sent: Tuesday, July 15, 2008 3:44 PM > To: [email protected] > Subject: Re: 'if name is not None:' v. 'if name:' > > >>what's the difference between these two statement

RE: 'if name is not None:' v. 'if name:'

2008-07-15 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Reedick, Andrew > Sent: Tuesday, July 15, 2008 4:13 PM > To: Victor Noagbodji; [email protected] > Subject: RE: 'if name is not None:' v. 'if name:&#

<    11   12   13   14   15   16   17   18   19   >