Re: Can't override class |__new__

2009-03-05 Thread Lie Ryan
jelle feringa wrote: CGAL.Facet = OtherFacet CGAL.Polyhedron.Facet = OtherFacet p = CGAL.Polyhedron_3() You're not creating Facet object here, not even Polyhedron.Facet. Right, which is not the point; I'm trying to override the Facet, a topological entity of which a Polyhedron is composed o

Re: Can Python do shopping cart?

2009-03-06 Thread Lie Ryan
Muddy Coder wrote: Hi Folks, I know PHP can do shopping cart, such as Zen Cart. I wonder can Python do such a thing? Thanks! Muddy Coder Python is Turing Complete -- http://mail.python.org/mailman/listinfo/python-list

Re: Should I use stackless python or threads?

2009-03-06 Thread Lie Ryan
Minesh Patel wrote: On Fri, Mar 6, 2009 at 3:16 PM, Jean-Paul Calderone wrote: On Fri, 6 Mar 2009 14:50:51 -0800, Minesh Patel wrote: I am trying to figure out the best approach to solve this problem: I want to poll various directories(can be run in the main thread). Once I notice a file has

Re: python image - ignore values in resize

2009-03-06 Thread Lie Ryan
Travis Kirstine wrote: I have be attempting to resize (downsample) a RGB image using the python image library resize function. Everything works fine but I would like to exclude black values 0,0,0 from the calculations. I have tried creating a alpha mask based on black values then performing the

Re: wxPython fast and slow

2009-03-06 Thread Lie Ryan
iu2 wrote: Do you have any idea of what is going wrong? I think this might be related to the OS's process prioritization, focused Windows would get more priority than background window. -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing/Crawler Questions - solution

2009-03-07 Thread Lie Ryan
bruce wrote: john... again the problem i'm facing really has nothing to do with a specific url... the app i have for the usc site works... but for any number of reasons... you might get different results when running the app.. -the server could be screwed up.. -data might be cached -data mi

Re: create boolean

2009-03-07 Thread Lie Ryan
Fencer wrote: Hi, I need a boolean b to be true if the variable n is not None and not an empty list, otherwise b should be false. I ended up with: b = n is not None and not not n which seems to work but is that normally how you would do it? It can be assumed that n is always None or a list that

Re: "/a" is not "/a" ?

2009-03-07 Thread Lie Ryan
Steven D'Aprano wrote: Albert Hopkins wrote: I would think (not having looked) that the implementation of == would first check for identity (for performance reasons)... For some types, it may. I believe that string equality testing first tests whether the two strings are the same string, then

Re: Is there a better way of doing this?

2009-03-07 Thread Lie Ryan
mattia wrote: Il Sat, 07 Mar 2009 00:05:53 -0200, Gabriel Genellina ha scritto: En Fri, 06 Mar 2009 21:31:01 -0200, mattia escribió: Thanks, I've found another solution here: http://www.obitko.com/tutorials/ genetic-algorithms/selection.php so here is my implementation: def get_fap(fitness

Re: "/a" is not "/a" ?

2009-03-08 Thread Lie Ryan
Mel wrote: wrote: Steven D'Aprano writes: It is never correct to avoid using "is" when you need to compare for identity. When is it ever necessary to compare for identity? Ho-hum. MUDD game. def broadcast (sender, message): for p in all_players: if p is not sender:

Re: "/a" is not "/a" ?

2009-03-08 Thread Lie Ryan
Robert Kern wrote: On 2009-03-07 08:14, Christian Heimes wrote: Steven D'Aprano wrote: Yes. Floating point NANs are required to compare unequal to all floats, including themselves. It's part of the IEEE standard. As far as I remember that's not correct. It's just the way C has interpreted the

Re: help with printing to stdout...

2009-03-08 Thread Lie Ryan
Chris Rebert wrote: On Sun, Mar 8, 2009 at 1:37 AM, Daniel Dalton wrote: Hi, I've got a program here that prints out a percentage of it's completion. Currently with my implimentation it prints like this: 0% 1% 2% 3% 4% etc taking up lots and lots of lines of output... So, how can I make it wr

Re: 2.6.1 - simple division

2009-03-08 Thread Lie Ryan
farsi...@gmail.com wrote: On Mar 8, 2:16 pm, farsi...@gmail.com wrote: 4 / 5.0 0.84 This one is a common FAQ. Basically floating point is never to be trusted. This issue is quite language agnostic, however some language decided to "hide" the issue, python does not. For more

Re: Callback from c thread with ctypes

2009-03-08 Thread Lie Ryan
Victor Lin wrote: On 3月8日, 下午9時56分, "Diez B. Roggisch" wrote: Victor Lin schrieb: Hi, I am going to develop a c library binding with ctypes. That c library will call callback from worker threads it created. Here comes the problem : Will the GIL be acquired before it goes into Python functio

Re: create boolean

2009-03-08 Thread Lie Ryan
Scott David Daniels wrote: Lie Ryan wrote: Fencer wrote: The literal translation of that would be: if n is not None and n != []: b = True else: b = False it is a bit verbose, so one might want to find something shorter b = True if n is not None and n != [] else False I always feel if

Re: 2.6.1 - simple division

2009-03-08 Thread Lie Ryan
Duncan Booth wrote: farsi...@gmail.com wrote: Thanks all, that's very helpful, sorry to waste your time with a common question. I have tried the decimal module and will definitely keep using it if I need to do this kind of calculation again. Try to remember though that the decimal module simp

Re: a potential pep to extend the syntax of for loops

2009-03-09 Thread Lie Ryan
Hello, This is an idea about something I'd like to see implemented in python. I understand that's the purpose of PEPs, so I'll write it as a PEP, but send it here to receive your valuable feedback. Abstract This is a proposal to increase the richness of for loops, only to the extent that it

Re: Is python worth learning as a second language?

2009-03-09 Thread Lie Ryan
ZikO wrote: Hi I hope I won't sound trivial with asking my question. I am a C++ programmer and I am thinking of learning something else because I know second language might be very helpful somehow. I have heard a few positive things about Python but I have never writen any single line in pyt

Re: Is python worth learning as a second language?

2009-03-09 Thread Lie Ryan
Michele Simionato wrote: On Mar 9, 12:47 pm, Tim Wintle wrote: My slight issue with this list that I think things are in too many places. Yeah, that issue did pass through my head when I posted it, but I was too lazy to do proper listing of various language from various paradigms. I thoug

Re: Why is lambda allowed as a key in a dict?

2009-03-09 Thread Ryan Kelly
ode. Consider: >>> a = lambda arg: arg >>> x = {} >>> x[a] = 5 >>> x[a] 5 >>> x[lambda arg:arg] Traceback (most recent call last): File "", line 1, in KeyError: at 0xa06602c> >>> Cheers, Ryan -- Ryan Kelly http://www

Re: Set & Frozenset?

2009-03-10 Thread Lie Ryan
Matt Nordhoff wrote: Alan G Isaac wrote: Hans Larsen schrieb: How could I "take" an elemment from a set or a frozenset On 3/8/2009 2:06 PM Diez B. Roggisch apparently wrote: You iterate over them. If you only want one value, use iter(the_set).next() I recall a claim that f

Re: Set & Frozenset?

2009-03-11 Thread Lie Ryan
R. David Murray wrote: Lie Ryan wrote: Matt Nordhoff wrote: Alan G Isaac wrote: Hans Larsen schrieb: How could I "take" an elemment from a set or a frozenset On 3/8/2009 2:06 PM Diez B. Roggisch apparently wrote: You iterate over them. If you only want one value

Re: functions - where to store them

2009-03-11 Thread Lie Ryan
plsulliv...@gmail.com wrote: I have several functions which I would like to store in a different directory so several programs can use them. I can't seem to find much information about how to call a function if the function code is not actually in the script itself. The problem: do I have to cut

Re: UnicodeEncode Error ?

2009-03-11 Thread Lie Ryan
Rama Vadakattu wrote: While doing the below 1) fetch html page 2) extract title using BeatifulSoup 3) Save into the database. iam getting the below error (at the bottom). Few observations which i had: 1) type of variable which holds this title is 2) iam getting this problem when th

Re: Why is lambda allowed as a key in a dict?

2009-03-11 Thread Lie Ryan
Terry Reedy wrote: r wrote: On Mar 11, 3:40 pm, Craig Allen wrote: On Mar 10, 1:39 pm, Paul Rubin wrote: Identical strings don't necessarily have the same id: A more verbose way to put this is "Requesting a string with a value that is the same an an existi

Re: unbiased benchmark

2009-03-12 Thread Lie Ryan
Martin P. Hellwig wrote: Philip Semanchuk wrote: On Mar 12, 2009, at 4:20 PM, Daniel Fetchinson wrote: Even more amazingly, it takes approximately 30% less time to say 'ruby' than to say 'python'!!! But "python" scores 55% more points than "ruby" in Scrabble, so that's understandable. It

Re: loop performance in global namespace (python-2.6.1)

2009-03-12 Thread Lie Ryan
John Machin wrote: On Mar 13, 2:41 am, spir wrote: Le Thu, 12 Mar 2009 11:13:33 -0400, Kent Johnson s'exprima ainsi: Because local name lookup is faster than global name lookup. Local variables are stored in an array in the stack frame and accessed by index. Global names are stored in a dict

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-12 Thread Lie Ryan
Hendrik van Rooyen wrote: "Ulrich Eckhardt" wrote: IOW, why not explicitly say what you want using keyword arguments with defaults instead of inventing an IMHO cryptic, read-only mini-language? Seriously, the problem I see with this proposal is that its aim to be as short as possible actually

Re: "import" not working?

2009-03-12 Thread Lie Ryan
Scott David Daniels wrote: Aahz wrote: In article , Rhodri James wrote: ... sys.path.append("C:\\DataFileTypes") My preference: sys.path.append(r"C:\DataFileTypes") This doesn't work if you need to add a trailing backslash, though. Also my preference (except, due to aging eyes and bad font

Re: __import__ with dict values

2009-03-12 Thread Lie Ryan
Gabriel Genellina wrote: En Thu, 12 Mar 2009 09:27:35 -0200, alex goretoy escribió: note i would still like to be able to do __import__("sys")."path" p = __import__("sys").path That's a convoluted way of doing: import sys p = sys.path (except that the latter one inserts "sys" in the curr

Re: Raw String Question

2009-03-13 Thread Lie Ryan
MRAB wrote: In Python 3.x a backslash doesn't have a special meaning in a raw string, except that it can prevent a following quote from ending the string, but the backslash is still included. Why? How useful is that? I think it would've been simpler if a backslash had _no_ special effect, not ev

Re: "import" not working?

2009-03-13 Thread Lie Ryan
Steve Holden wrote: Lie Ryan wrote: Scott David Daniels wrote: Aahz wrote: In article , Rhodri James wrote: ... sys.path.append("C:\\DataFileTypes") My preference: sys.path.append(r"C:\DataFileTypes") This doesn't work if you need to add a trailing backslash, th

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-13 Thread Lie Ryan
Raymond Hettinger wrote: [andrew cooke] would it break anything to also allow format(1234567, 'd') # what we have now '1234567' format(1234567, '.d') # proposed new option '1.234.567' format(1234.5, ',2f') # proposed new option '1234,50' format(1234.5, '.,2f') # pr

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-13 Thread Lie Ryan
Raymond Hettinger wrote: Motivation: Provide a simple, non-locale aware way to format a number with a thousands separator. Adding thousands separators is one of the simplest ways to improve the professional appearance and readability of output exposed to end users. In

Re: __import__ with dict values

2009-03-13 Thread Lie Ryan
Gabriel Genellina wrote: En Fri, 13 Mar 2009 17:12:49 -0200, alex goretoy escribió: wow, ok, thank you Gabriel, I wasn't aware of x,'y',z This is what I decided to go with for now in one of my classes, but another class will need a modified version of this, as mentioned x,'y',z B=

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-13 Thread Lie Ryan
Raymond Hettinger wrote: If anyone here is interested, here is a proposal I posted on the python-ideas list. The idea is to make numbering formatting a little easier with the new format() builtin in Py2.6 and Py3.0: http://docs.python.org/library/string.html#formatspec ---

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-13 Thread Lie Ryan
Raymond Hettinger wrote: [Lie Ryan] > In the finance world, output with commas is the norm. I can't cite any source, but I am skeptical with that. No doubt that you're skeptical of anything you didn't already know ;-) I'm a CPA, was a 15 year division contr

Re: String to sequence

2009-03-14 Thread Lie Ryan
mattia wrote: Il Sat, 14 Mar 2009 10:30:43 +0100, Vlastimil Brom ha scritto: 2009/3/14 mattia : How can I convert the following string: 'AAR','ABZ','AGA','AHO','ALC','LEI','AOC', EGC','SXF','BZR','BIQ','BLL','BHX','BLQ' into this sequence: ['AAR','ABZ','AGA','AHO','ALC','LEI','AOC', EGC','S

Re: List the moduels of a package

2009-03-15 Thread Lie Ryan
mattia wrote: Hi all, how can I list the modules provided by a package? >>> import package >>> help(package) -- http://mail.python.org/mailman/listinfo/python-list

Threads not Improving Performance in Program

2009-03-19 Thread Ryan Rosario
I have a parser that needs to process 7 million files. After running for 2 days, it had only processed 1.5 million. I want this script to parse several files at once by using multiple threads: one for each file currently being analyzed. My code iterates through all of the directories within a dire

Re: Why doesn't this work ? For loop variable scoping ?

2009-03-19 Thread Ryan Kelly
from typos in variable names. Ryan -- Ryan Kelly http://www.rfk.id.au | This message is digitally signed. Please visit r...@rfk.id.au| http://www.rfk.id.au/ramblings/gpg/ for details signature.asc Description: This is a digitally signed message part -- http://mail.python.org/mailman/listinfo/python-list

Re: Threads not Improving Performance in Program

2009-03-19 Thread Ryan Rosario
On Mar 19, 10:35 am, Jean-Paul Calderone wrote: > On Thu, 19 Mar 2009 09:50:51 -0700, Ryan Rosario > wrote: > >I have a parser that needs to process 7 million files. After running > >for 2 days, it had only processed 1.5 million. I want this script to > >parse severa

Re: WINXP vs. LINUX in threading.Thread

2009-04-22 Thread Lie Ryan
Diez B. Roggisch wrote: Kent schrieb: hello all, i want to add a "new update notification" feature to my wxPython appl. The codes below do the job. The logic is simple enough, I don't think it needs to be explained. since sometimes, under windows, proxy setting was a script. and was set in IE.

Re: can't find the right simplification

2009-04-23 Thread Lie Ryan
Stef Mientki wrote: hello, I've a program where you can connect snippets of code (which I call a "Brick") together to create a program. To make it easier to create these code snippets, I need some simplifications. For simple parameters ( integer, tupple, list etc) this works ok, and is done

Re: and [True,True] --> [True, True]?????

2009-04-23 Thread Lie Ryan
Steven D'Aprano wrote: On Mon, 20 Apr 2009 15:13:15 -0500, Grant Edwards wrote: I fail to see the difference between "length greater than 0" and "list is not empty". They are, by definition, the same thing, aren't they? For built-in lists, but not necessarily for arbitrary list-like sequenc

Re: and [True,True] --> [True, True]?????

2009-04-23 Thread Lie Ryan
Gerhard Häring wrote: len() make it clear that the argument is a sequence. Not necessarily. Classes that overrides __len__ may fool that assumption (well, in python classes that overrides special functions may do anything it is never intended to do). I often think an "if item:" as "is item

Re: Why bool( object )?

2009-04-27 Thread Lie Ryan
Aaron Brady wrote: What is the rationale for considering all instances true of a user- defined type? User-defined objects (or type) can override .__len__() [usually container types] or .__nonzero__() to make bool() returns False. Is it strictly a practical stipulation, or is there somethi

Re: Using ascii numbers in regular expression

2009-04-30 Thread Lie Ryan
MRAB wrote: You're almost there: re.subn('\x61','b','') or better yet: re.subn(r'\x61','b','') Wouldn't that becomes a literal \x61 instead of "a" as it is inside raw string? -- http://mail.python.org/mailman/listinfo/python-list

Re: sorted() erraticly fails to sort string numbers

2009-04-30 Thread Lie Ryan
John Posner wrote: uuid wrote: I am at the same time impressed with the concise answer and disheartened by my inability to see this myself. My heartfelt thanks! Don't be disheartened! Many people -- myself included, absolutely! -- occasionally let a blind spot show in their messages to this li

Re: print(f) for files .. and is print % going away?

2009-04-30 Thread Lie Ryan
Esmail wrote: Hello all, I use the print method with % for formatting my output to the console since I am quite familiar with printf from my C days, and I like it quite well. There has never been print-with-formatting in python, what we have is the % string substitution operator, which is a s

Re: [ANN] regobj - Pythonic object-based access to the Windows Registry

2009-05-04 Thread Ryan Kelly
> > I've just released the results of a nice Sunday's coding, inspired by > > one too many turns at futzing around with the _winreg module. The > > "regobj" module brings a convenient and clean object-based API for > > accessing the Windows Registry

Re: Checking for required arguments when instantiating class.

2009-05-06 Thread Lie Ryan
Lacrima wrote: class First: def __init__(self, *args, **kwargs): pass class Second: def __init__(self, somearg, *args, **kwargs): self.somearg = somearg How can I test that First class takes 1 required argument and Second class takes no require

Re: Self function

2009-05-06 Thread Lie Ryan
Luis Zarrabeitia wrote: Btw, is there any way to inject a name into a function's namespace? Following the python tradition, maybe we should try to create a more general solution! How about a mechanism to pass arguments that are optional to accept? So (in the general case) the caller can call a

Re: list comprehension question

2009-05-07 Thread Lie Ryan
Steven D'Aprano wrote: "If you’ve got the stomach for it, list comprehensions can be nested. They are a powerful tool but – like all powerful tools – they need to be used carefully, if at all." How does this discourage the use of list comprehensions? At most, it warns that complicated list com

Re: list comprehension question

2009-05-07 Thread Lie Ryan
Lie Ryan wrote: Steven D'Aprano wrote: "If you’ve got the stomach for it, list comprehensions can be nested. They are a powerful tool but – like all powerful tools – they need to be used carefully, if at all." How does this discourage the use of list comprehensions? At most,

Re: list comprehension question

2009-05-07 Thread Lie Ryan
Scott David Daniels wrote: John Posner wrote: Shane Geiger wrote: if type(el) == list or type(el) is tuple: A tiny improvement: if type(el) in (list, tuple): or (even better) if isinstance(el, (list, tuple)) However, it is my contention that you shouldn't be flattening by typ

Re: Logging exceptions to a file

2009-05-07 Thread Lie Ryan
Pierre GM wrote: All, I need to log messages to both the console and a given file. I use the following code (on Python 2.5) import logging # logging.basicConfig(level=logging.DEBUG,) logfile = logging.FileHandler('log.log') logfile.setLevel(level=logging.INFO) logging.getLogger('').addHandler(l

Re: Simple programme - Just want to know whether this is correct way of coding

2009-05-08 Thread Lie Ryan
guptha wrote: Hi group, This is my first programme in python ,I need to know whether my code is in the right path of performance I wrote a code using multithreading to send mails Can't you use BCC? The code Works fine ,but I doubt about the performance issue ,My intention is to send mails co

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-08 Thread Lie Ryan
Casey Hawthorne wrote: I'm intrigued that Python has some functional constructions in the language. Would it be possible to more clearly separate the pure code (without side effects) from the impure code (that deals with state changes, I/O, etc.), so that the pure code could be compiled and have

Re: itertools question

2009-05-14 Thread Lie Ryan
Neal Becker wrote: Is there any canned iterator adaptor that will transform: in = [1,2,3] into: out = [(1,2,3,4), (5,6,7,8),...] That is, each time next() is called, a tuple of the next N items is returned. An option, might be better since it handles infinite list correctly: >>>

Re: itertools question

2009-05-14 Thread Lie Ryan
Chris Rebert wrote: They really should just add grouper() to itertools rather than leaving it as a recipe. People keep asking for it so often... I've just added it to the issue tracker: http://bugs.python.org/issue6021 -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding a Par construct to Python?

2009-05-21 Thread Lie Ryan
Carl Banks wrote: There must be another reason (i.e, the refcounts) to argue _for_ the GIL, Why? Nobody likes GIL, but it just have to be there or things starts crumbling... Nobody would actually argue _for_ GIL, they just know from experience, that people that successfully GIL in the past,

Re: Performance java vs. python

2009-05-21 Thread Lie Ryan
Sion Arrowsmith wrote: OTOH, I consider it a productive day if I end up with fewer lines of code than I started with. A friend once justified a negative LOC count as being the sign of a good day with the following observation: Code that doesn't exist contains no bugs. Code that doesn't exist t

Re: What is the difference between init and enter?

2009-05-26 Thread Lie Ryan
Diez B. Roggisch wrote: John wrote: I'm okay with init, but it seems to me that enter is redundant since it appears that anything you want to execute in enter can be done in init. About what are you talking? Diez Do you mean __init__ and __enter__? They are used for two completely diffe

Re: How to test python snippets in my documents?

2009-05-26 Thread Lie Ryan
Matthew Wilson wrote: I'm using a homemade script to verify some code samples in my documentation. Here it is: #! /usr/bin/env python2.6 # vim: set expandtab ts=4 sw=4 filetype=python: import doctest, os, sys def main(s): "Run doctest.testfile(s, None)" retur

Re: What text editor is everyone using for Python

2009-05-29 Thread Lie Ryan
norseman wrote: > jeffFromOz wrote: >> On May 26, 10:07 pm, Lacrima wrote: >>> I am new to python. >>> And now I am using trial version of Wing IDE. >>> But nobody mentioned it as a favourite editor. >>> So should I buy it when trial is expired or there are better choices? >> >> No one mentioned t

Re: How does Python's OOP feel?

2009-05-29 Thread Lie Ryan
Ikon wrote: > I'm rather new to Python. I have PHP for my main language and I do > some Java. They all have a very strict OO schema. As I red through > Python's tutorial it seams it has nothing of those rules. No statical, > abstract classes, functions, or variables. > > I wish someone, who has ex

Re: newbie: popen question

2009-05-29 Thread Lie Ryan
thebiggestbangthe...@gmail.com wrote: > On May 28, 5:31 am, Sebastian Wiesner wrote: >> >> >>> Your best bet is to make sudo not ask for a password. :) If you >>> don't have the rights, then you can use pexpect to do what you want to >>> do. http://pexpect.sourceforge.net/pexpect.html >>> See

Re: Class Methods help

2009-05-31 Thread Lie Ryan
bdsatish wrote: > Hi, > > I have a question regarding the difference b/w "class methods" and > "object methods". Consider for example: > > class MyClass: > x = 10 > > Now I can access MyClass.x -- I want a similar thing for functions. I > tried > > class MyClass: > def some_func(x

Re: Metaclass mystery

2009-06-01 Thread Lie Ryan
LittleGrasshopper wrote: > On May 31, 2:03 pm, a...@pythoncraft.com (Aahz) wrote: >> In article >> , >> >> LittleGrasshopper wrote: On May 31, 12:19=A0am, Arnaud Delobelle wrote: > [1]http://www.python.org/download/releases/2.2.3/descrintro/ >>> I'm about 2/3 of the way through this pa

Re: Challenge supporting custom deepcopy with inheritance

2009-06-02 Thread Lie Ryan
Gabriel Genellina wrote: > En Mon, 01 Jun 2009 14:19:19 -0300, Michael H. Goldwasser > escribió: > >> I can examine the inherited slots to see which special methods are >> there, and to implement my own __deepcopy__ accordingly. But to do >> so well seems to essentially require reimplementi

Re: Why date do not construct from date?

2009-06-02 Thread Lie Ryan
Gabriel Genellina wrote: > En Tue, 02 Jun 2009 03:14:22 -0300, Chris Rebert > escribió: > >> On Mon, Jun 1, 2009 at 10:25 PM, Alexandr N Zamaraev >> wrote: > >> import datetime as dt >> d = dt.date(2009, 10, 15) >> dt.date(d) >>> Traceback (most recent call last): >>> File "", line

Re: Why date do not construct from date?

2009-06-02 Thread Lie Ryan
Lie Ryan wrote: > Gabriel Genellina wrote: >> En Tue, 02 Jun 2009 03:14:22 -0300, Chris Rebert >> escribió: >> >>> On Mon, Jun 1, 2009 at 10:25 PM, Alexandr N Zamaraev >>> wrote: >>>>>>> import datetime as dt >>>>>>&

RE: unittest: Calling tests in liner number order

2008-05-25 Thread Ryan Ginstrom
_ones() Now you do something like run the unit tests every time a file is saved, and run the whole shebang nightly and every time a build is performed. Regards, Ryan Ginstrom -- http://mail.python.org/mailman/listinfo/python-list

RE: [Business apps for Windows] Good grid + calendar, etc.?

2008-06-01 Thread Ryan Ginstrom
ess plugging, I wrote an overview of Python GUI platforms for Windows a month or two ago: http://ginstrom.com/scribbles/2008/02/26/python-gui-programming-platforms-fo r-windows/ For your stated needs, I'd advise checking out IronPython or Python.NET (which allow use of .NET GUI libraries). Re

RE: [Business apps for Windows] Good grid + calendar, etc.?

2008-06-01 Thread Ryan Ginstrom
Drag & Drop. I've yet to deploy this approach in an application, but from my prototypes I'm liking it. Regards, Ryan Ginstrom -- http://mail.python.org/mailman/listinfo/python-list

RE: [Business apps for Windows] Good grid + calendar, etc.?

2008-06-01 Thread Ryan Ginstrom
te the same. Also, using COM you can manipulate the DOM from Python, removing the need for AJAX. In that case, your only need for JavaScript would be for prebuilt library functionality (assuming you like Python better than JavaScript). Regards, Ryan Ginstrom -- http://mail.python.org/mailman/listinfo/python-list

Re: Rotating a cube

2008-07-17 Thread Ryan Smith
icism is welcome :-) Regards, Ryan On Jul 17, 2:11 am, J-Burns <[EMAIL PROTECTED]> wrote: > On Jul 17, 12:53 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > J-Burns wrote: > > > Is there a built in Python function for this? > > > for answering question

Re: Change PC to Win or Windows

2008-07-22 Thread Lie Ryan
On Mon, 2008-07-21 at 18:50 -0400, Derek Martin wrote: > On Mon, Jul 21, 2008 at 02:47:31PM -0700, Lie wrote: > > Common usage isn't always correct. > > Actually it is, inherently... When usage becomes common, the language > becomes redefined, and its correctness is therefore true by identity >

Re: Insert character at a fixed position of lines

2008-07-26 Thread Lie Ryan
On Sat, 2008-07-26 at 17:47 +0200, Francesco Pietra wrote: > Sorry to come again for the same problem. On commanding: > > $ python script.py 2>&1 | tee fileout.pdb > > nothing occurred (fileout.pdb was zero byte). The script reads: > > f = open("xxx.pdb", "w") > f.write('line = line[:22] + "A" +

Trying to fix Invalid CSV File

2008-08-03 Thread Ryan Rosario
ome quoted text" where the quotes should have been doubled",321 Has anyone dealt with this problem before? Any ideas of an algorithm I can use for a Python script to create a new, repaired CSV file? TIA, Ryan -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to fix Invalid CSV File

2008-08-04 Thread Ryan Rosario
On Aug 3, 10:38 pm, Emile van Sebille <[EMAIL PROTECTED]> wrote: > Ryan Rosario wrote: > > I have a very large CSV file that contains double quoted fields (since > > they contain commas). Unfortunately, some of these fields also contain > > other double quotes and I

Re: Trying to fix Invalid CSV File

2008-08-04 Thread Ryan Rosario
On Aug 4, 1:01 am, John Machin <[EMAIL PROTECTED]> wrote: > On Aug 4, 5:49 pm, Ryan Rosario <[EMAIL PROTECTED]> wrote: > > > > > Thanks Emile! Works almost perfectly, but is there some way I can > > adapt this to quote fields that contain a comma in them? &g

Re: Trying to fix Invalid CSV File

2008-08-04 Thread Ryan Rosario
On Aug 4, 8:30 am, Emile van Sebille <[EMAIL PROTECTED]> wrote: > John Machin wrote: > > On Aug 4, 6:15 pm, Ryan Rosario <[EMAIL PROTECTED]> wrote: > >> On Aug 4, 1:01 am, John Machin <[EMAIL PROTECTED]> wrote: > > >>> On Aug 4, 5:49 pm, Ryan Ros

Re: Trying to fix Invalid CSV File

2008-08-05 Thread Ryan Rosario
On Aug 4, 1:56 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > Ryan Rosario wrote: > > On Aug 4, 8:30 am, Emile van Sebille <[EMAIL PROTECTED]> wrote: > >> John Machin wrote: > >>> On Aug 4, 6:15 pm, Ryan Rosario <[EMAIL PROTECTED]> wrote: > &g

problem calling parent's __init__ method

2008-08-07 Thread Ryan Krauss
ere class empty_class(object): def __init__(self,_d={},**kwargs): kwargs.update(_d) self.__dict__=kwargs I still get the same error. Why doesn't this work? Thanks, Ryan -- http://mail.python.org/mailman/listinfo/python-list

Re: problem calling parent's __init__ method

2008-08-07 Thread Ryan Krauss
Thanks to Peter and Jerry for their help. Ryan On Thu, Aug 7, 2008 at 10:36 AM, Peter Otten <[EMAIL PROTECTED]> wrote: > Ryan Krauss wrote: > >> I am trying to call a parent's __init__ method from the child's: >> >> class ArbitraryBlock(InnerBlock): >>

RE: Build complete, now I just need to "install" it...

2008-03-30 Thread Ryan Ginstrom
ficient to edit the specs (e.g. in C:\MinGW\lib\gcc\mingw32\3.4.2) like so: *libgcc: %{mthreads:-lmingwthrd} -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcr71 And tell distutils to use mingw, by putting this in lib/distutils/distutils.cfg: [build] compiler=mingw32 [build_ext] compiler=mingw32 Reg

RE: Automatically fill in forms on line

2008-03-31 Thread Ryan Ginstrom
write code for step 2, 4 and 5. I suggest looking at mechanize: http://wwwsearch.sourceforge.net/mechanize/ If you're going to do this frequently, you also might want to check out the site's policy on robots. Mechanize does have a function to automatically handle a site's robots

RE: Copy Stdout to string

2008-04-01 Thread Ryan Ginstrom
bj): """Writes obj to the output stream, storing it to a buffer as well""" self.out.write(obj) self.buffer.write(obj) def getvalue(self): """Retrieves the buffer value""" return

RE: ANN: pry unit testing framework

2008-04-06 Thread Ryan Ginstrom
s sophisticated options. Thus it appears that the potential user base is rather small... Regards, Ryan Ginstrom -- http://mail.python.org/mailman/listinfo/python-list

RE: Splitting MainWindow Class over several modules.

2008-04-16 Thread Ryan Ginstrom
lay code in a > separate file and imported them into my main program. There are also several signaling techniques that make it easy to separate the GUI logic from the message-processing logic. Or you could simply have a controller class that instantiates the GUI class and registers itself as the

Python -v import behavior

2008-04-30 Thread Sean Ryan
Hi all, (A similar question was posted by a colleague, but did not appear to reach comp.lang.python or this list). I am wondering if the -v option causes the python application to be more tolerant to module import warnings and / or errors. The reason is that a module is failing to import correct

RE: firefox add-on to grab python code handily?

2008-05-10 Thread Ryan Ginstrom
many people would actually use it. Not that I'm going to implement it, but it would be really neat to tie something together with codepad[1] [1] http://codepad.org/ (With the site owner's permission, of course!) Regards, Ryan Ginstrom -- http://mail.python.org/mailman/listinfo/python-list

Re: What is not objects in Python?

2008-09-30 Thread Lie Ryan
On Mon, 2008-09-29 at 21:03 -0700, namekuseijin wrote: > On 28 set, 15:29, process <[EMAIL PROTECTED]> wrote: > > I have heard some criticism about Python, that it is not fully object- > > oriented. > > So what? > > > Why isn't len implemented as a str.len and list.len method instead of > > a len

Re: r""

2008-09-30 Thread Lie Ryan
On Tue, 30 Sep 2008 10:50:01 -0700, Kyle Hayes wrote: >> Please describe the actual problem you're trying to solve. In what way >> do slashes need to be "fixed," and why? > > Well, I have decided to build a tool to help us sync files in UNC paths. > I am just building the modules and classes righ

Re: [Tutor] Replacing cmd.exe with custom .py application

2008-09-30 Thread Lie Ryan
On Tue, 30 Sep 2008 15:09:06 -0400, Ezra Taylor wrote: > Is there something similar to /dev/null on Windows? I think it's called nul REM This is a batch file (.bat) echo "This won't show" > NUL I'm not sure how to use it in python though. -- http://mail.python.org/mailman/listinfo/python-list

Re: Output of pexpect

2008-10-01 Thread Lie Ryan
On Tue, 30 Sep 2008 20:48:12 -0700, Anh Khuong wrote: > I am using pexpect and I want to send output of pexpet to both stdout > and log file concurrently. Anybody know a solution for it please let me > know. One way is to create a file-like object that forked the output to stdout and the logfil

Re: ssh keepalive

2008-10-01 Thread Lie Ryan
On Wed, 01 Oct 2008 00:30:59 -0700, loial wrote: > I have a problem with a ssh connection in python > > I get the error > > 'NoneType' object has no attribute 'exec_command' > > I am thinking that maybe the ssh connection is timeing out. > > Since I have no control over the configuration of th

Re: Event-driven framework (other than Twisted)?

2008-10-01 Thread Lie Ryan
On Wed, 01 Oct 2008 01:01:41 -0700, Phillip B Oldham wrote: > Are there any python event driven frameworks other than twisted? Most GUI package use event-driven model (e.g. Tkinter). -- http://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   6   7   8   9   10   >