Re: 79 chars or more?

2010-08-16 Thread Michael Torrie
On 08/16/2010 10:50 PM, AK wrote: > I stay away from ugly cramped one-liners; I mostly run over 79 when I > have a few `and` and `or` clauses or long strings. I've also noticed > something interesting: going from 79 to 99 affects a relatively large > number of lines, but going over 99 (i.e. 99 to 1

Re: 79 chars or more?

2010-08-16 Thread Michael Torrie
On 08/16/2010 08:59 PM, AK wrote: > But.. why horizontal scrolling, isn't autowrap much better than that? Wouldn't it really make a visual mess of Python code if lines wrapped? Maybe if they wrapped smartly. In general, the only time I find my lines longer than 75 characters are strings or somet

Re: 79 chars or more?

2010-08-16 Thread James Mills
On Tue, Aug 17, 2010 at 2:50 PM, AK wrote: > By the way, the reason I asked is that we're working on a python > tutorial and I realized that even though I'm used to 99, I wasn't sure > if it's ok to teach that to new users or not.. In my opinion it would be "okay" to teach. However: Bare in mind

Re: 79 chars or more?

2010-08-16 Thread AK
On 08/17/2010 12:26 AM, James Mills wrote: On Tue, Aug 17, 2010 at 2:12 PM, AK wrote: There's no doubt that there are pro's and con's, but to be fair, it's not like code becomes unreadable over 79 chars - the difference is that when your terminal is 80 chars, it's less convenient for you to rea

Re: update of elements in GUI

2010-08-16 Thread woooee
On Aug 16, 9:07 pm, Jah_Alarm wrote: I have some elements on the screen (Labels, most > importantly) which content has to be updated every iteration of the > algorithm The variable type is IntVar() You would use int_var_name.set(some_number) -- http://mail.python.org/mailman/listinfo/python-lis

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-16 Thread cbr...@cbrownsystems.com
On Aug 16, 11:04 am, Baba wrote: > Hi Chas, Roald, > > These are all complicated formula that i believe are not expected at > this level. If you look at the source (see my first submission) you > will see that this exercise is only the second in a series called > "Introduction to Programming". The

Re: 79 chars or more?

2010-08-16 Thread James Mills
On Tue, Aug 17, 2010 at 2:12 PM, AK wrote: > There's no doubt that there are pro's and con's, but to be fair, it's > not like code becomes unreadable over 79 chars - the difference is that > when your terminal is 80 chars, it's less convenient for you to read > code that's wider and when your term

Eval cannot see globals from another module

2010-08-16 Thread Tom Harris
Greetings, I want a debugging function with the effect of the function below (in a seperate module): def dump(expr): print expr, '=', eval(expr) foo = 33 dump('foo') Of course this fails when called from another module because eval does not know the globals or locals of the caller. Is the

Re: Python "why" questions

2010-08-16 Thread Steven D'Aprano
On Mon, 16 Aug 2010 22:56:20 -0500, Robert Kern wrote: > On 8/16/10 9:29 PM, Roy Smith wrote: >> In article, >> Lawrence D'Oliveiro wrote: >> >>> In message, Roy Smith wrote: >>> 5) real intensity[160.0 : 30.0 : 0.01] >>> >>> How many elements in that array? >>> >>> a) 2999 >>> b) 3000 >>>

Re: 79 chars or more?

2010-08-16 Thread AK
On 08/16/2010 11:51 PM, Steven D'Aprano wrote: On Mon, 16 Aug 2010 22:35:49 -0400, AK wrote: As monitors are getting bigger, is there a general change in opinion on the 79 chars limit in source files? I've experimented with 98 characters per line and I find it quite a bit more comfortable to wo

update of elements in GUI

2010-08-16 Thread Jah_Alarm
hi, I've already asked this question but so far the progress has been small. I'm running Tkinter. I have some elements on the screen (Labels, most importantly) which content has to be updated every iteration of the algorithm run, e.g. "Iteration =" [i] for i in range(n), n=100. I'm using the updat

Re: array manipulation-

2010-08-16 Thread Robert Kern
On 8/16/10 10:07 PM, Aram Ter-Sarkissov wrote: hi, this is probably a very silly question, but I can't get my hear around it unfortunately( I have an array (say, mat=rand(3,5)) from which I 'pull out' a row (say, s1=mat[1,]). The problem is, the shape of this row s1 is not [1,5], as I would expe

Re: Python "why" questions

2010-08-16 Thread Robert Kern
On 8/16/10 9:29 PM, Roy Smith wrote: In article, Lawrence D'Oliveiro wrote: In message, Roy Smith wrote: 5) real intensity[160.0 : 30.0 : 0.01] How many elements in that array? a) 2999 b) 3000 c) neither of the above c) neither of the above. More specifically, 13,001 (if I counted co

Re: 79 chars or more?

2010-08-16 Thread Steven D'Aprano
On Mon, 16 Aug 2010 22:35:49 -0400, AK wrote: > As monitors are getting bigger, is there a general change in opinion on > the 79 chars limit in source files? I've experimented with 98 characters > per line and I find it quite a bit more comfortable to work with that > length, even though sometimes

Re: bash: syntax error near unexpected token

2010-08-16 Thread Benjamin Kaplan
On Mon, Aug 16, 2010 at 11:33 PM, kreglet wrote: > Hello, > > I started learning python last year. All of this time i have used the > terminal and gedit to create, modify, and test my applications and modules. > For some reason I can not do this any more. > I'll try to do my best to explain whats

bash: syntax error near unexpected token

2010-08-16 Thread kreglet
Hello, I started learning python last year. All of this time i have used the terminal and gedit to create, modify, and test my applications and modules. For some reason I can not do this any more. I'll try to do my best to explain whats happening. I have a script modtest.py which has a function t

array manipulation-

2010-08-16 Thread Aram Ter-Sarkissov
hi, this is probably a very silly question, but I can't get my hear around it unfortunately( I have an array (say, mat=rand(3,5)) from which I 'pull out' a row (say, s1=mat[1,]). The problem is, the shape of this row s1 is not [1,5], as I would expect, but rather [5,], which means that I can't, fo

Re: 79 chars or more?

2010-08-16 Thread James Mills
On Tue, Aug 17, 2010 at 12:50 PM, Roy Smith wrote: > I disagree with James.  I have no problem with going wider than 80, if > it improves readability by not forcing you to fold lines in unnatural > places. > > There's more important things to worry about. Roy, under normal circumstances I would a

Re: 79 chars or more?

2010-08-16 Thread AK
On 08/16/2010 10:42 PM, James Mills wrote: On Tue, Aug 17, 2010 at 12:35 PM, AK wrote: As monitors are getting bigger, is there a general change in opinion on the 79 chars limit in source files? I've experimented with 98 characters per line and I find it quite a bit more comfortable to work wit

Re: 79 chars or more?

2010-08-16 Thread Roy Smith
In article , James Mills wrote: > On Tue, Aug 17, 2010 at 12:35 PM, AK wrote: > > As monitors are getting bigger, is there a general change in opinion on > > the 79 chars limit in source files? I've experimented with 98 characters > > per line and I find it quite a bit more comfortable to work

Re: 79 chars or more?

2010-08-16 Thread James Mills
On Tue, Aug 17, 2010 at 12:35 PM, AK wrote: > As monitors are getting bigger, is there a general change in opinion on > the 79 chars limit in source files? I've experimented with 98 characters > per line and I find it quite a bit more comfortable to work with that > length, even though sometimes I

79 chars or more?

2010-08-16 Thread AK
As monitors are getting bigger, is there a general change in opinion on the 79 chars limit in source files? I've experimented with 98 characters per line and I find it quite a bit more comfortable to work with that length, even though sometimes I have to edit files in 80 width terminals, it's stil

Re: Python "why" questions

2010-08-16 Thread Roy Smith
In article , Lawrence D'Oliveiro wrote: > In message , Roy Smith wrote: > > > 5) real intensity[160.0 : 30.0 : 0.01] > > How many elements in that array? > > a) 2999 > b) 3000 > c) neither of the above c) neither of the above. More specifically, 13,001 (if I counted correctly). -- http://

Re: Python "why" questions

2010-08-16 Thread Lawrence D'Oliveiro
In message , Roy Smith wrote: > 5) real intensity[160.0 : 30.0 : 0.01] How many elements in that array? a) 2999 b) 3000 c) neither of the above -- http://mail.python.org/mailman/listinfo/python-list

Re: how to switch image in tkinter? making it mutable? how?

2010-08-16 Thread ChrisChia
On Aug 17, 2:57 am, Jeff Hobbs wrote: > On Aug 16, 7:30 am, ChrisChia wrote: > > > I have this: > > image1 = ImageTk.PhotoImage(file = "c:\\f1.jpg") > > image2 = ImageTk.PhotoImage(file = "c:\\f2.jpg") > > > imagelist.append(image1) > > imagelist.append(image2) > > > self.label  = tk.Label(image

Re: EXOR or symmetric difference for the Counter class

2010-08-16 Thread Raymond Hettinger
[Paddy] > Lets say you have two *sets* of integers representing two near-copies > of some system, then a measure of their difference could be calculated > as: > > len(X.symmetric_difference(Y)) / (len(X) + len(Y)) * 100 % > > If the two collections of integers are allowed duplicates then you > need

2 Regex Questions

2010-08-16 Thread AlphaBravo
Hello Comp.Lang,Python, 1) How do I parse Basic Posix RE's in Python (i need it because of some old scripts and a specific OS developed in Seattle) 2) How can I split a string into sections that MATCH a regex (rather then splitting by seperator). Tokenizer-style but ignoring every place from wh

Re: random number generation

2010-08-16 Thread Raymond Hettinger
On Aug 16, 5:37 pm, Jah_Alarm wrote: > hi, > > I need to generate a binary array with a specified average proportion > of 1s (e.g. [1 0 0 0 > > 0 1 0 0] has this proportion = 25%). In Matlab I run something like > random(m,n) > between 0 and 1. I'm trying to use random.randint(0,2,size=[m,n]), but

Re: How to convert bytearray into integer?

2010-08-16 Thread Jacky
On Aug 17, 3:53 am, Mark Dickinson wrote: > On Aug 16, 8:36 pm, Mark Dickinson wrote: > > > > > > > On Aug 16, 8:08 pm, Jacky wrote: > > > My concern is that struct may need to parse the format string, > > > construct the list, and de-reference index=0 for this generated list > > > to get the in

Re: Python "why" questions

2010-08-16 Thread Roy Smith
In article , Martin Gregorie wrote: > Say you have intensity data captured from an X-ray goniometer from 160 > degrees to 30 degrees at 0.01 degree resolution. Which is most evil of > the following? > > 1) real intensity[16000:3000] >for i from lwb intensity to upb intensity > plot(

Re: How to convert bytearray into integer?

2010-08-16 Thread Jacky
On Aug 17, 3:38 am, Thomas Jollans wrote: > On Monday 16 August 2010, it occurred to Jacky to exclaim: > > > > > > > Hi Thomas, > > > Thanks for your comments!  Please check mine inline. > > > On Aug 17, 1:50 am, Thomas Jollans wrote: > > > On Monday 16 August 2010, it occurred to Jacky to exclai

Re: How to convert bytearray into integer?

2010-08-16 Thread Jacky
Hi Mark, Thanks for your reply. Agree and I'll use your suggestions. Thanks! -Jacky On Aug 17, 3:36 am, Mark Dickinson wrote: > On Aug 16, 8:08 pm, Jacky wrote: > > > Hi Thomas, > > > Thanks for your comments!  Please check mine inline. > > > On Aug 17, 1:50 am, Thomas Jollans wrote: > > >

Re: random number generation

2010-08-16 Thread Brian Blais
On Aug 16, 2010, at 20:37 , Jah_Alarm wrote: hi, I need to generate a binary array with a specified average proportion of 1s (e.g. [1 0 0 0 0 1 0 0] has this proportion = 25%). In Matlab I run something like random(m,n) if you're coming from matlab, then you should use the numpy package (an

random number generation

2010-08-16 Thread Jah_Alarm
hi, I need to generate a binary array with a specified average proportion of 1s (e.g. [1 0 0 0 0 1 0 0] has this proportion = 25%). In Matlab I run something like random(m,n)http://mail.python.org/mailman/listinfo/python-list

Re: EOFError with fileinput

2010-08-16 Thread Steven D'Aprano
On Mon, 16 Aug 2010 19:27:32 +0200, Alex van der Spek wrote: > Here is an excerpt. It works because the end condition is a fixed number > (ln==10255), the approximate number of data lines in a file. If I > replace that condition by EOFError, the program does not do the intended > work. It appears

Re: Textvariable display in label (GUI design)

2010-08-16 Thread Jah_Alarm
On Aug 17, 3:32 am, Eric Brunel wrote: > In article > <993d9560-564d-47f0-b2db-6f0c6404a...@g6g2000pro.googlegroups.com>, > >  Jah_Alarm wrote: > > hi, > > > pls help me out with the following issue: I wrote a function that uses > > a for loop that changes a value of a certain variable each itera

Running pygtk app under windows.

2010-08-16 Thread Sebastian Alonso
Hey everyone, I'm trying to be able to run my app, which uses pygtk, under windows, but unfortunately I'm having big problems with it. The main purpose of this is to later on make an .exe file but i havent even been able to run the app at least. I've followed every single step from this faq

Re: [Q] How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-16 Thread Lawrence D'Oliveiro
In message <5fa7b287-0199-4349-ae0d-c34c8461c...@5g2000yqz.googlegroups.com>, Standish P wrote: > We envisage an exogenous stack which has malloc() associated > with a push and free() associated with a pop. Since when are malloc(3) and free(3) exogenous? -- http://mail.python.org/mailman/listin

Re: Simple Problem but tough for me if i want it in linear time

2010-08-16 Thread Steven D'Aprano
On Mon, 16 Aug 2010 20:40:52 +0200, Frederic Rentsch wrote: > How about > [obj for obj in dataList if obj.number == 100] > > That should create a list of all objects whose .number is 100. No need > to cycle through a loop. What do you think the list comprehension does, if not cycle throug

Re: execfile() and locals()

2010-08-16 Thread fons
On Sun, Aug 15, 2010 at 11:24:25PM +, Steven D'Aprano wrote: > On Sun, 15 Aug 2010 23:21:51 +0200, fons wrote: > > > The documentation on execfile() and locals() makes it clear that code > > executed from execfile() can not modify local variables in the function > > from wich execfile() was c

Re: Python 2.7 re.IGNORECASE broken in re.sub?

2010-08-16 Thread Steven D'Aprano
On Mon, 16 Aug 2010 05:46:17 -0700, Alex Willmer wrote: > On Aug 16, 12:23 pm, Steven D'Aprano cybersource.com.au> wrote: >> On Sun, 15 Aug 2010 17:36:07 -0700, Alex Willmer wrote: >> > On Aug 16, 1:07 am, Steven D'Aprano > > cybersource.com.au> wrote: >> >> You're passing re.IGNORECASE (which ha

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-16 Thread rantingrick
On Aug 8, 8:15 pm, Steven D'Aprano wrote: > On Sun, 08 Aug 2010 17:43:03 -0700, rantingrick wrote: > > Ruby has what they > > call a "Here Doc". Besides picking the most boneheaded name for such an > > object > > It's standard terminology that has been around for a long time in many > different l

Re: question about pdb assignment statements

2010-08-16 Thread Kev Dwyer
On Mon, 16 Aug 2010 08:17:20 -0700, Steve Ferg wrote: > In this little script: > > > import pdb > pdb.set_trace() > def main(): > xm = 123 > print("Hello,world!") > main() > > > When I run this, I use pdb to step through it until I reach the point in > main() where the xm varia

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-16 Thread rantingrick
On Aug 9, 8:19 am, Mike Kent wrote: > On Aug 8, 8:43 pm, rantingrick wrote: > Xah, this is really you, isn't it.  Come on, confess. *MOI*, How could *I* be xah. I really don't like Ruby however he gushes over it all the time. And he does not like Python that much either. We are total opposites,

Re: question about pdb assignment statements

2010-08-16 Thread Kev Dwyer
On Mon, 16 Aug 2010 08:17:20 -0700, Steve Ferg wrote: > In this little script: > > > import pdb > pdb.set_trace() > def main(): > xm = 123 > print("Hello,world!") > main() > > > When I run this, I use pdb to step through it until I reach the point in > main() where the xm varia

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-16 Thread John Posner
On 8/16/2010 4:18 PM, Baba wrote: packages=[2,103,105] min_size=min(packages[0],packages[1],packages[2]) or: min_size = min(packages) -John -- http://mail.python.org/mailman/listinfo/python-list

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-16 Thread Baba
well i still believe that the key is the smallest sized pack and there's no need to go into higher mathematics to solve this problem. I think below code works within the limits of the exercise which states to look at a maximum range of 200 in order not to search forever. packages=[2,103,105] min_s

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-16 Thread Giacomo Boffi
Baba writes: > Hi Mel, > > indeed i thought of generalising the theorem as follows: > If it is possible to buy n, n+1,~, n+(x-1) sets of McNuggets, for some > x, then it is possible to buy any number of McNuggets >= x, given that > McNuggets come in x, y and z packs. > > so with diophantine_nugge

Re: How to convert bytearray into integer?

2010-08-16 Thread Mark Dickinson
On Aug 16, 8:36 pm, Mark Dickinson wrote: > On Aug 16, 8:08 pm, Jacky wrote: > > My concern is that struct may need to parse the format string, > > construct the list, and de-reference index=0 for this generated list > > to get the int out. > > > There should be some way more efficient? > > Well,

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-16 Thread Mel
Baba wrote: [ ... ] > Now, i believe that the number of consecutive passes required to make > this work is equal to the smallest number of pack sizes. So if we have > packs of (9,12,21) the number of passes needed would be 9 and the > theorem would read > > "If it is possible to buy n,n+1,n+2,...n

Re: How to convert bytearray into integer?

2010-08-16 Thread Mark Dickinson
On Aug 16, 8:08 pm, Jacky wrote: > Hi Thomas, > > Thanks for your comments!  Please check mine inline. > > On Aug 17, 1:50 am, Thomas Jollans wrote: > > > On Monday 16 August 2010, it occurred to Jacky to exclaim: > > > > Hi there, > > > > Recently I'm facing a problem to convert 4 bytes on an by

Re: How to convert bytearray into integer?

2010-08-16 Thread Thomas Jollans
On Monday 16 August 2010, it occurred to Jacky to exclaim: > Hi Thomas, > > Thanks for your comments! Please check mine inline. > > On Aug 17, 1:50 am, Thomas Jollans wrote: > > On Monday 16 August 2010, it occurred to Jacky to exclaim: > > > Hi there, > > > > > > Recently I'm facing a problem

Re: How to convert bytearray into integer?

2010-08-16 Thread Jacky
Hi Thomas, Thanks for your comments! Please check mine inline. On Aug 17, 1:50 am, Thomas Jollans wrote: > On Monday 16 August 2010, it occurred to Jacky to exclaim: > > > Hi there, > > > Recently I'm facing a problem to convert 4 bytes on an bytearray into > > an 32-bit integer.  So far as I c

Re: Simple Problem but tough for me if i want it in linear time

2010-08-16 Thread Frederic Rentsch
On Sun, 2010-08-15 at 15:14 +0200, Peter Otten wrote: > ChrisChia wrote: > > > dataList = [a, b, c, ...] > > where a, b, c are objects of a Class X. > > In Class X, it contains self.name and self.number > > > > If i wish to test whether a number (let's say 100) appears in one of > > the object, a

Re: Opposite of split

2010-08-16 Thread John Posner
On 8/16/2010 12:44 PM, Alex van der Spek wrote: Anybody catches any other ways to improve my program (attached), you are most welcome. 1. You don't need to separate out special characters (TABs, NEWLINEs, etc.) in a string. So: bt='-999.25'+'\t''-999.25'+'\t''-999.25'+'\t''-999.25'+'\t'+'

Re: os.stat st_mtime problem

2010-08-16 Thread MRAB
Alban Nona wrote: Hello, Im stuck with this problem: I would like to os.stat st_mtime to copy only the files that have different modification date. so I found something on internet using this kind of line: if os.stat(dest).st_mtime - os.stat(src).st_mtime > 1: shutil.copy2 (src, dst)

Re: Newbie: strftime object error message

2010-08-16 Thread fuglyducky
On Aug 16, 10:27 am, Mark Lawrence wrote: > On 16/08/2010 17:47, fuglyducky wrote: > > > > > I am trying to call a function with a couple additional parameters. > > Unfortunately, for whatever reason I am unable to get this to work. I > > am assuming that line is not passing correctly but I don't

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-16 Thread Standish P
On Aug 16, 12:38 am, "Alf P. Steinbach /Usenet" wrote: > * Standish P, on 16.08.2010 09:20: > > > [garble garble] > > Nonsense article "We look for an exogenous stack" cross-posted to > >    [comp.lang.c], >    [comp.lang.c++], >    [comp.theory], >    [comp.lang.python], >    [comp.lang.forth]. >

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-16 Thread Elizabeth D Rather
On 8/15/10 10:33 PM, Standish P wrote: ... I don't understand a lot of your post (and it's clear that I'm not alone). I don't know whether it's a (human) language problem or simply an issue of your having read too many books and not having enough practical experience, but at least I can try t

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-16 Thread Baba
Hi Chas, Roald, These are all complicated formula that i believe are not expected at this level. If you look at the source (see my first submission) you will see that this exercise is only the second in a series called "Introduction to Programming". Therefore i am convinced that there is a much si

Re: passing variables as object attributes

2010-08-16 Thread Terry Reedy
On 8/16/2010 9:40 AM, Vikas Mahajan wrote: Hello to all I am new to python. Hi, welcome to Python. Hint 1: 'Variable' is a rather loose term with many meanings. Better to think in terms of 'name' ('identifier'), which is specifically defined, and 'object'. I am facing problem to use varia

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-16 Thread Ian Kelly
On Mon, Aug 16, 2010 at 12:43 PM, Roald de Vries wrote: >>> I'm pretty sure that if there's no common divisor for all three (or more) >>> packages (except one), there is a largest unpurchasable quantity. That >>> is: ∀ >>> i>1: ¬(i|a) ∨ ¬(i|b) ∨ ¬(i|c), where ¬(x|y) means "x is no divider of y" >>

Re: How to convert bytearray into integer?

2010-08-16 Thread Thomas Jollans
On Monday 16 August 2010, it occurred to Jacky to exclaim: > Hi there, > > Recently I'm facing a problem to convert 4 bytes on an bytearray into > an 32-bit integer. So far as I can see, there're 3 ways: > a) using struct module, Yes, that's what it's for, and that's what you should be using.

os.stat st_mtime problem

2010-08-16 Thread Alban Nona
Hello, Im stuck with this problem: I would like to os.stat st_mtime to copy only the files that have different modification date. so I found something on internet using this kind of line: if os.stat(dest).st_mtime - os.stat(src).st_mtime > 1: shutil.copy2 (src, dst) So I adapted it to my scri

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-16 Thread cbr...@cbrownsystems.com
On Aug 16, 1:23 am, Roald de Vries wrote: > On Aug 15, 2010, at 11:51 PM, Ian Kelly wrote: > > > > > On Sun, Aug 15, 2010 at 4:36 PM, Baba wrote: > >> Hi Mel, > > >> indeed i thought of generalising the theorem as follows: > >> If it is possible to buy n, n+1,…, n+(x-1) sets of McNuggets, for   >

Re: EOFError with fileinput

2010-08-16 Thread Alex van der Spek
Here is an excerpt. It works because the end condition is a fixed number (ln==10255), the approximate number of data lines in a file. If I replace that condition by EOFError, the program does not do the intended work. It appears as if EOFError is always true in this case. +

Re: Newbie: strftime object error message

2010-08-16 Thread MRAB
fuglyducky wrote: I am trying to call a function with a couple additional parameters. Unfortunately, for whatever reason I am unable to get this to work. I am assuming that line is not passing correctly but I don't understand why??? [snip] The function's parameters are the wrong way round. -- h

Re: Newbie: strftime object error message

2010-08-16 Thread Mark Lawrence
On 16/08/2010 17:47, fuglyducky wrote: I am trying to call a function with a couple additional parameters. Unfortunately, for whatever reason I am unable to get this to work. I am assuming that line is not passing correctly but I don't understand why??? I can't share all of the code because it h

Re: EXOR or symmetric difference for the Counter class

2010-08-16 Thread Paddy
On 14 Aug, 18:14, Raymond Hettinger wrote: > On Aug 12, 1:20 pm, Paddy wrote: > > > I find myself needing to calculate the difference between two Counters > > or multisets or bags. > > > I want those items that are unique to each bag. > > Tell us about your use cases.  I'm curious how a program w

How can I bundle a PyGTK program in windows so my users don't need to install Python or the GTK+ libs?

2010-08-16 Thread Waspinator
I found this question on http://faq.pygtk.org/index.py?file=faq21.005.htp&req=show but the answer did not help me. For example I have a simple program below that I would like to 'compile' with py2exe (or anything else if it's simpler) to run in windows as a single bundled executable file with no

Re: Opposite of split

2010-08-16 Thread D'Arcy J.M. Cain
On Mon, 16 Aug 2010 18:44:08 +0200 "Alex van der Spek" wrote: > Perhaps the ones here who think I was trying to make you do my homework can You keep replying to my message but as I pointed out in my previous message, I'm not the one who thought that you posted a homework question. I'm the one w

Re: python strings and {} in Tkinter entry widgets

2010-08-16 Thread Chris Hare
On Aug 16, 2010, at 11:40 AM, Jeff Hobbs wrote: > On Aug 15, 4:41 pm, Chris Hare wrote: >> I have some code that pulls a value from a database. In this case, it is >> three space delimited words. When I display the value in a Tkinter.Entry >> widget, the text has curly braces around it, even

How to convert bytearray into integer?

2010-08-16 Thread Jacky
Hi there, Recently I'm facing a problem to convert 4 bytes on an bytearray into an 32-bit integer. So far as I can see, there're 3 ways: a) using struct module, b) using ctypes module, and c) manually manipulation. Are there any other ways? My sample is as following: - import struct import

Re: passing variables as object attributes

2010-08-16 Thread Vikas Mahajan
@All Thanks a lot. getattr and setattr functions solved my problem. -- http://mail.python.org/mailman/listinfo/python-list

Re: Opposite of split

2010-08-16 Thread D'Arcy J.M. Cain
On Mon, 16 Aug 2010 18:26:46 +0200 "Alex van der Spek" wrote: > Nope, no homework. This was a serious question from a serious but perhaps > simple physicist who grew up with Algol, FORTRAN and Pascal, taught himself > VB(A) and is looking for a replacement of VB and finding that in Python. You

Re: how to switch image in tkinter? making it mutable? how?

2010-08-16 Thread Jeff Hobbs
On Aug 16, 7:30 am, ChrisChia wrote: > I have this: > image1 = ImageTk.PhotoImage(file = "c:\\f1.jpg") > image2 = ImageTk.PhotoImage(file = "c:\\f2.jpg") > > imagelist.append(image1) > imagelist.append(image2) > > self.label  = tk.Label(image = imagelist[0]) > > is there a way that i can create a

Re: EOFError with fileinput

2010-08-16 Thread Mark Lawrence
On 16/08/2010 17:29, Alex van der Spek wrote: Using the fileinput module to process lists of files: for line in fileinput.input(logs): Unfortunately, EOFError does not seem to indicate the end-of-file condition correctly when using fileinput. How would you find the EOF file for all the files

Newbie: strftime object error message

2010-08-16 Thread fuglyducky
I am trying to call a function with a couple additional parameters. Unfortunately, for whatever reason I am unable to get this to work. I am assuming that line is not passing correctly but I don't understand why??? I can't share all of the code because it has IP in it but below are the pertinent s

Re: Opposite of split

2010-08-16 Thread Alex van der Spek
Perhaps the ones here who think I was trying to make you do my homework can actually help me for real. Since I run my own company (not working for any of the big ones) I can't afford official training in anything. So I teach myself, help is always welcome and sought for. If that feels like doing

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-16 Thread Roald de Vries
On Aug 16, 2010, at 5:04 PM, Ian Kelly wrote: On Mon, Aug 16, 2010 at 4:23 AM, Roald de Vries wrote: I suspect that there exists a largest unpurchasable quantity iff at least two of the pack quantities are relatively prime, but I have made no attempt to prove this. That for sure is not co

Re: python strings and {} in Tkinter entry widgets

2010-08-16 Thread Jeff Hobbs
On Aug 15, 4:41 pm, Chris Hare wrote: > I have some code that pulls a value from a database.  In this case, it is > three space delimited words.  When I display the value in a Tkinter.Entry > widget, the text has curly braces around it, even when there are none in the > surrounding the text in

EOFError with fileinput

2010-08-16 Thread Alex van der Spek
Using the fileinput module to process lists of files: for line in fileinput.input(logs): Unfortunately, EOFError does not seem to indicate the end-of-file condition correctly when using fileinput. How would you find the EOF file for all the files in the file list 'logs'? Thank you, Alex va

Re: Opposite of split

2010-08-16 Thread Alex van der Spek
Thanks much, Nope, no homework. This was a serious question from a serious but perhaps simple physicist who grew up with Algol, FORTRAN and Pascal, taught himself VB(A) and is looking for a replacement of VB and finding that in Python. You can guess my age now. Most of my work I do in R nowa

Re: passing variables as object attributes

2010-08-16 Thread Jean-Michel Pichavant
Vikas Mahajan wrote: On 16 August 2010 19:23, Nitin Pawar wrote: you would need to define a class first with its attiributes and then you may want to initiate the variables by calling the class initilializer Actually I have to dynamically add attributes to a object. I am writing pytho

Re: Pop return from stack?

2010-08-16 Thread Carey Tilden
On Mon, Aug 16, 2010 at 4:18 AM, Steven D'Aprano wrote: > > On Sun, 15 Aug 2010 21:01:04 -0700, Carey Tilden wrote: > >> On Sun, Aug 15, 2010 at 6:43 PM, bvdp wrote: >> >>> Not to belabor the point .. but "func" is not a standard lib module. >>> It's part of a much larger application ... and in t

Re: Deditor -- pythonic text-editor

2010-08-16 Thread Kruptein
on steven, peter and eliasf: Well okay I'm new to the world of developing programs, if I encounter problems I directly post a bug on the relevant page, that's maybe why I was a bit frustrated :) but what you three say is indeed true.. -- http://mail.python.org/mailman/listinfo/python-list

Re: Dump logging configuration

2010-08-16 Thread Kxepal
On Aug 16, 6:53 pm, Jean-Michel Pichavant wrote: > Jean-Michel Pichavant wrote: > > Kxepal wrote: > >> Hi all! > >> Sorry for dumb question if it is - I'd tried to google it before but > >> have found nothing. > > >> Is there any way todumpcurrentloggingconfiguration for future > >> loading it via

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-16 Thread Ian Kelly
On Mon, Aug 16, 2010 at 11:04 AM, Ian Kelly wrote: > On Mon, Aug 16, 2010 at 4:23 AM, Roald de Vries wrote: >>> I suspect that there exists a largest unpurchasable quantity iff at >>> least two of the pack quantities are relatively prime, but I have made >>> no attempt to prove this. >> >> That f

Re: passing variables as object attributes

2010-08-16 Thread misterdi
On Aug 16, 8:40 pm, Vikas Mahajan wrote: > Hello to all > > I am new to python. I am facing problem to use variables as object > attributes. I have to use loop and dynamically add attributes to a > object and for this purpose I have to use variables with object names. > > For example-: > Let us sa

Re: Textvariable display in label (GUI design)

2010-08-16 Thread Eric Brunel
In article <993d9560-564d-47f0-b2db-6f0c6404a...@g6g2000pro.googlegroups.com>, Jah_Alarm wrote: > hi, > > pls help me out with the following issue: I wrote a function that uses > a for loop that changes a value of a certain variable each iteration. > What I want is by clicking a button in GUI

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-16 Thread Malcolm McLean
On Aug 16, 3:14 pm, spinoza wrote: > > To build an explicit stack in this program would have been folly, for > it would have been necessary to either preallocate the stack and thus > legislate the maximum complexity of source code, or use a lot of > memory management in the pre-existing runtim

Re: how to switch image in tkinter? making it mutable? how?

2010-08-16 Thread Eric Brunel
In article <414ff6dd-73ef-48df-bd2b-080a2c710...@h17g2000pri.googlegroups.com>, ChrisChia wrote: > I have this: > image1 = ImageTk.PhotoImage(file = "c:\\f1.jpg") > image2 = ImageTk.PhotoImage(file = "c:\\f2.jpg") > > imagelist.append(image1) > imagelist.append(image2) > > self.label = tk.La

question about pdb assignment statements

2010-08-16 Thread Steve Ferg
In this little script: import pdb pdb.set_trace() def main(): xm = 123 print("Hello,world!") main() When I run this, I use pdb to step through it until I reach the point in main() where the xm variable has been initialized, and then I try to use pdb to reset the value of xm, and

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-16 Thread Ian Kelly
On Mon, Aug 16, 2010 at 4:23 AM, Roald de Vries wrote: >> I suspect that there exists a largest unpurchasable quantity iff at >> least two of the pack quantities are relatively prime, but I have made >> no attempt to prove this. > > That for sure is not correct; packs of 2, 4 and 7 do have a large

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-16 Thread jacko
> is it possible to convert any and all algorithms to stack based ones and thus > avoid memory leaks? No, not really. If you keep the allocated things and free them in reverse order on exit, then well yes, but practically, early free() frees memory for reuse on low memory systems. In this sense n

Re: Dump logging configuration

2010-08-16 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: Kxepal wrote: Hi all! Sorry for dumb question if it is - I'd tried to google it before but have found nothing. Is there any way to dump current logging configuration for future loading it via fileConfig/dictConfig? I may be wrong but I don't think so. JM Please

how to switch image in tkinter? making it mutable? how?

2010-08-16 Thread ChrisChia
I have this: image1 = ImageTk.PhotoImage(file = "c:\\f1.jpg") image2 = ImageTk.PhotoImage(file = "c:\\f2.jpg") imagelist.append(image1) imagelist.append(image2) self.label = tk.Label(image = imagelist[0]) is there a way that i can create a method to switch the display the image2 (imagelist 2nd

Re: passing variables as object attributes

2010-08-16 Thread nn
On Aug 16, 10:08 am, Vikas Mahajan wrote: > On 16 August 2010 19:23, Nitin Pawar wrote:> you > would need to define a class first with its attiributes and then you may > > want to initiate the variables by calling the class initilializer > > Actually I have to dynamically add attributes to a obj

Re: passing variables as object attributes

2010-08-16 Thread nn
On Aug 16, 10:08 am, Vikas Mahajan wrote: > On 16 August 2010 19:23, Nitin Pawar wrote:> you > would need to define a class first with its attiributes and then you may > > want to initiate the variables by calling the class initilializer > > Actually I have to dynamically add attributes to a obj

does someone has a binary 32-bit windows installer for arac ?

2010-08-16 Thread Stef Mientki
thanks, Stef Mientki -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >