TKinter in Python - advanced notions - ok

2023-06-24 Thread Dan Kolis via Python-list
Well, its kind of obvious to make a skeleton, copy it in for some basic functionality and modularly ( is that a word ? ) manage each piece. That ( like your example ) is fine stuff. As a side note, I am sure large, large highly generalised programs are pretty hard to make. One thing I do is

Re: ok, I feel stupid, but there must be a better way than this! (finding name of unique key in dict)

2023-01-21 Thread Dino
I learned new things today and I thank you all for your responses. Please consider yourself thanked individually. Dino On 1/20/2023 10:29 AM, Dino wrote: let's say I have this list of nested dicts: -- https://mail.python.org/mailman/listinfo/python-list

Re: ok, I feel stupid, but there must be a better way than this! (finding name of unique key in dict)

2023-01-20 Thread Rob Cliffe via Python-list
On 20/01/2023 15:29, Dino wrote: let's say I have this list of nested dicts: [   { "some_key": {'a':1, 'b':2}},   { "some_other_key": {'a':3, 'b':4}} ] I need to turn this into: [   { "value": "some_key", 'a':1, 'b':2},   { "value": "some_other_key", 'a':3, 'b':4} ] Assuming that I believe t

Re: ok, I feel stupid, but there must be a better way than this! (finding name of unique key in dict)

2023-01-20 Thread Oscar Benjamin
On Fri, 20 Jan 2023 at 17:30, Dino wrote: > > let's say I have this list of nested dicts: > > [ >{ "some_key": {'a':1, 'b':2}}, >{ "some_other_key": {'a':3, 'b':4}} > ] > > I need to turn this into: > > [ >{ "value": "some_key", 'a':1, 'b':2}, >{ "value": "some_other_key", 'a':3, '

Re: ok, I feel stupid, but there must be a better way than this! (finding name of unique key in dict)

2023-01-20 Thread Jon Ribbens via Python-list
On 2023-01-20, Dino wrote: > > let's say I have this list of nested dicts: > > [ >{ "some_key": {'a':1, 'b':2}}, >{ "some_other_key": {'a':3, 'b':4}} > ] > > I need to turn this into: > > [ >{ "value": "some_key", 'a':1, 'b':2}, >{ "value": "some_other_key", 'a':3, 'b':4} > ] [{"v

Re: ok, I feel stupid, but there must be a better way than this! (finding name of unique key in dict)

2023-01-20 Thread Dino
On 1/20/2023 11:06 AM, Tobiah wrote: On 1/20/23 07:29, Dino wrote: This doesn't look like the program output you're getting. you are right that I tweaked the name of fields and variables manually (forgot a couple of places, my bad) to illustrate the problem more generally, but hopefully y

Re: ok, I feel stupid, but there must be a better way than this! (finding name of unique key in dict)

2023-01-20 Thread Tobiah
On 1/20/23 07:29, Dino wrote: let's say I have this list of nested dicts: [   { "some_key": {'a':1, 'b':2}},   { "some_other_key": {'a':3, 'b':4}} ] I need to turn this into: [   { "value": "some_key", 'a':1, 'b':2},   { "value": "some_other_key", 'a':3, 'b':4} ] This doesn't look like

ok, I feel stupid, but there must be a better way than this! (finding name of unique key in dict)

2023-01-20 Thread Dino
let's say I have this list of nested dicts: [ { "some_key": {'a':1, 'b':2}}, { "some_other_key": {'a':3, 'b':4}} ] I need to turn this into: [ { "value": "some_key", 'a':1, 'b':2}, { "value": "some_other_key", 'a':3, 'b':4} ] I actually did it with: listOfDescriptors = list() for cd

Re: In numpy, why is it ok to do matrix.mean(), but not ok to do matrix.median()?

2018-05-02 Thread C W
Thanks, Chris. That makes sense. The len() example is great! On Tue, May 1, 2018 at 10:37 PM, Chris Angelico wrote: > On Wed, May 2, 2018 at 12:22 PM, C W wrote: > > It's interesting how mean() can be implemented, but median() will break > > other packages. > > > > So, the default way in numpy

Re: In numpy, why is it ok to do matrix.mean(), but not ok to do matrix.median()?

2018-05-01 Thread Chris Angelico
On Wed, May 2, 2018 at 12:22 PM, C W wrote: > It's interesting how mean() can be implemented, but median() will break > other packages. > > So, the default way in numpy is to use functions, not methods? > > When I first learned Python, I was told to create an object and to play > around, there are

Re: In numpy, why is it ok to do matrix.mean(), but not ok to do matrix.median()?

2018-05-01 Thread C W
# throws error message > > READ error messages. At the very least, quote error messages when asking > questions somewhere like here. There I was, wondering why the numpy docs > didn't mention ndarray.median when you were clearly using it... > > Anyway, > > > H

Re: In numpy, why is it ok to do matrix.mean(), but not ok to do matrix.median()?

2018-05-01 Thread Thomas Jollans
Anyway, > Hello everyone, > > In numpy, why is it ok to do matrix.mean(), but not ok to do > matrix.median()? To me, they are two of many summary statistics. So, why > median() is different? First, this is how it's different: the method ndarray.median simply does not exist.

In numpy, why is it ok to do matrix.mean(), but not ok to do matrix.median()?

2018-05-01 Thread C W
Hello everyone, In numpy, why is it ok to do matrix.mean(), but not ok to do matrix.median()? To me, they are two of many summary statistics. So, why median() is different? Here's an example code, import numpy as np matrix = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) # find the mean np

OK, now one main block only , but loop.run_forever() ? idk...

2017-12-31 Thread Wu Xi
from tkinter import *#I cant see anything wrong with the async_loop business here. It works like a charm. from tkinter import messagebox #is there a serious concern doing things his way ? import asyncio , threading , random

Re: Problems with python3.6 on one system, but OK on another

2017-01-23 Thread dieter
Cecil Westerhof writes: > I build python3.6 on two systems. On one system everything is OK: > Python 3.6.0 (default, Jan 21 2017, 11:19:56) > [GCC 4.9.2] on linux > Type "help", "copyright", "credits" or "license" for more information. &

Problems with python3.6 on one system, but OK on another

2017-01-21 Thread Cecil Westerhof
I build python3.6 on two systems. On one system everything is OK: Python 3.6.0 (default, Jan 21 2017, 11:19:56) [GCC 4.9.2] on linux Type "help", "copyright", "credits" or "license" for more information. But on another I get: Could not find platfo

Re: Is it ok to install python binaries on a network drive?

2015-11-04 Thread Fabien
On 10/29/2015 01:07 PM, Steven D'Aprano wrote: My question is: what will happen when about 20 students will do the same >at the same time? I know too little about what's going under the hood >with an "import X" command to be able to predict problems that might >occur. I think it should be fine.

Re: Is my implementation of happy number OK

2015-05-02 Thread Jon Ribbens
On 2015-05-01, Peter Otten <__pete...@web.de> wrote: > A computer that cannot calculate a lookup table with all 3-digit cases > should be almost as hard to find as the one needed by Jon ;) ... or anyone else writing code to return the set of happy numbers. -- https://mail.python.org/mailman/list

Re: Is my implementation of happy number OK

2015-05-01 Thread Peter Otten
Ian Kelly wrote: > On Fri, May 1, 2015 at 2:27 AM, Steven D'Aprano > wrote: >> Rather than 10**7, how about trying (10**500 + 2). Is it happy? >> >> Using the Python code from Wikipedia: >> https://en.wikipedia.org/wiki/Happy_number >> >> SQUARE = dict([(c, int(c)**2) for c in "0123456789"]) >> d

Re: Is my implementation of happy number OK

2015-05-01 Thread Ian Kelly
On Fri, May 1, 2015 at 2:27 AM, Steven D'Aprano wrote: > Rather than 10**7, how about trying (10**500 + 2). Is it happy? > > Using the Python code from Wikipedia: > https://en.wikipedia.org/wiki/Happy_number > > SQUARE = dict([(c, int(c)**2) for c in "0123456789"]) > def is_happy(n): > while (n

Re: Is my implementation of happy number OK

2015-05-01 Thread Steven D'Aprano
On Fri, 1 May 2015 05:23 pm, Jon Ribbens wrote: > On 2015-04-30, Dave Angel wrote: >> On 04/30/2015 07:31 PM, Jon Ribbens wrote: >>> On 2015-04-30, Dave Angel wrote: But the real reason I didn't like it was it produced a much larger set of happy_numbers, which could clog memory a lot s

Re: Is my implementation of happy number OK

2015-05-01 Thread Jon Ribbens
On 2015-04-30, Dave Angel wrote: > On 04/30/2015 07:31 PM, Jon Ribbens wrote: >> On 2015-04-30, Dave Angel wrote: >>> But the real reason I didn't like it was it produced a much larger >>> set of happy_numbers, which could clog memory a lot sooner. For >>> 10**7 items, I had 3250 happy members,

Re: Is my implementation of happy number OK

2015-04-30 Thread Cecil Westerhof
Op Friday 1 May 2015 01:52 CEST schreef Dave Angel: > On 04/30/2015 07:31 PM, Jon Ribbens wrote: >> On 2015-04-30, Dave Angel wrote: >>> Finally, I did some testing on Jon Ribben's version. His was >>> substantially faster for smaller sets, and about the same for >>> 10*7. So it's likely it'll be

Re: Is my implementation of happy number OK

2015-04-30 Thread Dave Angel
On 04/30/2015 07:31 PM, Jon Ribbens wrote: On 2015-04-30, Dave Angel wrote: Finally, I did some testing on Jon Ribben's version. His was substantially faster for smaller sets, and about the same for 10*7. So it's likely it'll be slower than yours and mine for 10**8. You know what they say a

Re: Is my implementation of happy number OK

2015-04-30 Thread Jon Ribbens
On 2015-04-30, Dave Angel wrote: > Finally, I did some testing on Jon Ribben's version. His was > substantially faster for smaller sets, and about the same for 10*7. So > it's likely it'll be slower than yours and mine for 10**8. You know what they say about assumptions. Actually, my version

Re: Is my implementation of happy number OK

2015-04-30 Thread Dave Angel
On 04/30/2015 04:35 PM, Cecil Westerhof wrote: Op Thursday 30 Apr 2015 20:53 CEST schreef Dave Angel: Finally, I did some testing on Jon Ribben's version. His was substantially faster for smaller sets, and about the same for 10*7. So it's likely it'll be slower than yours and mine for 10**8. B

Re: Is my implementation of happy number OK

2015-04-30 Thread Cecil Westerhof
Op Thursday 30 Apr 2015 20:53 CEST schreef Dave Angel: > On 04/30/2015 11:59 AM, Cecil Westerhof wrote: >> I implemented happy_number function: >> _happy_set = { '1' } >> _unhappy_set= set() >> >> def happy_number(n): >> """ >> Check if a number is a happy number >> https://en.wikipedia.o

Re: Is my implementation of happy number OK

2015-04-30 Thread Cecil Westerhof
Op Thursday 30 Apr 2015 19:37 CEST schreef Ian Kelly: Most I still have to digest. ;-) > On Thu, Apr 30, 2015 at 9:59 AM, Cecil Westerhof wrote: >> return (current_array, ''.join(current_array)) > > You don't seem to be actually using current_array for anything, so > why not just return the stri

Re: Is my implementation of happy number OK

2015-04-30 Thread Dave Angel
On 04/30/2015 11:59 AM, Cecil Westerhof wrote: I implemented happy_number function: _happy_set = { '1' } _unhappy_set= set() def happy_number(n): """ Check if a number is a happy number https://en.wikipedia.org/wiki/Happy_number """

Re: Is my implementation of happy number OK

2015-04-30 Thread Ian Kelly
On Thu, Apr 30, 2015 at 9:59 AM, Cecil Westerhof wrote: > I implemented happy_number function: > _happy_set = { '1' } > _unhappy_set= set() > > def happy_number(n): > """ > Check if a number is a happy number > https://en.wikipedia.org/wiki/Happy_number

Re: Is my implementation of happy number OK

2015-04-30 Thread Jon Ribbens
On 2015-04-30, Cecil Westerhof wrote: > Besides it need some documentation: is it a good implementation? Or > are there things I should do differently? Here's an alternative implementation which is a bit neater: def find_happy(maximum): """Return set of happy numbers between 1 and `m

Is my implementation of happy number OK

2015-04-30 Thread Cecil Westerhof
I implemented happy_number function: _happy_set = { '1' } _unhappy_set= set() def happy_number(n): """ Check if a number is a happy number https://en.wikipedia.org/wiki/Happy_number """ def create_current(n): current_array =

Re: unorderable error: less ok, equal ok, less-or-equal gives unorderable error!

2014-07-01 Thread Peter Otten
c is expected to be a tuple: > > In this case None is not being returned, but will be comparid with > self._loc, so RainyDay is good there. RainyDay wrote: > I'm only using None in equality comparison, it's never a default value of > _loc itself, so this should be ok becaus

Re: unorderable error: less ok, equal ok, less-or-equal gives unorderable error!

2014-06-30 Thread Ethan Furman
On 06/30/2014 12:34 PM, Peter Otten wrote: RainyDay wrote: def __eq__(self, other): return self._loc == getattr(other, "_loc", None) Note that None is not a good default when _loc is expected to be a tuple: In this case None is not being returned, but will be comparid with sel

Re: unorderable error: less ok, equal ok, less-or-equal gives unorderable error!

2014-06-30 Thread RainyDay
special method of that name; it should probably be __le__(). Right, I used lte in django and assumed they were consistent with python. > > def __eq__(self, other): > > > return self._loc == getattr(other, "_loc", None) > > > > Note that None is not a good default when _loc is expected to be a tuple: > I'm only using None in equality comparison, it's never a default value of _loc itself, so this should be ok because it'll compare to all other object types and correctly say they're unequal. - andrei -- https://mail.python.org/mailman/listinfo/python-list

Re: unorderable error: less ok, equal ok, less-or-equal gives unorderable error!

2014-06-30 Thread Peter Otten
RainyDay wrote: > Hi, in python 3.4.1, I get this surpising behaviour: > l=Loc(0,0) l2=Loc(1,1) l>l2 > False l True l<=l2 > Traceback (most recent call last): > File "", line 1, in > TypeError: unorderable types: Loc() <= Loc() l==l2 > False l True > > Loc i

unorderable error: less ok, equal ok, less-or-equal gives unorderable error!

2014-06-30 Thread RainyDay
Hi, in python 3.4.1, I get this surpising behaviour: >>> l=Loc(0,0) >>> l2=Loc(1,1) >>> l>l2 False >>> l>> l<=l2 Traceback (most recent call last): File "", line 1, in TypeError: unorderable types: Loc() <= Loc() >>> l==l2 False >>> lhttps://mail.python.org/mailman/listinfo/python-list

Re: same code to login,one is ok,another is not

2011-08-15 Thread Rafael Durán Castañeda
until get the answer 2011/8/15 Steven D'Aprano > 守株待兔 wrote: > > > 1.http://www.renren.com/Login.do > > it is ok,my code: > [...] > > 2.https://passport.baidu.com/?login > > can't login,my code: > [...] > > Do you have a question, or are you ju

Re: same code to login,one is ok,another is not

2011-08-14 Thread Steven D'Aprano
守株待兔 wrote: > 1.http://www.renren.com/Login.do > it is ok,my code: [...] > 2.https://passport.baidu.com/?login > can't login,my code: [...] Do you have a question, or are you just sharing the bad news? Websites may choose to respond to login attempts differently. Some may requ

same code to login,one is ok,another is not

2011-08-14 Thread 守株待兔
1.http://www.renren.com/Login.do it is ok,my code: import cookielib, urllib2, urllib cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) exheaders = [("User-Agent","Mozilla/4.0 (compatible; MSIE 7.1; Windows NT 5.1; SV1)"),] opener.

Re: where the function has problem? n = 900 is OK , but n = 1000 is ERROR

2011-08-02 Thread Billy Mays
On 08/02/2011 10:15 AM, Steven D'Aprano wrote: So you say, but I don't believe it. Given fibo, the function you provided earlier, the error increases with N: fibo(82) - fib(82) # fib returns the accurate Fibonacci number 160.0 fibo(182) - fib(182) 2.92786721937918e+23 Hardly "arbitrarily s

Re: where the function has problem? n = 900 is OK , but n = 1000 is ERROR

2011-08-02 Thread Steven D'Aprano
Billy Mays wrote: > On 08/02/2011 08:45 AM, Alain Ketterlin wrote: >> produce integers. And it will fail with overflow for big values. > > If it would make you feel better I can use decimal. > > Also, perhaps I can name my function billy_fibo(n), which is defined as > billy_fibo(n) +error(n) = f

Re: where the function has problem? n = 900 is OK , but n = 1000 is ERROR

2011-08-02 Thread Billy Mays
On 08/02/2011 08:45 AM, Alain Ketterlin wrote: produce integers. And it will fail with overflow for big values. If it would make you feel better I can use decimal. Also, perhaps I can name my function billy_fibo(n), which is defined as billy_fibo(n) +error(n) = fibo(n), where error(n) can be

Re: where the function has problem? n = 900 is OK , but n = 1000 is ERROR

2011-08-02 Thread Alain Ketterlin
Billy Mays <81282ed9a88799d21e77957df2d84bd6514d9...@myhashismyemail.com> writes: > On 08/01/2011 06:06 PM, Steven D'Aprano wrote: >> Does your definition of "fixed" mean "gives wrong results for n>= 4 "? > Well, I don't know if you're trolling or just dumb: Steven is right, and you look dumb.

Re: where the function has problem? n = 900 is OK , but n = 1000 is ERROR

2011-08-02 Thread Billy Mays
On 08/01/2011 06:06 PM, Steven D'Aprano wrote: Does your definition of "fixed" mean "gives wrong results for n>= 4 "? fibo(4) == 3 False Well, I don't know if you're trolling or just dumb: http://en.wikipedia.org/wiki/Fibonacci_number In [2]: for i in range(10): ...: print fibo(i)

Re: where the function has problem? n = 900 is OK , but n = 1000 is ERROR

2011-08-01 Thread Steven D'Aprano
Billy Mays wrote: > I have fixed the problem for you: > > > def fibo(n): > phi = (1+5**.5)/2; iphi = 1-phi; > return (phi**n - iphi**n) / (5**.5) Does your definition of "fixed" mean "gives wrong results for n >= 4 "? >>> fibo(4) == 3 False -- Steven -- http://mail.python.org/

Re: where the function has problem? n = 900 is OK , but n = 1000 is ERROR

2011-08-01 Thread Thomas Rachel
Am 01.08.2011 11:11 schrieb jc: except: print "EXCEPT: " + str(n) If you catch all exceptions here, it is clear that you only get this. Why don't you do except Exception, e: print "EXCEPT: " + str(n), e ? Then you could at least ask "why do I get a unsupported operand typ

Re: where the function has problem? n = 900 is OK , but n = 1000 is ERROR

2011-08-01 Thread Billy Mays
On 08/01/2011 05:11 AM, jc wrote: # Get Fibonacci Value #Fibonacci(N) = Fibonacci(N-1) + Fibonacci(N-2) # # n = 900 is OK # n = 1000 is ERROR , Why # # What Wrong? # I have fixed the problem for you: def fibo(n): phi = (1+5**.5)/2; iphi = 1-phi; return (phi**n - iphi**n) / (5**.5

Re: where the function has problem? n = 900 is OK , but n = 1000 is ERROR

2011-08-01 Thread Ulrich Eckhardt
Steven D'Aprano wrote: > jc wrote: >> n = 900 >> cache = range(0 , n + 1 , 1) >> for i in cache: >> cache[i] = -1 > > This is a waste of time. Better to write: > > cache = [-1]*900 Since he's computing the Fibonacci number of n, and n is 900, he needs cache = [-1] * (n + 1)

Re: where the function has problem? n = 900 is OK , but n = 1000 is ERROR

2011-08-01 Thread Dave Angel
On 01/-10/-28163 02:59 PM, jc wrote: # Get Fibonacci Value #Fibonacci(N) = Fibonacci(N-1) + Fibonacci(N-2) # # n = 900 is OK # n = 1000 is ERROR , Why # # What Wrong? # cache = [] def fibo( n ): try: if cache[n] != -1: return cache[n] else

Re: where the function has problem? n = 900 is OK , but n = 1000 is ERROR

2011-08-01 Thread Gennadiy Zlobin
onacci(N) = Fibonacci(N-1) + Fibonacci(N-2) > # > # n = 900 is OK > # n = 1000 is ERROR , Why > # > # What Wrong? > # > > cache = [] > > def fibo( n ): > >try: >if cache[n] != -1: >return cache[n] >else: >if 0

Re: where the function has problem? n = 900 is OK , but n = 1000 is ERROR

2011-08-01 Thread Steven D'Aprano
jc wrote: > # Get Fibonacci Value > #Fibonacci(N) = Fibonacci(N-1) + Fibonacci(N-2) > # > # n = 900 is OK > # n = 1000 is ERROR , Why How should we know? Please tell us what the error is, don't expect us to guess. [...] > if __name__ == '__main__': > #

where the function has problem? n = 900 is OK , but n = 1000 is ERROR

2011-08-01 Thread jc
# Get Fibonacci Value #Fibonacci(N) = Fibonacci(N-1) + Fibonacci(N-2) # # n = 900 is OK # n = 1000 is ERROR , Why # # What Wrong? # cache = [] def fibo( n ): try: if cache[n] != -1: return cache[n] else: if 0 == n: r = 0

Re: OK, I lied, I do have another question...

2011-07-11 Thread Chris Hulan
The callback is a method so you need to specify the owner builder.connect_signals({"on_window_destroy" : gtk.main_quit, "on_btnExit_clicked" : self.btnExit_clicked}) Got this info from http://www.pygtk.org/articles/pygtk-glade-gui/Creating_a_GUI_using_PyGTK_and_Glade.htm cheers -- http://mail.

OK, I lied, I do have another question...

2011-07-10 Thread Anthony Papillion
Hi Everyone, So I've used Glade to build a simple UI and I'm loading it with gtkBuilder. The UI loads fine but, for some reason, none of my signals are being connected. For example, in Glade, I said when the button called btnExit was clicked, execute the btnExit_clicked method. Then, in my App() c

Re: [JOB] Python Programmer, Newport Beach, CA | 6-24 months - Relo OK

2011-06-20 Thread Chris Withers
On 09/06/2011 22:31, PHP Recruiter wrote: This is a contract/hourly 6-24 month on-site Python Programming job located in Newport Beach, CA paying $50.00 to $80.00 per hour depending on experience. Local candidates preferred, but all considered. Relocation expenses covered. I'd suggest submitt

Re: i want to learn pyqt ,but i have no c++ knowlage. is it ok????

2011-06-10 Thread Dennis
2011/6/10 可乐 : > On 6月11日, 下午12时03分, Javier wrote: >> ?? wrote: >> > i want to learn pyqt ,but i have no c++ knowlage. is it ok >> >> It should be ok. I would recoomend this book: >> >> "Rapid GUI Programming with Python and Qt" (P

Re: i want to learn pyqt ,but i have no c++ knowlage. is it ok????

2011-06-10 Thread 可乐
On 6月11日, 下午12时03分, Javier wrote: > ?? wrote: > > i want to learn pyqt ,but i have no c++ knowlage. is it ok > > It should be ok. I would recoomend this book: > > "Rapid GUI Programming with Python and Qt" (Prentice Hall Open Source Software > Devel

Re: i want to learn pyqt ,but i have no c++ knowlage. is it ok????

2011-06-10 Thread Javier
?? wrote: > i want to learn pyqt ,but i have no c++ knowlage. is it ok It should be ok. I would recoomend this book: "Rapid GUI Programming with Python and Qt" (Prentice Hall Open Source Software Development) Mark Summerfield (Author) -- http://mail.python.org/mai

i want to learn pyqt ,but i have no c++ knowlage. is it ok????

2011-06-10 Thread 可乐
i want to learn pyqt ,but i have no c++ knowlage. is it ok -- http://mail.python.org/mailman/listinfo/python-list

[JOB] Python Programmer, Newport Beach, CA | 6-24 months - Relo OK

2011-06-09 Thread PHP Recruiter
This is a contract/hourly 6-24 month on-site Python Programming job located in Newport Beach, CA paying $50.00 to $80.00 per hour depending on experience. Local candidates preferred, but all considered. Relocation expenses covered. Our Newport Beach, CA client is seeking a Python programmer with

Re: .Well, ok, I will try some of that. But I am running window 7, not Linux.

2011-04-22 Thread P S
u will >> find the line 'prefix=/usr'. Replace the '/usr' by your chosen path. >> - Save the file and retry the install (see above). >> >> >> >> Best regards, >> >> G??nther >>> On Friday, April 01, 2011 3:40 PM Manatee wrote: >>> . >>> >>> Well, ok, I will try some of that. But I am running window 7, not Linux. >>> The "sudo" command sounds like Linux. -- http://mail.python.org/mailman/listinfo/python-list

Re: GCC process not working as expected when called in Python (3.1.2) subprocess-shell, but OK otherwise

2010-10-14 Thread Chris Rebert
On Wed, Oct 13, 2010 at 7:06 PM, Kingsley Turner wrote: >  Hi, > > I'm using GCC as a pre-processor for a C-like language (EDDL) to handle all > the includes, macros, etc. producing a single source file for another > compiler.  My python code massages the inputs (which arrive in a .zip file), > th

Re: GCC process not working as expected when called in Python (3.1.2) subprocess-shell, but OK otherwise

2010-10-14 Thread Diez B. Roggisch
roblem since it's all run by the same > user, I also checked the environment - these were copied into the > subshell. > > GCC produces no warnings, or errors. The output is mostly OK, some > other macros have been processed. > If I diff the working output with the non-working on

GCC process not working as expected when called in Python (3.1.2) subprocess-shell, but OK otherwise

2010-10-14 Thread Kingsley Turner
ut is perfect. I'm not really sure how to debug this. I already checked the ulimits, and permissions shouldn't be a problem since it's all run by the same user, I also checked the environment - these were copied into the subshell. GCC produces no warnings, or errors. The outpu

Re: Is this an ok thing to do in a class

2010-05-18 Thread Vincent Davis
On Tue, May 18, 2010 at 3:15 PM, Ethan Furman wrote: > Vincent Davis wrote: > >> >> What you are pointing out is that the assignment is not reversed . But >> that does make me thing of something I had not. >> >> >>> afoo.letter['a'] = 345 >> >>> afoo.A >> 1 >> >> Thats kinda a bummer, whats a g

Re: Is this an ok thing to do in a class

2010-05-18 Thread Ethan Furman
Vincent Davis wrote: On Tue, May 18, 2010 at 2:41 PM, Ethan Furman > wrote: Do you expect afoo.letter[x] to always be afoo.x? Because they aren't: >>> afoo.A = 9 >>> afoo.letter['a'] 1 What you are pointing out is that the assignment is not revers

Re: Is this an ok thing to do in a class

2010-05-18 Thread Vincent Davis
On Tue, May 18, 2010 at 2:41 PM, Ethan Furman wrote: > > Do you expect afoo.letter[x] to always be afoo.x? Because they aren't: > > >>> afoo.A = 9 > >>> afoo.letter['a'] > 1 > What you are pointing out is that the assignment is not reversed . But that does make me thing of something I had not.

Re: Is this an ok thing to do in a class

2010-05-18 Thread Ethan Furman
Vincent Davis wrote: Just wondering if there is a problem with mixing a dictionary into a class like this. Everything seems to work as I would expect. class foo(object): def __init__(self, x): self.letter = dict(a=1,b=2,c=3) self.A=self.letter['a'] self.x=self.letter

Re: Is this an ok thing to do in a class

2010-05-18 Thread Vincent Davis
Thanks for the feed back Vincent On Tue, May 18, 2010 at 8:50 AM, Bruno Desthuilliers wrote: > Simon Brunning a écrit : > >> On 18 May 2010 06:21:32 UTC+1, Vincent Davis >> wrote: >> >>> Just wondering if there is a problem with mixing a dictionary into a >>> class like this. Everything seems

Re: Is this an ok thing to do in a class

2010-05-18 Thread Bruno Desthuilliers
Simon Brunning a écrit : On 18 May 2010 06:21:32 UTC+1, Vincent Davis wrote: Just wondering if there is a problem with mixing a dictionary into a class like this. Everything seems to work as I would expect. No problem at all AFAIC. OP didn't show up on c.l.py, so too bad you snipped the re

Re: Is this an ok thing to do in a class

2010-05-18 Thread Simon Brunning
On 18 May 2010 06:21:32 UTC+1, Vincent Davis wrote: > > Just wondering if there is a problem with mixing a dictionary into a class > like this. Everything seems to work as I would expect. No problem at all AFAIC. -- Cheers, Simon B. -- http://mail.python.org/mailman/listinfo/python-list

Is this an ok thing to do in a class

2010-05-17 Thread Vincent Davis
Just wondering if there is a problem with mixing a dictionary into a class like this. Everything seems to work as I would expect. class foo(object): def __init__(self, x): self.letter = dict(a=1,b=2,c=3) self.A=self.letter['a'] self.x=self.letter[x] >>> afoo = foo('b')

Re: OK to memoize re objects?

2009-09-22 Thread Hyuga
On Sep 21, 11:02 am, Nobody wrote: > On Mon, 21 Sep 2009 07:11:36 -0700, Ethan Furman wrote: > > Looking in the code for re in 2.5: > > _MAXCACHE = 100 > > On the other hand, I (a > > re novice, to be sure) have only used between two to five in any one > > program... it'll be a while before I hit

Re: OK to memoize re objects?

2009-09-21 Thread Steven D'Aprano
On Mon, 21 Sep 2009 13:33:05 +, kj wrote: > I find the docs are pretty confusing on this point. They first make the > point of noting that pre-compiling regular expressions is more > efficient, and then *immediately* shoot down this point by saying that > one need not worry about pre-compilin

Re: OK to memoize re objects?

2009-09-21 Thread Ethan Furman
Nobody wrote: On Mon, 21 Sep 2009 07:11:36 -0700, Ethan Furman wrote: Looking in the code for re in 2.5: _MAXCACHE = 100 On the other hand, I (a re novice, to be sure) have only used between two to five in any one program... it'll be a while before I hit _MAXCACHE! Do you know how m

Re: OK to memoize re objects?

2009-09-21 Thread Nobody
On Mon, 21 Sep 2009 07:11:36 -0700, Ethan Furman wrote: > Looking in the code for re in 2.5: > _MAXCACHE = 100 > On the other hand, I (a > re novice, to be sure) have only used between two to five in any one > program... it'll be a while before I hit _MAXCACHE! Do you know how many REs import-e

Re: OK to memoize re objects?

2009-09-21 Thread Ethan Furman
kj wrote: In Robert Kern writes: kj wrote: My Python code is filled with assignments of regexp objects to globals variables at the top level; e.g.: _spam_re = re.compile('^(?:ham|eggs)$', re.I) Don't like it. My Perl-pickled brain wishes that re.compile was a memoizing method, so that

Re: OK to memoize re objects?

2009-09-21 Thread kj
In Robert Kern writes: >kj wrote: >> >> My Python code is filled with assignments of regexp objects to >> globals variables at the top level; e.g.: >> >> _spam_re = re.compile('^(?:ham|eggs)$', re.I) >> >> Don't like it. My Perl-pickled brain wishes that re.compile was >> a memoizing method

Re: OK to memoize re objects?

2009-09-19 Thread Robert Kern
kj wrote: My Python code is filled with assignments of regexp objects to globals variables at the top level; e.g.: _spam_re = re.compile('^(?:ham|eggs)$', re.I) Don't like it. My Perl-pickled brain wishes that re.compile was a memoizing method, so that I could use it anywhere, even inside tig

OK to memoize re objects?

2009-09-19 Thread kj
My Python code is filled with assignments of regexp objects to globals variables at the top level; e.g.: _spam_re = re.compile('^(?:ham|eggs)$', re.I) Don't like it. My Perl-pickled brain wishes that re.compile was a memoizing method, so that I could use it anywhere, even inside tight loops, w

Re: [JOB] Plone Developer, Washington, D.C. - Relo OK | 55-75k

2009-05-29 Thread Scott David Daniels
OSS wrote: Plone Developer, Washington, D.C. - Relo OK | 55-75k You should post this to the Python Jobs board, and not here. http://www.python.org/community/jobs/ --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

[JOB] Plone Developer, Washington, D.C. - Relo OK | 55-75k

2009-05-29 Thread OSS
Plone Developer, Washington, D.C. - Relo OK | 55-75k shiverat** Government security clearance required ** ** Relocation assistance provided ** My client is seeking a full-time Plone Developer for work with the federal government. The applicant will be responsible for standardizing web formats

Re: Is it ok to type check a boolean argument?

2009-01-08 Thread Carl Banks
On Jan 7, 6:21 pm, Scott David Daniels wrote: > Adal Chiriliuc wrote: > > On Jan 7, 10:15 pm, Bruno Desthuilliers > > wrote: > >> ... I'd either keep the argument as a boolean but rename it "ascending" ... > > > Well, I lied a bit :-p   > > But what if we can't solve it as elegantly, and we n

Re: Is it ok to type check a boolean argument?

2009-01-08 Thread Bruno Desthuilliers
Adal Chiriliuc a écrit : On Jan 7, 10:15 pm, Bruno Desthuilliers wrote: This being said, I can only concur with other posters here about the very poor naming. As far as I'm concerned, I'd either keep the argument as a boolean but rename it "ascending" (and use a default True value), or keep the

Re: Is it ok to type check a boolean argument?

2009-01-07 Thread James Stroud
Ben Finney wrote: Why are people so reluctant to make error message templates clearer with named placeholders? Because they can never remember they even exist. Thanks for the reminder. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it ok to type check a boolean argument?

2009-01-07 Thread Ben Finney
Scott David Daniels writes: > James Stroud wrote: > > ... > > def find(field, order_by='desc'): > > if order_by not in ['asc', 'desc']: > > raise ValueError, 'Bad order_by parameter.' > > ... > I'd try a little harder with that error message. > At least: > raise ValueError('Bad order_

Re: Is it ok to type check a boolean argument?

2009-01-07 Thread Scott David Daniels
James Stroud wrote: ... def find(field, order_by='desc'): if order_by not in ['asc', 'desc']: raise ValueError, 'Bad order_by parameter.' ... I'd try a little harder with that error message. At least: raise ValueError('Bad order_by parameter %r.' % (order_by,)) if not: raise Valu

Re: Is it ok to type check a boolean argument?

2009-01-07 Thread James Stroud
Adal Chiriliuc wrote: Hello, Me and my colleagues are having an discussion about the best way to code a function (more Pythonic). Here is the offending function: def find(field, order): if not isinstance(order, bool): raise ValueError("order must be a bool") order_by = "asc" if

Re: Is it ok to type check a boolean argument?

2009-01-07 Thread Scott David Daniels
Adal Chiriliuc wrote: On Jan 7, 10:15 pm, Bruno Desthuilliers wrote: ... I'd either keep the argument as a boolean but rename it "ascending" ... Well, I lied a bit :-p But what if we can't solve it as elegantly, and we need to ... Should we typecheck in this case to ensure that if we p

Re: Is it ok to type check a boolean argument?

2009-01-07 Thread Adal Chiriliuc
On Jan 7, 10:15 pm, Bruno Desthuilliers wrote: > This being said, I can only concur with other posters here about the > very poor naming. As far as I'm concerned, I'd either keep the argument > as a boolean but rename it "ascending" (and use a default True value), > or keep the 'order' name but th

Re: Is it ok to type check a boolean argument?

2009-01-07 Thread Bruno Desthuilliers
Adal Chiriliuc a écrit : Hello, Me and my colleagues are having an discussion about the best way to code a function (more Pythonic). Here is the offending function: def find(field, order): if not isinstance(order, bool): raise ValueError("order must be a bool") order_by = "asc"

Re: Is it ok to type check a boolean argument?

2009-01-07 Thread Terry Reedy
Adal Chiriliuc wrote: Me and my colleagues are having an discussion about the best way to code a function (more Pythonic). Here is the offending function: def find(field, order): if not isinstance(order, bool): raise ValueError("order must be a bool") order_by = "asc" if order

Re: Is it ok to type check a boolean argument?

2009-01-07 Thread Philip Semanchuk
On Jan 7, 2009, at 12:24 PM, Adal Chiriliuc wrote: Hello, Me and my colleagues are having an discussion about the best way to code a function (more Pythonic). Here is the offending function: def find(field, order): if not isinstance(order, bool): raise ValueError("order must be a

Re: Is it ok to type check a boolean argument?

2009-01-07 Thread Paul McGuire
On Jan 7, 11:24 am, Adal Chiriliuc wrote: > Hello, > > Me and my colleagues are having an discussion about the best way to > code a function (more Pythonic). > > Here is the offending function: > > def find(field, order): > if not isinstance(order, bool): > raise ValueError("order must

Is it ok to type check a boolean argument?

2009-01-07 Thread Adal Chiriliuc
Hello, Me and my colleagues are having an discussion about the best way to code a function (more Pythonic). Here is the offending function: def find(field, order): if not isinstance(order, bool): raise ValueError("order must be a bool") order_by = "asc" if order else "desc" r

[JOB] Senior Python Engineer, NYC - Relo OK - 150-250k

2008-11-04 Thread Beau Gould
Job Title: Senior Python Engineer Location: New York City - Relocation assistance provided Salary: $150,000 - $250,000 per year + benefits Entrepreneurial. Challenging. Exciting. Fun. Innovative. Edgy. Distinctive. Sound like an interesting job? Our company was born out of a passion for bring

[JOB] Systems Engineer, San Francisco, CA | 90-150k - Relo OK

2008-10-21 Thread OSS
Job Title: Software Engineer--Systems Location: San Francisco - Relocation assistance provided Duration: Full Time/Permanent Salary: 90-150k DOE Our client is home to a new type of search that makes it easy to find subjective information. Starting in early 2008 the company raised seed financing fr

Re: Problems Returning an HTTP 200 Ok Message

2008-07-14 Thread Gabriel Genellina
En Mon, 14 Jul 2008 17:46:12 -0300, samwyse <[EMAIL PROTECTED]> escribió: On Jul 11, 3:46 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: As Guy Davidson has already pointed out, this is a problem in the meter That would have been me, not Guy. Indeed, sorry the misattribution! -- Gabrie

Re: Problems Returning an HTTP 200 Ok Message

2008-07-14 Thread samwyse
On Jul 11, 3:46 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > As Guy Davidson has already pointed out, this is a problem in the meter   > TCP implementation, and you should ask the vendor to fix it. That would have been me, not Guy. -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   >