Suggestion: Regex string specifier like r and f

2023-01-08 Thread Raphael Santiago
Maybe something like re"" It should behave exactly like a raw string but would be useful for syntax highlighting and debugging. Perhaps also for type hinting expected regex input (don't know if this is feasible). -- https://mail.python.org/mailman/listinfo/python-list

Results of arpalert to json in python

2014-10-10 Thread raphael houtin
Hello, I'm trying to create a program who'll catch the mac address connections. For this, I take the /var/log/arpalert.log and create a dict. with the results in JSON. I'm a beginner in Python. For now, I have the arpalert log to a file.txt. I take this file and create a dictionary in an other

matplotlib - removing text from a figure - a bug?

2013-02-11 Thread Raphael Mameghani
Does anyone know if the following error message is a matplotlib bug? Is there an correct/alternative way to remove (or replace) text? Thank you, Raphael from matplotlib.figure import Figure fig = Figure() caption = fig.suptitle("test") caption.remove() Traceback (most recent call las

Re: Interpolating/crossfading a stack of matrices

2013-01-11 Thread raphael
interpolation is supposed to work > (I've only ever used linear and cubic) but you should be able to do > the same sort of thing. > > Oscar Indeed, the 'manual' reimplementation of the interpolation formula using numpy arrays significantly sped up the code. The numexpr package made it even faster. Thanks a lot for your advice! Raphael -- http://mail.python.org/mailman/listinfo/python-list

Interpolating/crossfading a stack of matrices

2013-01-09 Thread raphael
ge(i_range): for j in xrange(j_range): # interpolated value for x = 0.2 y_interpol[i,j] = interp1d(x, y[i, j,:], kind='quadratic')(0.2) print y_interpol -====----- Cheers, Raphael -- http://mail.python.org/mailman/listinfo/python-list

getopt question

2010-04-09 Thread Raphael Mayoraz
; is not in the argument given in getopt.getopt, but it doesn't. What am I doing wrong ? Using python 2.6.4 on WindowXP. Thanks. Raphael - #!/usr/bin/env python import sys import getopt try: opts, args = getopt.getopt(sys.argv[1:

getopt question

2010-04-09 Thread Raphael Mayoraz
et the 'Invalid option' error message now: > python testGetOpt.py -a junk1 -c junk2 I'm expecting this to also print the error message, as 'c' is not in the argument given in getopt.getopt, but it doesn't. What am I doing wrong ? Using python 2.6.4 o

Re: Variable definition

2010-03-01 Thread Raphael Mayoraz
John Posner wrote: On 2/26/2010 6:32 PM, Raphael Mayoraz wrote: Hello, I'd like to define variables with some specific name that has a common prefix. Something like this: varDic = {'red': 'a', 'green': 'b', 'blue': 'c'} for

Re: DreamPie - The Python shell you've always dreamed about!

2010-03-01 Thread Noam Yorav-Raphael
Can you try DreamPie 1.0.1 and say if it still happens? There's a bug report system at launchpad.net/dreampie. Thanks, Noam -- http://mail.python.org/mailman/listinfo/python-list

Re: DreamPie - The Python shell you've always dreamed about!

2010-03-01 Thread Noam Yorav-Raphael
This is most probably a bug discovered in DreamPie 1.0 (See https://bugs.launchpad.net/dreampie/+bug/525652 ) Can you try to download DreamPie 1.0.1, and if it still happens, report a bug? Thanks! Noam -- http://mail.python.org/mailman/listinfo/python-list

Variable definition

2010-02-26 Thread Raphael Mayoraz
value I know this is illegal, but there must be a trick somewhere. Thanks, Raphael -- http://mail.python.org/mailman/listinfo/python-list

Re: DreamPie - The Python shell you've always dreamed about!

2010-02-23 Thread Noam Yorav-Raphael
‎Thanks! I'm happy you like it! Thanks for the feedback too. Here are my replies. On Sun, Feb 21, 2010 at 7:13 PM, Chris Colbert wrote: > This is bloody fantastic! I must say, this fixes everything I hate about > Ipython and gives me the feature I wished it had (with a few minor > exceptions). >

Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Noam Yorav-Raphael
Delete \Documents and Settings\\DreamPie and it should now work. Did you edit the colors using the configuration window or manually? If you edited them using the configuration window, can you give instructions on how to reproduce the bug? Noam On Feb 21, 3:06 pm, "Aage Andersen" wrote: > I reins

DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Noam Yorav-Raphael
I'm pleased to announce DreamPie 1.0 - a new graphical interactive Python shell! Some highlights: * Has whatever you would expect from a graphical Python shell - attribute completion, tooltips which show how to call functions, highlighting of matching parentheses, etc. * Fixes a lot of IDLE nuisa

Re: Problem comparing object graphs and trees

2006-12-15 Thread raphael . marvie
I am not drunk but should have rtfm. Sorry and Thanks. r. On Dec 15, 3:04 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > > > $ cat cmp.py > > > class A: > > def __init__(self, b): > > self.b = b > > def __cmp__(self, other): > > return self.b

Problem comparing object graphs and trees

2006-12-15 Thread raphael . marvie
Dear all, I am trying to compare graphes of object through the use of the __cmp__ operator. Before managing the problem of recursive comparison, I have tried a simple test which result surprises me. Here is the simplest code I can write that presents my problem: $ cat cmp.py class A: def _

Re: splitting a long string into a list

2006-11-27 Thread Raphael
What exactly seems to be the problem? "ronrsr" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I have a single long string - I'd like to split it into a list of > unique keywords. Sadly, the database wasn't designed to do this, so I > must do this in Python - I'm having some trouble

Understanding Unicode & encodings

2006-07-23 Thread Raphael . Benedet
1), but I always get an exception. Where does this ascii codec error comes from? How can I simply build this query string? Thanks in advance. Best Regards, Raphael -- http://mail.python.org/mailman/listinfo/python-list

Re: Why keep identity-based equality comparison?

2006-01-14 Thread Noam Raphael
Mike Meyer wrote: > Noam Raphael <[EMAIL PROTECTED]> writes: > >>>>Also note that using the current behaviour, you can't easily >>>>treat objects that do define a meaningful value comparison, by >>>>identity. >>> >>>Yes you

Re: Why keep identity-based equality comparison?

2006-01-14 Thread Noam Raphael
Mike Meyer wrote: > [EMAIL PROTECTED] writes: > >>try: >>return a == b >>except TypeError: >>return a is b > > > This isn't "easy". It's an ugly hack you have to use everytime you > want to iterate through a heterogenous set doing equality tests. I wouldn't define this as an "ugly ha

Re: Using distutils 2.4 for python 2.3

2005-09-23 Thread Noam Raphael
Fredrik Lundh wrote: > > you can enable new metadata fields in older versions by assigning to > the DistributionMetadata structure: > > try: > from distutils.dist import DistributionMetadata > DistributionMetadata.package_data = None > except: > pass > > setup

Using distutils 2.4 for python 2.3

2005-09-23 Thread Noam Raphael
Hello, I want to distribute a package. It's compatible with Python 2.3. Is there a way to use distutils 2.4 feature package_data, while maintaining the distribution compatible with python 2.3 ? Thanks, Noam Raphael -- http://mail.python.org/mailman/listinfo/python-list

Re: Running in Release or Debug version of the python interpreter?

2005-05-25 Thread Raphael Zulliger
here no debug/release version issues like on windows? doesn't import the python2.4-dbg (debian) binary different modules than python2.4? Raphael Zulliger Thomas Heller wrote: > Raphael Zulliger schrieb: > >> Hi >> >> I have to check wheter a .py script is run within

Running in Release or Debug version of the python interpreter?

2005-05-24 Thread Raphael Zulliger
lease version (where one is linked against debug C runtime dll and the other to release C runtime dll). Now I have to change the name of the dll I want to be loaded by ctypes... But how can I find out which of the dll I have to load?! Thanks in advance! Raphael Zulliger -- http://mail.python.org/ma

Re: How about "pure virtual methods"?

2004-12-31 Thread Noam Raphael
Thanks for your suggestion, but it has several problems which the added class solves: * This is a very long code just to write "you must implement this method". Having a standard way to say that is better. * You can instantiate the base class, which doesn't make sense. * You must use testing to

Re: Non blocking read from stdin on windows.

2004-12-25 Thread Noam Raphael
You can always have a thread which continually reads stdin and stores it in a string, or better, in a cStringIO.StringIO object. Then in the main thread, you can check whether something new has arrived. This, of course will work on all platforms. I hope this helped a bit, Noam -- http://mail.py

Re: How about "pure virtual methods"?

2004-12-25 Thread Noam Raphael
Thank you very much for this answer! I learned from you about unit tests, and you convinced me that "testing oriented programming" is a great way to program. You made me understand that indeed, proper unit testing solves my practical problem - how to make sure that all the methods which should

Re: How about "pure virtual methods"?

2004-12-25 Thread Noam Raphael
Mike Meyer wrote: That's what DbC languages are for. You write the contracts first, then the code to fullfill them. And get exceptions when the implementation doesn't do what the contract claims it does. Can you give me a name of one of them? This is a very interesting thing - I should lea

Re: How about "pure virtual methods"?

2004-12-23 Thread Noam Raphael
Mike Meyer wrote: Noam Raphael <[EMAIL PROTECTED]> writes: The answer is that a subclass is guaranteed to have the same *interface* as the base class. And that's what matters. This is false. For instance: class A(object): def method(self, a): print a class B(A): def method

Re: How about "pure virtual methods"?

2004-12-23 Thread Noam Raphael
Jp Calderone wrote: This lets you avoid duplicate test code as well as easily test new concrete implementations. It's an ideal approach for frameworks which mandate application-level implementations of a particular interface and want to ease the application developer's task. Jp It's a great

Re: How about "pure virtual methods"?

2004-12-21 Thread Noam Raphael
Scott David Daniels wrote: class Abstract(object): '''A class to stick anywhere in an inheritance chain''' __metaclass__ = MustImplement def notimplemented(method): '''A decorator for those who prefer the parameters declared.''' return NotImplemented I just wanted to say that I thou

Re: How about "pure virtual methods"?

2004-12-21 Thread Noam Raphael
Jeff Shannon wrote: Except that unit tests should be written to the *specification*, not the implementation. In other words, forgetting a complete method would require that you forget to write the method, *and* that you failed to translate the specification into unit tests *for that same method

Re: How about "pure virtual methods"?

2004-12-21 Thread Noam Raphael
My long post gives all the philosophy, but I'll give here the short answers. Mike Meyer wrote: +0 Python doesn't use classes for typing. As Alex Martelli puts it, Python uses protocols. So the client expecting a concrete subclass of your abstract class may get an instantiation of a class that doesn

Re: How about "pure virtual methods"?

2004-12-21 Thread Noam Raphael
Steve Holden wrote: Even if you can do it, how would you then implement a class hierarchy where the ultimate base class had virtual methods, and you wanted to derive from that class another class, to be used as a base class for usable classes, which implemented only a subset of the virtual metho

Re: How about "pure virtual methods"?

2004-12-21 Thread Noam Raphael
Thank you all, especially Alex for your enlightening discussion, and Scott for your implementation. I'm sorry that I can't be involved in a daily manner - but I did read all of the posts in this thread. They helped me understand the situation better, and convinced me that indeed this feature is

How about "pure virtual methods"?

2004-12-18 Thread Noam Raphael
a file named filename. """ pass class RealClass(BaseClass): def save_data(self, filename): open(filename).write(self.data) == then if I try to instantiate BaseClass I would get an exception, but instantiating RealClass will be ok.