Re: [OT] master/slave debate in Python

2018-09-26 Thread David Palao
Hello, My opinion is that the terms "master/slave" describe well some situations. They could be seen by some people as offensive (although unfortunately sometimes true, even today) when applied to persons. But it is not offensive when applied to processes in a computer. They are not living

Re: python to C code generator

2018-01-17 Thread David Palao
Hi, Have a look at Cython. Best 2018-01-17 12:04 GMT+01:00 kushal bhattacharya : > Hi, > Is there any python framework or any tool as which can generate C code from > python code as it is . > > Thanks, > Kushal > -- >

Re: WANT: bad code in python (for refactoring example)

2017-02-15 Thread David Palao
2017-02-15 10:36 GMT+01:00 Makoto Kuwata : > Thanks Irmen and Steven, > > I'm sorry that my explanation is not enough. > I'm looking for bad python code, not refactoring examples. > I can do (and want to do) refactor bad code by myself. > > Is there any bad python code (or

Re: How to store properties

2017-02-08 Thread David Palao
2017-02-08 13:34 GMT+01:00 Cholo Lennon : > On 02/08/2017 08:26 AM, Cecil Westerhof wrote: >> >> In Java you (can) use a properties file store configuration. What is >> the best way to do something like that in Python? >> I saw ConfigParser, but have the feeling that it is

Re: constructor classmethods

2016-11-07 Thread David Palao
>> >> If the class in question has legitimate, non-testing, reasons to specify >> different Queues, then make it a default argument instead: >> >> def __init__(self, ..., queue=None): >> if queue is None: >> queue = Queue() >> self.queue = queue > > I already stated that this

Re: How to implement semaphores in python?

2016-06-07 Thread David Palao
Hi, Have you checked this https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Semaphore ? Best 2016-06-07 11:43 GMT+02:00 karthik jagilinki : > Hello All, > > I need some help with semaphore implementation between two programs in > python. I'd be glad if

Re: String concatenation

2016-05-10 Thread David Palao
2016-05-10 9:54 GMT+02:00 Steven D'Aprano : > On Tuesday 10 May 2016 17:13, Paul Rubin wrote: > >> Steven D'Aprano writes: >>> Australia's naming laws almost certainly wouldn't allow such a name. >> >>

Re: Guido sees the light: PEP 8 updated

2016-04-18 Thread David Palao
2016-04-18 5:19 GMT+02:00 Steven D'Aprano : > On Mon, 18 Apr 2016 11:39 am, Rustom Mody wrote: > >> yes we can agree on this -- arbitrary line lengths are almost certainly >> unreadable. >> The problem then becomes so what is optimal? > > I really don't think it is a problem.

Re: How to parameterize unittests

2016-04-14 Thread David Palao
2016-04-14 16:08 GMT+02:00 Antoon Pardon : > > I have a unittest for my avltree module. > > Now I want this unittest to also run on a subclass of avltree. > How can I organise this, so that I can largely reuse the > original TestCase? > > -- > Antoon Pardon > -- >

Re: newbie question

2016-03-24 Thread David Palao
Hi, Use "eval": s = "(1, 2, 3, 4)" t = eval(s) Best 2016-03-24 11:39 GMT+01:00 ast : > Hi > > I have a string which contains a tupe, eg: > > s = "(1, 2, 3, 4)" > > and I want to recover the tuple in a variable t > > t = (1, 2, 3, 4) > > how would you do ? > > > -- >

Re: show instant data on webpage

2016-01-27 Thread David Palao
2016-01-26 18:26 GMT+01:00 mustang : > >> open("myData.dat", "w").close() >> >> while True: >> temp = sensor.readTempC() >> riga = "%f\n" % temp >> with open("myData.dat", "a") as f: >> f.write(riga) >> time.sleep(1) > > yes great it works!thanks a

Re: Python Unit test

2016-01-26 Thread David Palao
Well, there is a very specific example in there. But you still don't give us much information about *concrete* troubles you have. I *guess* that one of the following is true: 1) You have problems to understand some part of the example in the unittest module documentation. 2) You don't know how to

Re: python-2.7.3 vs python-3.2.3

2016-01-26 Thread David Palao
Hello, On my system I have 2.7.10 and 3.4.3 system wide, but it is not debian. Of course, the "python" executable can be only one of them at a given time. Another option is tu use a virtual environment or something (pyvenv or virtualenv). Best 2016-01-26 13:26 GMT+01:00 Gene Heskett

Re: Python Unit test

2016-01-26 Thread David Palao
om my iPhone >> >> > On 26 Jan 2016, at 15:48, David Palao <dpalao.pyt...@gmail.com> wrote: >> > >> > Well, there is a very specific example in there. >> > But you still don't give us much information about *concrete* troubles >> you have.

Re: show instant data on webpage

2016-01-26 Thread David Palao
2016-01-26 17:10 GMT+01:00 mustang : > I've built a sensor to measure some values. > I would like to show it on a web page with python. > > > This is an extract of the code: > > file = open("myData.dat", "w") > > while True: > temp = sensor.readTempC() > riga =

Re: Python Unit test

2016-01-26 Thread David Palao
Hello, It would be good to provide more details on what you need help for. For instance, have you read the manual https://docs.python.org/3/library/unittest.html ? It even contains a couple of examples. Best 2016-01-26 12:09 GMT+01:00 : > I'm a University student of IT

Re: New to python

2015-07-20 Thread David Palao
2015-07-20 7:20 GMT+02:00 Arthi Vigneshwari arthi15sm...@gmail.com: Hi, Am interested to learn python!Can you please guide me how to start with python which will help in my selenium automation? Regards, Arthi -- https://mail.python.org/mailman/listinfo/python-list Hi, If you enter

Re: PYTHON QUESTION

2015-06-11 Thread David Palao
2015-06-11 12:44 GMT+02:00 adebayo.abra...@gmail.com: Help with this problem! Temperature converter Description Write two functions that will convert temperatures back and forth from the Celsius and Fahrenheit temperature scales. The formulas for making the conversion are as follows:

Re: I just need this question explained.

2015-06-11 Thread David Palao
2015-06-11 14:03 GMT+02:00 Adebayo Abraham adebayo.abra...@gmail.com: I am not requesting for a solution. I just need the question explained. I am a beginner python developer and i do not know where to start from to solve this problem. So anybody, somebody: please explain this question. Am i

Re: What sort of data structure to use?

2015-06-03 Thread David Palao
2015-06-03 10:19 GMT+02:00 David Aldrich david.aldr...@emea.nec.com: Hi I have written a Python utility that performs a certain activity on some predefined sets of files. Here is the outline of what I have written: # File Set A pathA = ‘pathA’ fileListA = [‘fileA1.txt’,

Re: What sort of data structure to use?

2015-06-03 Thread David Palao
2015-06-03 10:19 GMT+02:00 David Aldrich david.aldr...@emea.nec.com: Hi I have written a Python utility that performs a certain activity on some predefined sets of files. Here is the outline of what I have written: # File Set A pathA = ‘pathA’ fileListA = [‘fileA1.txt’,

Re: Where is 'palindrome' defined?

2015-06-01 Thread David Palao
Hi, Because palindrome != parlindrome? Have you read the error message? Did you try to understand it? Best 2015-06-01 6:46 GMT+02:00 fl rxjw...@gmail.com: Hi, When I search solution of reverse a string/number, I came across a short function online: def palindrome(num): return

Re: Where is 'palindrome' defined?

2015-06-01 Thread David Palao
2015-06-01 11:21 GMT+02:00 Marko Rauhamaa ma...@pacujo.net: David Palao dpalao.pyt...@gmail.com: Because palindrome != parlindrome? Have you read the error message? Did you try to understand it? When you are starting with any new thing, even the simplest problems look baffling. Once you

Re: SyntaxError on progress module

2015-05-27 Thread David Palao
2015-05-27 9:30 GMT+02:00 alb al.bas...@gmail.com: Hi Mark, Mark Lawrence breamore...@yahoo.co.uk wrote: [] File /home/debian/repos/2418_IASI-NG/Documents/Tools/tex_tool/venv/local/lib/python3.2/site-packages/progress/bar.py, line 48 empty_fill = u'∙' ^

Re: Encrypt python files

2015-05-06 Thread David Palao
Hello, I'm afraid your question is either not well defined (or not well enough) or wrong for this list, at least as I understand it. Could you please explain it better? Best 2015-05-06 8:37 GMT+02:00 Palpandi palpandi...@gmail.com: Hi, What are the ways to encrypt python files? --

Re:

2015-04-22 Thread David Palao
Hello, I can definitely recommend this: http://norvig.com/21-days.html Of course, more precise advice would be possible if you provide more details of what is your background, what you know, and so on. Best 2015-04-20 17:15 GMT+02:00 Chandra Prashad mishra prasadchandr...@gmail.com: sir how can

Re: A syntax question

2014-11-10 Thread David Palao
My crystal ball is currently in for repair and is not expected back in the foreseeable future. Without a crystal ball, this prediction might be not well founded. -- https://mail.python.org/mailman/listinfo/python-list

Re: ruby instance variable in python

2014-10-06 Thread David Palao
Hello, If you explain what the ruby code does, I think much more people will be able to help you. Don't forget, this is a Python list. Not everybody knows Ruby here. Best 2014-10-06 12:06 GMT+02:00 roro codeath rorocode...@gmail.com: in ruby: module M def ins_var @ins_var ||= nil end def

Python vs C++

2014-08-21 Thread David Palao
Hello, I consider myself a python programmer, although C++ was one of the first languages I learned (not really deeply and long time ago). Now I decided to retake C++, to broaden my view of the business. However, as I progress in learning C++, I cannot take out of my head one question Why to

Re: Python vs C++

2014-08-21 Thread David Palao
Thank you for the interesting answers. Just a clarification. Actually for the scope of this question, I consider C and C++ quite different. At least when they are properly used (eg, you could use C++ as a better C, but this is not C++ in its full glory). In my opinion, if all that you want is

Re: Linux distros w/o Python in base installation

2014-08-12 Thread David Palao
2014-08-11 23:36 GMT+02:00 Ned Deily n...@acm.org: In article lsb84u$21c$1...@reader1.panix.com, Grant Edwards invalid@invalid.invalid wrote: Apparently. Perhaps theres an enable LSB compliance option somewhere in the Arch install docs, but I didn't see it... Also beware that, unlike most

Re: how to write list in a file

2014-04-23 Thread David Palao
2014-04-23 9:53 GMT+02:00 Dhananjay dhananjay.c.jo...@gmail.com: Hello everyone, I am trying hard to write a list to a file as follows: def average_ELECT(pwd): os.chdir(pwd) files = filter(os.path.isfile, os.listdir('./')) folders = filter(os.path.isdir, os.listdir('./'))

howto check programs and C libraries

2013-10-04 Thread David Palao
Hello, I'm in charge of preparing a computer room for the practices of introduction to programming. One of the tasks is checking that from all the computers in the room one can execute some programs and link (and compile) against some libraries. My first idea was using Autotools (or cmake), but as