Passing new fields to an object

2015-06-12 Thread Paulo da Silva
I would like to do something like this: class C: def __init__(self,**parms): ... c=C(f1=1,f2=None) I want to have, for the object self.f1=1 self.f2=None for an arbitrary number of parameters. What is the best way to achieve this? Thanks -- https://mail.python

Re: Passing new fields to an object

2015-06-12 Thread Paulo da Silva
On 12-06-2015 17:17, gst wrote: > Le vendredi 12 juin 2015 11:53:24 UTC-4, Paulo da Silva a écrit : > in the __init__, simply do: > > self.__dict__.update(**parms) > > regards, > Ok. Thanks. -- https://mail.python.org/mailman/listinfo/python-list

Re: Passing new fields to an object

2015-06-12 Thread Paulo da Silva
On 12-06-2015 17:17, Peter Otten wrote: > Paulo da Silva wrote: > ... > >>>> import types >>>> class C(types.SimpleNamespace): > ... pass > ... >>>> c = C(f1=1, f2=None) >>>> c > C(f1=1, f2=None) > Thanks for all your e

Re: Passing new fields to an object

2015-06-12 Thread Paulo da Silva
On 12-06-2015 20:12, Peter Otten wrote: > Paulo da Silva wrote: > >> On 12-06-2015 17:17, Peter Otten wrote: >>> Paulo da Silva wrote: >>> >> ... ... > It *is* a class, and by making C a subclass of SimpleNamespace C inherits > the initialiser which doe

Re: Passing new fields to an object

2015-06-12 Thread Paulo da Silva
On 13-06-2015 02:25, Steven D'Aprano wrote: > On Fri, 12 Jun 2015 16:53:08 +0100, Paulo da Silva wrote: > ... > > You should use SimpleNamespace, as Peter suggests, but *not* subclass it. > If you subclass it and add methods: > > class C(SimpleNamespace

Which GUI?

2015-07-24 Thread Paulo da Silva
Hi all! I am about to write an application (python3 in linux) that needs: 1. Display time series graphics dynamically changed as the application runs, i.e. the graphics should reflect some internal variables states. 2. The same but for some network like diagrams. Basically nodes and connections

Re: Which GUI?

2015-07-26 Thread Paulo da Silva
On 26-07-2015 05:47, blue wrote: > Hi . > I tested all. Now I think the PySide can more. No python3! Besides ... any differences to pyqt4? Thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: Which GUI?

2015-07-29 Thread Paulo da Silva
On 24-07-2015 19:31, Paulo da Silva wrote: I'll begin with pyqtgraph. Seems to be simple to start with. Thanks Chistopher. Later I'll give a try to bokeh. I'll need to look better at web applications first. I still don't know if dynamically changing is possible without the

Re: I'm a newbie and I'm stumped...

2015-08-01 Thread Paulo da Silva
On 31-07-2015 02:22, Dwight GoldWinde wrote: > Please help. > > I am running Python 3.4 on my Mac mini, OS X 10.10.2, using Coderunner 2 > as my editor. > > Here’s the code: > #!/usr/bin/env python3 > word = (input('Enter a word ‘)) As is here, this code should raise a syntax error message like

Trying pmw with python3: Lots of crashes!

2015-09-06 Thread Paulo da Silva
Hi! I took a look at tkinter. It is pretty simple but it's very hard to construct some relatively more complex widgets. So I looked at pmw. Because my system only have pmw for python2, I downloaded pmw2 from its site and installed it manually using pysetup.py install. Trying the examples ...: So

Re: Trying pmw with python3: Lots of crashes!

2015-09-06 Thread Paulo da Silva
Às 20:20 de 06-09-2015, Michael Torrie escreveu: > On 09/06/2015 12:47 PM, Paulo da Silva wrote: >> Do I need to go to more complex system like wxwidgets or pyside (QT)? >> I looked at the last one but, from the 1st steps, it seems too complex. > > Before anyone can sugges

Re: Trying pmw with python3: Lots of crashes!

2015-09-06 Thread Paulo da Silva
Às 20:27 de 06-09-2015, Laura Creighton escreveu: > In a message of Sun, 06 Sep 2015 19:47:25 +0100, Paulo da Silva writes: >> Hi! >> ... > > Did you get it from PyPI? > https://pypi.python.org/pypi/Pmw/2.0.0 ? I got it from sourceforge but I checked now and it has th

Re: Trying pmw with python3: Lots of crashes!

2015-09-07 Thread Paulo da Silva
Às 06:24 de 07-09-2015, Christian Gollwitzer escreveu: > Am 07.09.15 um 03:40 schrieb Paulo da Silva: ... >> > For a multicolumn editable list I suggest using tablelist. There are > Python bindings around. Scrolling in Tk is generally done by grouping > together scrollbars and

kivy editable multicolumn list

2015-09-14 Thread Paulo da Silva
Hi all. Not sure if this is the place to ask about kivy ... I apologize if not. I am playing with the example here https://gist.github.com/geojeff/4442405 Now I would like to change the background color the editable field. So I added def __init__(self,**kwargs): super(Edi

Re: kivy editable multicolumn list

2015-09-16 Thread Paulo da Silva
Às 08:44 de 15-09-2015, David Aldrich escreveu: >> Not sure if this is the place to ask about kivy ... > > Try the kivy users list here: > > https://groups.google.com/forum/#!forum/kivy-users Thanks for the link. -- https://mail.python.org/mailman/listinfo/python-list

Re: kivy editable multicolumn list

2015-09-16 Thread Paulo da Silva
Às 11:42 de 15-09-2015, Laura Creighton escreveu: > In a message of Tue, 15 Sep 2015 03:31:49 +0100, Paulo da Silva writes: ... >> Now I would like to change the background color the editable field. >> ... > > I just hardcoded it like this: > > integers_dic

Generating a vector from successive multiplications of another vector from an initial value

2015-10-01 Thread Paulo da Silva
Hi all. What is the fastest way to do the following: I have an initial value V and a vector vec of (financial) indexes. I want to generate a new vector nvec as V, V*vec[0], V*vec[0]*vec[1], V*vec[0]*vec[1]*vec[2], ... A numpy vectorized solution would be better. Thanks -- https://mail.python.

Re: Generating a vector from successive multiplications of another vector from an initial value

2015-10-01 Thread Paulo da Silva
Às 23:36 de 01-10-2015, Oscar Benjamin escreveu: > > On Thu, 1 Oct 2015 21:51 Paulo da Silva <mailto:p_s_d_a_s_i_l_v_a...@netcabo.pt>> wrote: ... > > V * np.cumprod(vec) > Thank you very much Oscar and Duncan. I googled a lot for such a function. Unfortunately the

Generating sin/square waves sound

2011-12-29 Thread Paulo da Silva
Hi, Sorry if this is a FAQ, but I have googled and didn't find any satisfatory answer. Is there a simple way, preferably multiplataform (or linux), of generating sinusoidal/square waves sound in python? Thanks for any answers/suggestions. -- http://mail.python.org/mailman/listinfo/python-list

Re: Generating sin/square waves sound

2012-01-01 Thread Paulo da Silva
Em 30-12-2011 10:05, Dave Angel escreveu: > On 12/30/2011 02:17 AM, Paulo da Silva wrote: >> Hi, >> Sorry if this is a FAQ, but I have googled and didn't find any >> satisfatory answer. >> >> Is there a simple way, preferably multiplataform (or linux), of

Re: Generating sin/square waves sound

2012-01-01 Thread Paulo da Silva
Em 30-12-2011 11:23, mblume escreveu: > Am Fri, 30 Dec 2011 07:17:13 + schrieb Paulo da Silva: ... > Alternatively you might just generate (t,signal) samples, write them to > a file and convert them using "sox" (under Linux, might also be available > under Windows) to

Re: Generating sin/square waves sound

2012-01-01 Thread Paulo da Silva
Em 31-12-2011 01:19, K Richard Pixley escreveu: > On 12/29/11 23:17 , Paulo da Silva wrote: >> Hi, >> Sorry if this is a FAQ, but I have googled and didn't find any >> satisfatory answer. >> >> Is there a simple way, preferably multiplataform (or linux), of

Re: Generating sin/square waves sound

2012-01-02 Thread Paulo da Silva
Em 30-12-2011 07:17, Paulo da Silva escreveu: > Hi, > Sorry if this is a FAQ, but I have googled and didn't find any > satisfatory answer. > > Is there a simple way, preferably multiplataform (or linux), of > generating sinusoidal/square waves sound in python? >

Where to "import"?

2007-03-08 Thread Paulo da Silva
Hi! If I have two files .py such as m.py from c import * ... x=c() ... os.any_method ... ... c.py class c: def __init__(self, ...): ... os.any_method ...

Re: Where to "import"?

2007-03-08 Thread Paulo da Silva
Paulo da Silva escreveu: This is to thank all the answers I got so far. Now I understand perfectly how "import" works. Regards. Paulo -- http://mail.python.org/mailman/listinfo/python-list

Re: Where to "import"?

2007-03-08 Thread Paulo da Silva
Paulo da Silva escreveu: This is to thank all the answers I got so far. Now I understand perfectly how "import" works. Regards. Paulo -- http://mail.python.org/mailman/listinfo/python-list

Re: Where to "import"?

2007-03-08 Thread Paulo da Silva
Bruno Desthuilliers escreveu: > Paulo da Silva a écrit : ... >> >> c.py >> class c: > class C(object): > > 1/ better to stick to naming conventions (class names in CamelCase) Ok. Thanks. > 2/ do yourself a favor: use new-style classes I still have

bisect on a list of lists

2007-03-09 Thread Paulo da Silva
Hi! What is the best way to have something like the bisect_left method on a list of lists being the comparision based on an specified arbitrary i_th element of each list element? Is there, for lists, something equivalent to the __cmp__ function for classes? Thanks. -- http://mail.python.org/mai

Re: bisect on a list of lists

2007-03-09 Thread Paulo da Silva
Gabriel Genellina escreveu: > En Fri, 09 Mar 2007 17:15:44 -0300, Paulo da Silva > <[EMAIL PROTECTED]> escribió: ... > > lists *are* classes (at least since Python 2.2) > Inherit from the builtin list, redefine __cmp__(self, other) as ... Thanks Gabriel. This sounds very n

Re: bisect on a list of lists

2007-03-09 Thread Paulo da Silva
Gabriel Genellina escreveu: ... > Just omit the __init__ method, if you don't have anything additional to > do. The inherited method will be used instead, as always: Then, if I have something additional, I can do def __init__(self,l=None): if l!=None:

Re: number generator

2007-03-10 Thread Paulo da Silva
cesco escreveu: > I have to generate a list of N random numbers (integer) whose sum is > equal to M. If, for example, I have to generate 5 random numbers whose > sum is 50 a possible solution could be [3, 11, 7, 22, 7]. Is there a > simple pattern or function in Python to accomplish that? > > Than

Re: number generator

2007-03-10 Thread Paulo da Silva
Paul Rubin escreveu: > Paulo da Silva <[EMAIL PROTECTED]> writes: >> May be this is what you want ... >> I didn't test it enough ... but seems fine. > > That's way too complicated. Think about Gerald Flanagan's description > of the telegraph poles, an

Re: New to Python

2007-03-12 Thread Paulo da Silva
Alberto Vieira Ferreira Monteiro escreveu: > Hi, I am new to Python, how stupid can be the questions I ask? > > For example, how can I add (mathematically) two tuples? > x = (1,2) > y = (3,4) > How can I get z = (1 + 3, 2 + 4) ? > > Alberto Monteiro I think that what you want is numpy. I don't k

Request for a change in the csv module.

2007-03-12 Thread Paulo da Silva
Hi. I have just seen that csv module, more exactly the Dialect class, does not have any variable to specify the "floating point" character! In portuguese this is ','. Not '.'. 3.1415 -> 3,1415. I think this is also the case of other languages/countries. If I am correct, i.e. if there is no such po

Re: Request for a change in the csv module.

2007-03-12 Thread Paulo da Silva
[EMAIL PROTECTED] escreveu: > On Mar 12, 4:26 pm, Paulo da Silva <[EMAIL PROTECTED]> wrote: ... > > locale.setlocale(locale.LC_NUMERIC, 'pt_BR.ISO8859-1') > csv_writer = csv.writer(open("foo.csv","w"), dialect='excel') > rows = ((&#x

Re: Request for a change in the csv module.

2007-03-13 Thread Paulo da Silva
Diez B. Roggisch escreveu: > Paulo da Silva schrieb: ... >> That works but it is a pain to use. > > Why? I think it's straightforward. That is not the point. The problem is to have things generalized. I have some general purpose tables whose fields format I don't know i

Re: Request for a change in the csv module.

2007-03-13 Thread Paulo da Silva
Diez B. Roggisch escreveu: > Paulo da Silva wrote: ... > > That it does convert non-string-values to strings when writing could be seen > as convenience, or actual bug as it might cause troubles as you perceived > them - but the solution would clearly be to get rid of this funct

Re: Request for a change in the csv module.

2007-03-13 Thread Paulo da Silva
[EMAIL PROTECTED] escreveu: > Paulo> That is not the point. The problem is to have things generalized. > > Well, perhaps. One of the goals of the csv module was to do things the way > Excel does things. It would be nice because many csv users use it to export files to spreadsheets and Excel

Tools for GUI/graphics

2007-03-13 Thread Paulo da Silva
I need to make some data representation. Basically a major window for a 2D chart, a scrollable window with some few small 2D graphics. The rest is a normal form with buttons, labels and entries. I thought of doing that using Tkinter+pmw+blt. But now I'm considering use a web solution. Is there any

Returning other instance from __init__

2007-03-14 Thread Paulo da Silva
I would like to implement something like this: class C1: def __init__(self,xxx): if ... : self.foo = foo self.bar = bar else: self=C1.load(xxx) def load(xxx): ..

Re: Returning other instance from __init__

2007-03-15 Thread Paulo da Silva
Alex Martelli escreveu: > Paulo da Silva <[EMAIL PROTECTED]> wrote: ... > > E.g.: > > class C1(object): > def __new__(cls, xxx): > if xxx: return type.__new__(cls, xxx) > else: return C1.load(xxx) > @staticmethod > def load(xx

Subclassing: what is wrong here?

2007-03-15 Thread Paulo da Silva
Hi! What's wrong with this way of subclassing? from datetime import date class MyDate(date): def __init__(self,year,month=None,day=None): if type(year) is str: # The whole date is here as a string year,month,day=map(int,stri

Re: Subclassing: what is wrong here?

2007-03-15 Thread Paulo da Silva
Miki escreveu: > Hello Paulo, > >> What's wrong with this way of subclassing? >> ... > See > http://sourceforge.net/tracker/index.php?func=detail&aid=1448640&group_id=5470&atid=105470 > > HTH, > -- > Miki <[EMAIL PROTECTED]> > http://pythonwise.blogspot.com > Thanks! It works this way: class

Re: Returning other instance from __init__

2007-03-16 Thread Paulo da Silva
Paulo da Silva escreveu: > Alex Martelli escreveu: >> Paulo da Silva <[EMAIL PROTECTED]> wrote: > > >> E.g.: >> >> class C1(object): >> def __new__(cls, xxx): >> if xxx: return type.__new__(cls, xxx) >> else: retu

Re: Returning other instance from __init__ - I need help

2007-03-16 Thread Paulo da Silva
Paulo da Silva escreveu: > Paulo da Silva escreveu: >> Alex Martelli escreveu: >>> Paulo da Silva <[EMAIL PROTECTED]> wrote: >> >> >>> E.g.: >>> >>> class C1(object): >>> def __new__(cls, xxx): >>>

Re: Returning other instance from __init__ - I need help

2007-03-17 Thread Paulo da Silva
Gabriel Genellina escreveu: > En Fri, 16 Mar 2007 22:05:05 -0300, Paulo da Silva > <[EMAIL PROTECTED]> escribió: ... > class C(object): > > def __new__(cls, filename=None, foo=None, bar=None): > if filename is not None: > return cls.load(filenam

Still the __new__ hell ...

2007-03-17 Thread Paulo da Silva
Sorry to put here too many questions about __init__ __new__ stuff but I always found a new problem when using them. I have searched for simple __new__ docs on how to do the basic things but find none. After trying the solutions people gently posted here (thanks) I run into new trouble when I go wi

Re: Still the __new__ hell ...

2007-03-17 Thread Paulo da Silva
Arnaud Delobelle escreveu: > On Mar 17, 9:31 pm, Paulo da Silva <[EMAIL PROTECTED]> wrote: ... >> I used __new__ to >> subclass date class but now cPickle/pickle loads >> does not work. >> >> from datetime import date >> import cPickle,string >>

Re: Still the __new__ hell ...

2007-03-18 Thread Paulo da Silva
Arnaud Delobelle escreveu: > On Mar 17, 11:48 pm, Paulo da Silva <[EMAIL PROTECTED]> wrote: >> Arnaud Delobelle escreveu:> On Mar 17, 9:31 pm, Paulo da Silva <[EMAIL >> PROTECTED]> wrote: > > [snip] > >> Thanks. This works exactly the way you wrote.

Re: Still the __new__ hell ...

2007-03-19 Thread Paulo da Silva
Bruno Desthuilliers escreveu: > Paulo da Silva a écrit : ... >> class MyDate(date): >> def __new__(cls,year,month=None,day=None): >> if type(year) is str: > > And what if it's a unicode string ? > The correct idiom here is: >

Re: an enumerate question

2007-03-20 Thread Paulo da Silva
[EMAIL PROTECTED] escreveu: > hi > say i want to enumerate lines of a file > eg > for n,l in enumerate(open("file")): > # print next line ie > > is there a way to print out the next line from current line using the > above?. > Or do i have to do a readlines() first to get it into a list eg >

Re: Still the __new__ hell ...

2007-03-23 Thread Paulo da Silva
Gabriel Genellina escreveu: > En Wed, 21 Mar 2007 07:51:32 -0300, Bruno Desthuilliers > <[EMAIL PROTECTED]> escribió: > >> Paulo da Silva a écrit : >>> As a relatively inexperient >>> in python, how could I know that a 'string' is an instance o

Join strings - very simple Q.

2007-03-23 Thread Paulo da Silva
Hi! I was told in this NG that string is obsolet. I should use str methods. So, how do I join a list of strings delimited by a given char, let's say ','? Old way: l=['a','b','c'] jl=string.join(l,',') New way? Thanks Paulo -- http://mail.python.org/mailman/listinfo/python-list

Re: Join strings - very simple Q.

2007-03-23 Thread Paulo da Silva
Mike Kent escreveu: ... > New way: > l=['a','b','c'] > jl=','.join(l) > I thank you all. Almost there ... I tried "".join(l,',') but no success ... :-( Paulo -- http://mail.python.org/mailman/listinfo/python-list

Re: Join strings - very simple Q.

2007-03-24 Thread Paulo da Silva
John Machin escreveu: .. > Python 2.2.3 (#42, May 30 2003, 18:12:08) [MSC 32 bit (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information. > | >>> help("".join) > Help on built-in function join: > > join(...) > S.join(sequence) -> string > > Return a st

Re: Join strings - very simple Q.

2007-03-24 Thread Paulo da Silva
Dustan escreveu: > On Mar 23, 1:30 pm, Paulo da Silva <[EMAIL PROTECTED]> wrote: >> Mike Kent escreveu: >> ... >> >>> New way: >>> l=['a','b','c'] >>> jl=','.join(l) >> I thank you all. >> >

Re: Join strings - very simple Q.

2007-03-24 Thread Paulo da Silva
Steven D'Aprano escreveu: > On Fri, 23 Mar 2007 13:15:29 -0700, John Machin wrote: > > > Western civilization is 6,000 years old. After reading that post I wouldn't talk about civilization, western or any other :-) Regards. Paulo -- http://mail.python.org/mailman/listinfo/python-list

Re: Join strings - very simple Q.

2007-03-25 Thread Paulo da Silva
Dustan escreveu: > On Mar 24, 7:16 am, Paulo da Silva <[EMAIL PROTECTED]> wrote: >> Dustan escreveu: >> >> >> >>> On Mar 23, 1:30 pm, Paulo da Silva <[EMAIL PROTECTED]> wrote: >>>> Mike Kent escreveu: >>>> ... >&g

Re: Join strings - very simple Q.

2007-03-25 Thread Paulo da Silva
John Machin escreveu: > On Mar 25, 12:32 am, Paulo da Silva <[EMAIL PROTECTED]> wrote: >> John Machin escreveu: .. > What was not obvious was (1) if you have been using Python for a > while, how you managed to be unaware of str methods (2) if you are a > newbie, how you m

Re: Join strings - very simple Q. ERRATA

2007-03-25 Thread Paulo da Silva
Paulo da Silva escreveu: > John Machin escreveu: >> On Mar 25, 12:32 am, Paulo da Silva <[EMAIL PROTECTED]> wrote: >>> John Machin escreveu: > ... ... > knowledge. If you feel that it is a question that deserves the > honour of your response, just do it. Write

Re: Sorting a multidimensional array by multiple keys

2007-04-01 Thread Paulo da Silva
Rehceb Rotkiv escreveu: > Hello everyone, > > can I sort a multidimensional array in Python by multiple sort keys? A > litte code sample would be nice! class MyList(list): # This is the index of the element to be compared CmpIndex=0 # Comparision methods @staticm

getattr/setattr q.

2007-04-02 Thread Paulo da Silva
Hi! In a class C, I may do setattr(C,'x',10). Is it possible to use getattr/setattr for variables not inside classes or something equivalent? I mean with the same result as exec("x=10"). Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: getattr/setattr q.

2007-04-03 Thread Paulo da Silva
7stud escreveu: > On Apr 2, 10:08 pm, Paulo da Silva <[EMAIL PROTECTED]> wrote: >> Is it possible to use getattr/setattr for variables not inside >> classes...? > > What does the python documentation say about the definition of > setattr()? > I didn't read

Re: getattr/setattr q.

2007-04-03 Thread Paulo da Silva
Steven Bethard escreveu: > Paulo da Silva wrote: ... > If you're at the module level, you can do:: > > globals()['x'] = 10 > > If you're inside a function, you probably want to look for another way > of doing what you're doing. > > Wha

Re: getattr/setattr q.

2007-04-03 Thread Paulo da Silva
> Yes, but you shouldn't unless you really need to. You're better off > rethinking your algorithm. I need it but inside a class. The idea is to pass an instance of a class (think of something like a record but with some methods inside) with "fields", whose names are not known in advance, to ano

Re: NLTK, Random Sentence Generators?

2007-04-10 Thread Paulo da Silva
gene tani escreveu: > On Apr 10, 1:36 am, Passer By <[EMAIL PROTECTED]> wrote: >> Has any created or not of examples of random sentence generators using >> n-gram models (or other models might be interesting). >> >> I know of one example from a course at MIT, but besides that nothing. >> >> Any hel

"Cloning" file attributes and permissions

2007-04-12 Thread Paulo da Silva
Hi! I need to process a file to produce another file that *must* have *exactly* the same attributes and permissions of the former. What is the best way to do this? The file must not exist with contents (it may exist empty) unless it has the same attributes and permissions. I know how to do this us

Re: "Cloning" file attributes and permissions

2007-04-12 Thread Paulo da Silva
[EMAIL PROTECTED] escreveu: > On Apr 12, 9:20 am, Paulo da Silva <[EMAIL PROTECTED]> wrote: >> Hi! >> >> I need to process a file to produce another file that *must* have >> *exactly* the same attributes and permissions of the former. What is the >> best

Re: "Cloning" file attributes and permissions

2007-04-12 Thread Paulo da Silva
[EMAIL PROTECTED] escreveu: > On Apr 12, 5:19 pm, [EMAIL PROTECTED] wrote: >> On Apr 12, 4:09 pm, Paulo da Silva <[EMAIL PROTECTED]> wrote: >> ... > > After poking around a bit I also discovered the > shutil module. It looks like you can use > shutil.copy2. Mor

Re: Python editor/IDE on Linux?

2007-04-14 Thread Paulo da Silva
Jack escreveu: > I wonder what everybody uses for Python editor/IDE on Linux? > I use PyScripter on Windows, which is very good. Not sure if > there's something handy like that on Linux. I need to do some > development work on Linux and the distro I am using is Xubuntu. > > eric3 is nice and sim

Re: [lxml-dev] Python script to optimize XML text

2007-09-24 Thread Sidnei da Silva
If your XML is well-formed, a XSLT is probably your best choice. I believe even the most trivial 'pass through' example might produce the output you expect here. -- Sidnei da Silva Enfold Systemshttp://enfoldsystems.com Fax +1 832 201 8856 Office +1 713 942 23

Re: os system command not found

2009-01-14 Thread Daniel da Silva
On Jan 14, 5:25 am, codicedave wrote: > Hi all! > I installed a external program called infomap using the classical > procedure > > ./configure > make > sudo make install > >  and it works perfectly in Terminal (Os x) using both bash and tcsh > shell > > admins-macbook-pro-2:~ unil$ infomap-build

Re: Plotting libraries recommendations

2008-10-14 Thread Daniel da Silva
Seconded. If you are familiar with Matlab plotting at all, the interface is nearly identical, and the graphics are great. Daniel On Tue, Oct 14, 2008 at 9:19 AM, eliben <[EMAIL PROTECTED]> wrote: > On Oct 14, 1:18 pm, sert <[EMAIL PROTECTED]> wrote: > > I'm developing a circuit simulation applic

Re: default value in __init__

2008-10-14 Thread Daniel da Silva
is Lee Bieber KD6MOG >[EMAIL PROTECTED] [EMAIL PROTECTED] > HTTP://wlfraed.home.netcom.com/ >(Bestiaria Support Staff: [EMAIL PROTECTED]) >HTTP://www.bestiaria.com/ > -- > http://mail.python.org/mailman/listinfo/python-list > -- Daniel da Silva (240) 678 - 4686 GSFC, GES-DISC 610.2 University of Maryland -- http://mail.python.org/mailman/listinfo/python-list

Re: big objects and avoiding deepcopy?

2008-10-28 Thread Daniel da Silva
etimes missing for performance reasons). > > Bye, > bearophile > -- > http://mail.python.org/mailman/listinfo/python-list > -- Daniel da Silva (240) 678 - 4686 GSFC, GES-DISC 610.2 University of Maryland -- http://mail.python.org/mailman/listinfo/python-list

Re: this is simple...

2008-06-27 Thread Daniel da Silva
ToshiBoy, You might want to take a look at the filter() function, it can also be used for the kind of the thing you're doing. http://docs.python.org/tut/node7.html#SECTION00713 >>> B = range(1,27) >>> def test(b): ... if b*b in B: ... return True ... else: ...

Re: You, spare time and SyntaxError

2008-07-10 Thread Daniel da Silva
I applaud your creativity. Very nice. On Wed, Jul 9, 2008 at 10:56 AM, <[EMAIL PROTECTED]> wrote: > def ine(you): >yourself = "what?" >go = list("something"), list("anything") >be = "something" >please = be, yourself >yourself = "great" >for good in yourself: >if y

Re: static variables in Python?

2008-07-29 Thread Daniel da Silva
This is the solution I suggest. It is fairly trivial, and works by introducing the "self.static" namespace for a class's static variables, in contrast to "self" for the class's instance variables. --- class Static(object): pass personStatic = Static() class Pers

Re: iterating "by twos"

2008-07-29 Thread Daniel da Silva
The following method is similar to the others provided, but yields an index value as well (similar to the enumerate(iterable) function). This is useful in some (but not all) situations. If the iterable object's iterator returns an even number of items then you're fine; otherwise it will throw away

Re: Overloaded Functions

2008-07-29 Thread Daniel da Silva
With a little hacking, you might be able to do something like this: @overload("f", (int, int, str)) def f1(x, y, z): pass @overload("f", (str, str)) def f2(x, y): pass The way I would typically do method overloading would be as follows (this has been tested): class Person: def __in

Re: How can I check nbr of cores of computer?

2008-07-30 Thread Daniel da Silva
Single line using /proc/cpuinfo: numprocs = [ int(line.strip()[-1]) for line in open('/proc/cpuinfo', 'r') if \ line.startswith('processor') ][-1] + 1 On Wed, Jul 30, 2008 at 2:16 PM, Dan Upton <[EMAIL PROTECTED]> wrote: > > On Wed, Jul 30, 2008 at 2:22 PM, John Nagle <[EMAIL PROTE

Re: Aaaargh! "global name 'eggz' is not defined"

2009-10-29 Thread Daniel da Silva
There are several static analysis tools that can check whether a variable name is used before it is defined. At my old workplace we used "pylint", so I can recommend that: http://www.logilab.org/857 --Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling FORTAN dll functions from Python

2010-12-08 Thread Daniel da Silva
I don't know much about fortran+python, but I work with someone who does, and he absolutely loves this tool: http://cens.ioc.ee/projects/f2py2e/ Daniel On Tue, Dec 7, 2010 at 10:19 PM, Dennis Lee Bieber wrote: > On Tue, 07 Dec 2010 12:52:54 +0100, Stefan Behn

dns library

2010-12-09 Thread Paulo da Silva
Hi. Is there a python library/module to handle both the server and client sides of dns protocol? I have googled for it but I only found client side ones (at least from the superficial readings I did). Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: dns library

2010-12-09 Thread Paulo da Silva
Em 10-12-2010 02:59, Jean-Paul Calderone escreveu: > On Dec 9, 8:15 pm, Paulo da Silva > wrote: >> Hi. >> >> Is there a python library/module to handle both the server and client >> sides of dns protocol? >> >> I have googled for it but I only fo

Funny __future__ imports

2010-12-21 Thread Daniel da Silva
from __future__ import space_shuttle DeprecationWarning: will be removed in next release Post yours! -- http://mail.python.org/mailman/listinfo/python-list

Re: list displays

2011-01-08 Thread Daniel da Silva
They're called "List Comprehensions" http://docs.python.org/tutorial/datastructures.html#list-comprehensions On Sat, Jan 8, 2011 at 4:57 PM, Olive wrote: > I am a newbie to python. Python supports what I thinks it is call

Parsing string for " "

2011-01-11 Thread Daniel da Silva
Hi, I have come across a task where I would like to scan a short 20-80 character line of text for instances of " ". Ideally could be of any tense. I know quite a bit of programming and computer science, but computational linguistics is relatively new to me. If anyone can point me in the right di

Parsing string for " "

2011-01-11 Thread Daniel da Silva
Hi, I have come across a task where I would like to scan a short 20-80 character line of text for instances of " ". Ideally could be of any tense. I know quite a bit of programming and computer science, but computational linguistics is relatively new to me. If anyone can point me in the right di

Re: Parsing string for " "

2011-01-12 Thread Daniel da Silva
MRAB, I will check it out. Thanks! Daniel On Tue, Jan 11, 2011 at 10:23 PM, MRAB wrote: > On 12/01/2011 01:50, Daniel da Silva wrote: > >> Hi, >> >> I have come across a task where I would like to scan a short 20-80 >> character line of text for instances of &quo

Best way to administer code updates to server daemon

2011-01-21 Thread Daniel da Silva
Hi, I am writing a custom IRC server, and I was wondering would be the best way to administer code updates to the daemon. Am I doomed to have to restart the server every time I want to do an update (which would disconnect all clients)? I don't mind doing something a little more advanced if it mean

Converting a pickle to python3

2010-06-01 Thread Paulo da Silva
Hi! I have a big data structure cpickled into a datafile, by python2. I tried to unpickle it using python3 but got the followin message: File "/usr/lib64/python3.1/pickle.py", line 1372, in loads encoding=encoding, errors=errors).load() _pickle.UnpicklingError: invalid load key, 'x'. Is there

Re: Converting a pickle to python3

2010-06-02 Thread Paulo da Silva
Em 02-06-2010 04:48, Paulo da Silva escreveu: > Hi! > > I have a big data structure cpickled into a datafile, by python2. > I tried to unpickle it using python3 but got the followin message: > File "/usr/lib64/python3.1/pickle.py", line 1372, in loads > encoding=e

Handling text lines from files with some (few) starnge chars

2010-06-05 Thread Paulo da Silva
I need to read text files and process each line using string comparisions and regexp. I have a python2 program that uses .readline to read each line as a string. Then, processing it was a trivial job. With python3 I got error messagew like: File "./pp1.py", line 93, in RL line=inf.readline()

Re: Handling text lines from files with some (few) starnge chars

2010-06-05 Thread Paulo da Silva
Em 06-06-2010 00:41, Chris Rebert escreveu: > On Sat, Jun 5, 2010 at 4:03 PM, Paulo da Silva > wrote: ... > > Specify the encoding of the text when opening the file using the > `encoding` parameter. For Windows-1252 for example: > > your_file = open("path/to/file.e

Re: Handling text lines from files with some (few) starnge chars

2010-06-05 Thread Paulo da Silva
Em 06-06-2010 04:05, John Machin escreveu: > On Jun 6, 12:14 pm, MRAB wrote: >> Paulo da Silva wrote: ... >>> OK! This fixes my current problem. I used encoding="iso-8859-15". This >>> is how my text files are encoded. >>> But what about a more ge

Re: Global variables problem

2010-08-03 Thread Daniel da Silva
Please post approximate code that actually works and displays the problem. On Tue, Aug 3, 2010 at 9:00 PM, Navkirat Singh wrote: > Hey guys, > > I am using a multiprocessing program, where the new process is supposed to > change a variable in the main class that it branches out from. This is > s

Re: simple (I hope!) problem

2010-08-03 Thread Daniel da Silva
Why not just add the google app engine lib subdirectories to your python path? On Tue, Aug 3, 2010 at 3:09 AM, Jean-Michel Pichavant < jeanmic...@sequans.com> wrote: > samwyse wrote: > >> I'm writing for the Google app engine and have stubbed my toe yet >> again on a simple obstacle. Non-trivia

Re: Global variables problem

2010-08-03 Thread Daniel da Silva
I can't really comment on what you're doing wrong, but I hope this points you in the right direction. Sorry I couldn't be of more help, Daniel On Tue, Aug 3, 2010 at 9:48 PM, Navkirat Singh wrote: > > On 04-Aug-2010, at 9:46 AM, Daniel da Silva wrote: > > Please po

Re: newbie problem with str.replace

2010-08-04 Thread Daniel da Silva
Also, for bestandsnaam in dirs and files: is probably not doing what you want. Use + to concatenate lists. Daniel On Wed, Aug 4, 2010 at 6:30 AM, Mike Kent wrote: > On Aug 4, 9:10 am, BobAalsma wrote: > > I'm working on a set of scripts and I can't get a replace to work in >

<    1   2   3   4   >