Re: Multi-dimensional list initialization

2012-11-06 Thread Demian Brecht
On 2012-11-06, at 5:55 PM, Steven D'Aprano wrote: > I'm not entirely sure what your point is here. The OP screwed up -- he > didn't generate a 4-dimensional array. He generated a 2-dimensional > array. If his intuition about the number of dimensions is so poor, why > should his intuition abou

Re: Logging output to be redirected to a particular folder

2012-11-06 Thread anuradha . raghupathy2010
Thanks ...this works perfectly fine now. On Tuesday, November 6, 2012 11:28:46 PM UTC+5:30, Prasad, Ramit wrote: > Dennis Lee Bieber wrote: > > > > > > On Tue, 06 Nov 2012 13:26:11 +0100, Peter Otten <__pete...@web.de> > > > declaimed the following in gmane.comp.python.general: > > > > > >

Re: Obnoxious postings from Google Groups

2012-11-06 Thread Roy Smith
In article , Gregory Ewing wrote: > Steven D'Aprano wrote: > > The downside is that if spaces are not argument separators, then you need > > something else to be an argument separator. Or you need argument > > delimiters. Or strings need to be quoted. Programming languages do these > > things

Re: Obnoxious postings from Google Groups

2012-11-06 Thread Gregory Ewing
Steven D'Aprano wrote: The downside is that if spaces are not argument separators, then you need something else to be an argument separator. Or you need argument delimiters. Or strings need to be quoted. Programming languages do these things because they are designed to be correct. Shell do not

Re: Coordination between developers in the Python project

2012-11-06 Thread Gregory Ewing
Ian Kelly wrote: Although I find it a bit easier to just use something like unshorten.com, which is the first Google hit for "url unshortener". Assuming that you trust that site to not be hosting malware itself. :-) Ah yes, beware the Hungarian unshortening service that redirects every request

Re: Multi-dimensional list initialization

2012-11-06 Thread Gregory Ewing
If anything is to be done in this area, it would be better as an extension of list comprehensions, e.g. [[None times 5] times 10] which would be equivalent to [[None for _i in xrange(5)] for _j in xrange(10)] -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Multi-dimensional list initialization

2012-11-06 Thread Gregory Ewing
Roy Smith wrote: Call by social network? The called function likes the object. Depending on how it feels, it can also comment on some of the object's attributes. And then finds that it has inadvertently shared all its private data with other functions accessing the object. -- Greg -- http:/

Re: How to specify a field name dynamically

2012-11-06 Thread jack
On 2012/11/7 11:36, Dave Angel wrote: On 11/06/2012 10:14 PM, jack wrote: I have three tables: What's a table? I'll assume you're using Python, but what version, and what extra libraries do you have installed ? At least show your import statements, so we might have a chance at guessing. I'll as

Re: Multi-dimensional list initialization

2012-11-06 Thread Roy Smith
In article <5099ec1d$0$21759$c3e8da3$76491...@news.astraweb.com>, Steven D'Aprano wrote: > On Wed, 07 Nov 2012 00:23:44 +, MRAB wrote: > > >> Incorrect. Python uses what is commonly known as call-by-object, not > >> call-by-value or call-by-reference. Passing the list by value would > >>

Re: Multi-dimensional list initialization

2012-11-06 Thread Steven D'Aprano
On Wed, 07 Nov 2012 00:23:44 +, MRAB wrote: >> Incorrect. Python uses what is commonly known as call-by-object, not >> call-by-value or call-by-reference. Passing the list by value would >> imply that the list is copied, and that appends or removes to the list >> inside the function would no

Re: Multi-dimensional list initialization

2012-11-06 Thread rusi
On Nov 7, 5:26 am, MRAB wrote: > I prefer the term "reference semantics". Ha! That hits the nail on the head. To go back to the OP: On Nov 5, 11:28 am, Demian Brecht wrote: > So, here I was thinking "oh, this is a nice, easy way to initialize a 4D > matrix" (running 2.7.3, non-core libs not a

Re: multiprocessing help

2012-11-06 Thread Terry Reedy
On 11/6/2012 11:04 PM, Terry Reedy wrote: On 11/6/2012 7:52 PM, Stephen Bunn wrote: I'm looking for some help with multiprocessing. Questions about using Python go to python-list. python-dev is for developing future versions of Python. My apologies. I intended to and thought I had opened pyt

Re: multiprocessing help

2012-11-06 Thread Terry Reedy
On 11/6/2012 7:52 PM, Stephen Bunn wrote: I'm looking for some help with multiprocessing. Questions about using Python go to python-list. python-dev is for developing future versions of Python. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: How to specify a field name dynamically

2012-11-06 Thread Dave Angel
On 11/06/2012 10:14 PM, jack wrote: > I have three tables: What's a table? I'll assume you're using Python, but what version, and what extra libraries do you have installed ? At least show your import statements, so we might have a chance at guessing. I'll assume the db stands for database, but wh

How to specify a field name dynamically

2012-11-06 Thread jack
I have three tables: table1 |———| | id | f1 | |———| table2 |———| | id | f2 | |———| table3 |———| | id | f3 | |———| I want define a function to insert records to someone,but

Re: Base class and Derived class question

2012-11-06 Thread alex23
On Nov 7, 1:08 am, cyberira...@gmail.com wrote: > Just got answer, I didn't call a class it's self.  Correct code is: > class derivedClass(baseClassMod.baseClass): >     def .. Incidentally, this is why it's recommended to give modules lowercase names - baseclass - and classes camelcased ones

Re: Multi-dimensional list initialization

2012-11-06 Thread Steven D'Aprano
On Tue, 06 Nov 2012 14:41:24 -0800, Andrew Robinson wrote: > Yes. But this isn't going to cost any more time than figuring out > whether or not the list multiplication is going to cause quirks, itself. > Human psychology *tends* (it's a FAQ!) to automatically assume the > purpose of the list mul

multiprocessing help

2012-11-06 Thread Stephen Bunn
I'm looking for some help with multiprocessing. Essentially what I'm trying to do is the following: 1. create a main process that gets daemonized 2. spawn two subprocess that live for the life of the daemon 3. each subprocess creates children that do heavy work and exit when the work is don

Re: Obnoxious postings from Google Groups

2012-11-06 Thread GangGreene
On Tue, 06 Nov 2012 23:14:40 +, Steven D'Aprano wrote: > On Tue, 06 Nov 2012 11:51:03 -0500, GangGreene wrote: > >> I have just finished a 251 line bash shell script that builds my linux >> distro from scratch. > > "From scratch"? So if you run it on bare metal with no OS, it works? It has

Re: Multi-dimensional list initialization

2012-11-06 Thread MRAB
On 2012-11-06 23:52, Ian Kelly wrote: On Tue, Nov 6, 2012 at 3:41 PM, Andrew Robinson wrote: Q: What about other mutable objects like sets or dicts? A: No, the elements are never copied. They aren't list multiplication compatible in any event! It's a total nonsense objection. If th

Re: Obnoxious postings from Google Groups

2012-11-06 Thread Steven D'Aprano
On Tue, 06 Nov 2012 23:08:11 +, Prasad, Ramit wrote: > Steven D'Aprano wrote: >> >> On Tue, 06 Nov 2012 17:16:44 +, Prasad, Ramit wrote: >> >> >> To enter the newline, I typed Ctrl-Q to tell bash to treat the next >> >> character as a literal, and then typed Ctrl-J to get a newline. >> >

RE: How to only get a list of the names of the non-directory files in current directory ('.')?

2012-11-06 Thread Prasad, Ramit
iMath wrote: > how to get a list of names of everything in the current directory ? http://lmgtfy.com/?q=python+get+files+in+directory ~Ramit This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and

Re: Multi-dimensional list initialization

2012-11-06 Thread Ian Kelly
On Tue, Nov 6, 2012 at 3:41 PM, Andrew Robinson wrote: >> Q: What about other mutable objects like sets or dicts? >> A: No, the elements are never copied. > > They aren't list multiplication compatible in any event! It's a total > nonsense objection. > > If these are inconsistent in my i

RE: Multi-dimensional list initialization

2012-11-06 Thread Prasad, Ramit
Andrew Robinson wrote: > > On 11/06/2012 01:04 AM, Steven D'Aprano wrote: > > On Mon, 05 Nov 2012 21:51:24 -0800, Andrew Robinson wrote: > > [snip] > > Q: What about other mutable objects like sets or dicts? > > A: No, the elements are never copied. > They aren't list multiplication comp

Re: clicking on turtle

2012-11-06 Thread Steven D'Aprano
On Tue, 06 Nov 2012 22:13:21 +0100, python wrote: > I have a problem with the standard "turtle" module. When a turtle has a > custom shape of type "compound", it doesn't seem to respond to click > events. No problem with polygon shapes. [...] > When I run this and click on the black square (i.e. t

Re: How to only get a list of the names of the non-directory files in current directory ('.')?

2012-11-06 Thread John Gordon
In iMath writes: > how to get a list of names of everything in the current directory ? Try os.listdir() . -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey,

Re: Obnoxious postings from Google Groups

2012-11-06 Thread Steven D'Aprano
On Tue, 06 Nov 2012 11:51:03 -0500, GangGreene wrote: > I have just finished a 251 line bash shell script that builds my linux > distro from scratch. "From scratch"? So if you run it on bare metal with no OS, it works? :-P But seriously -- bash is a mature, powerful shell. It works well for wha

Re: How to only get a list of the names of the non-directory files in current directory ('.')?

2012-11-06 Thread iMath
在 2012年11月6日星期二UTC+8下午1时24分41秒,Chris Angelico写道: > On Tue, Nov 6, 2012 at 4:19 PM, iMath wrote: > > > How to only get a list of the names of the non-directory files in current > > directory ('.')? > > > (Note excluding its subdirectories ). > > > > > > I need the code : ) > > > > Start by

RE: Obnoxious postings from Google Groups

2012-11-06 Thread Prasad, Ramit
Steven D'Aprano wrote: > > On Tue, 06 Nov 2012 17:16:44 +, Prasad, Ramit wrote: > > >> To enter the newline, I typed Ctrl-Q to tell bash to treat the next > >> character as a literal, and then typed Ctrl-J to get a newline. > > > > That sounds complicated, my version of bash lets me type > >

Re: Obnoxious postings from Google Groups

2012-11-06 Thread Steven D'Aprano
On Tue, 06 Nov 2012 17:16:44 +, Prasad, Ramit wrote: >> To enter the newline, I typed Ctrl-Q to tell bash to treat the next >> character as a literal, and then typed Ctrl-J to get a newline. > > That sounds complicated, my version of bash lets me type > 'foobar' for the same effect. Well, I

Re: Multi-dimensional list initialization

2012-11-06 Thread Andrew Robinson
On 11/06/2012 01:04 AM, Steven D'Aprano wrote: On Mon, 05 Nov 2012 21:51:24 -0800, Andrew Robinson wrote: The most compact notation in programming really ought to reflect the most *commonly* desired operation. Otherwise, we're really just making people do extra typing for no reason. There are

Re: Multi-dimensional list initialization

2012-11-06 Thread Ian Kelly
On Tue, Nov 6, 2012 at 2:36 PM, Andrew Robinson wrote: > I meant all lists are shallow copied from the innermost level out. > Equivalently, it's a deep copy of list objects -- but a shallow copy of any > list contents except other lists. Why only list objects, though? When a user writes [[]] *

Re: Multi-dimensional list initialization

2012-11-06 Thread Andrew Robinson
On 11/06/2012 01:19 AM, Ian Kelly wrote: On Tue, Nov 6, 2012 at 1:21 AM, Andrew Robinson If you nest it another time; [[[None]]]*4, the same would happen; all lists would be independent -- but the objects which aren't lists would be refrenced-- not copied. a=[[["alpha","beta"]]]*4 would yield:

Re: Multi-dimensional list initialization

2012-11-06 Thread Andrew Robinson
On 11/06/2012 09:32 AM, Prasad, Ramit wrote: Ian Kelly wrote: On Tue, Nov 6, 2012 at 1:21 AM, Andrew Robinson [snip] See if you can find *any* python program where people desired the multiplication to have the die effect that changing an object in one of the sub lists -- changes all the objec

Re: Multi-dimensional list initialization

2012-11-06 Thread Andrew Robinson
On 11/06/2012 06:35 AM, Oscar Benjamin wrote: > In general, people don't use element multiplication (that I have *ever* seen) to make lists where all elements of the outer most list point to the same sub-*list* by reference. The most common use of the multiplication is to fill an array with

clicking on turtle

2012-11-06 Thread Nicolas Graner
I have a problem with the standard "turtle" module. When a turtle has a custom shape of type "compound", it doesn't seem to respond to click events. No problem with polygon shapes. Running python 3.2.3, turtle version 1.1b on Windows XP. Here is my test file:

clicking on turtle

2012-11-06 Thread python
I have a problem with the standard "turtle" module. When a turtle has a custom shape of type "compound", it doesn't seem to respond to click events. No problem with polygon shapes. Running python 3.2.3, turtle version 1.1b on Windows XP. Here is my test file:

Re: error

2012-11-06 Thread woooee
>From this line, "data" appears to be a class if 0 < ix < data.width and 0 < iy < data.height: >From this line, "data" appears to be a list, although a two dimensional list would be accessed as data[ix][iy]         point = data[ix, iy] Also, returning a list from a function is a matter of pref

RE: who can give me some practical tutorials on django 1.4 or 1.5?

2012-11-06 Thread Prasad, Ramit
Levi Nie wrote: > > Who can give me some practical tutorials on django 1.4 or 1.5? > Thank you. Maybe this will help: http://gettingstartedwithdjango.com/resources/ ~Ramit This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sa

RE: Logging output to be redirected to a particular folder

2012-11-06 Thread Prasad, Ramit
Dennis Lee Bieber wrote: > > On Tue, 06 Nov 2012 13:26:11 +0100, Peter Otten <__pete...@web.de> > declaimed the following in gmane.comp.python.general: > > > anuradha.raghupathy2...@gmail.com wrote: [snip] > > > def main(): > > >logging.basicConfig(Filename='c://myapp.log', level=logging.ERRO

RE: Multi-dimensional list initialization

2012-11-06 Thread Prasad, Ramit
Ian Kelly wrote: > > On Tue, Nov 6, 2012 at 1:21 AM, Andrew Robinson > [snip] > > See if you can find *any* python program where people desired the > > multiplication to have the die effect that changing an object in one of the > > sub lists -- changes all the objects in the other sub lists. > >

RE: Obnoxious postings from Google Groups

2012-11-06 Thread Prasad, Ramit
Steven D'Aprano wrote: > > On Mon, 05 Nov 2012 14:47:47 -0500, Dennis Lee Bieber wrote: > [snip] > > Nevertheless, I do tend to prefer underscores to spaces, simply because I > often use naive tools that treat spaces as separators. That is, command > line shells. I visually prefer spaces but it

Re: Obnoxious postings from Google Groups

2012-11-06 Thread GangGreene
On Tue, 06 Nov 2012 08:52:36 -0500, Roy Smith wrote: [putolin] > Programming languages are designed to write programs. Not only will the > code be {used, read, maintained} for a much longer period of time, it > will be used by people other than the original author, and on inputs > other than ori

RE: Obnoxious postings from Google Groups

2012-11-06 Thread Prasad, Ramit
Grant Edwards wrote: > On 2012-11-05, Roy Smith wrote: > > In article , > > Chris Angelico wrote: > > > >> It's nothing to do with operating system. File names are names, and > >> spaces in them are seldom worth the hassle unless you manipulate those > >> files solely using a GUI. > > > > That's

Re: What the diferences : web.py Tornado Twisted ?!

2012-11-06 Thread filipp
On 2012-11-02 15:50:30 +, nepaul said: What the diferences : web.py Tornado Twisted ?! There really is a lot of material on this online, including numerous videos. But in my experience Tornado is basically a (really cool and easy to use) programmable web server whereas Twisted is a frame

Re: Base class and Derived class question

2012-11-06 Thread Hans Mulder
On 6/11/12 14:47:03, cyberira...@gmail.com wrote: > Hey guys, > I'm trying to understand how is working base class and derived class. > So, I have to files baseClass.py and derivedClass.py. > baseClass.py : > [CODE]class baseClass(): > def bFunction(self): > print "We are in a base cl

Re: Base class and Derived class question

2012-11-06 Thread cyberirakli
On Tuesday, November 6, 2012 4:35:47 PM UTC+1, Ian wrote: > On Tue, Nov 6, 2012 at 8:03 AM, > > > I've used angle brackets just for posting here,becauze this forum doesn't > > support [code][/code] > > > > This is a Usenet group, not a web forum. > > > > > Just got answer, I didn't call a

Re: Base class and Derived class question

2012-11-06 Thread Ian Kelly
On Tue, Nov 6, 2012 at 8:03 AM, wrote: > I've used angle brackets just for posting here,becauze this forum doesn't > support [code][/code] This is a Usenet group, not a web forum. > Just got answer, I didn't call a class it's self. Correct code is: > class derivedClass(baseClassMod.baseClass)

Re: Base class and Derived class question

2012-11-06 Thread cyberirakli
Just got answer, I didn't call a class it's self. Correct code is: class derivedClass(baseClassMod.baseClass): def .. -- http://mail.python.org/mailman/listinfo/python-list

Re: Base class and Derived class question

2012-11-06 Thread cyberirakli
> in what Python version ? Python 2.7.3 > How did all those angle brackets get into the file? Are you confusing > > an interactive interpreter session with running source files? I've used angle brackets just for posting here,becauze this forum doesn't support [code][/code] I have a file c

Re: delete value in list in indexing

2012-11-06 Thread Mark Lawrence
On 06/11/2012 06:17, Amit Agrawal wrote: i want to delete list in upper and lower some specific value I think you want to delete a slice so read about slicing here http://docs.python.org/3/library/stdtypes.html#sequence-types-list-tuple-range -- Cheers. Mark Lawrence. -- http://mail.py

Re: Multi-dimensional list initialization

2012-11-06 Thread Oscar Benjamin
On Nov 6, 2012 6:00 AM, "Andrew Robinson" wrote: > > On 11/05/2012 06:30 PM, Oscar Benjamin wrote: >> >> stuff = [[obj] * n] * m >> >> I thought that the multiplication of the inner list ([obj] * n) by m >> could create a new list of lists using copies. On closer inspection I >> see that the l

Re: Base class and Derived class question

2012-11-06 Thread Dave Angel
On 11/06/2012 08:50 AM, cyberira...@gmail.com wrote: > Hey guys, > I'm trying to understand how is working base class and derived class. in what Python version ? > So, I have to files baseClass.py and derivedClass.py. > baseClass.py : class baseClass(): How did all those angle brackets get

Re: delete value in list in indexing

2012-11-06 Thread Dave Angel
On 11/06/2012 01:17 AM, Amit Agrawal wrote: > i want to delete list in upper and lower some specific value > > That question will have to be rephrased, in clearer English. What Python version are you using? What data do you start with, and what data do you want to end up with? Be specific w

Re: Obnoxious postings from Google Groups

2012-11-06 Thread Roy Smith
In article <50989a16$0$29980$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Shell do not [quote strings, etc] because they > are designed for lazy users and merely aim to be "good enough". Well, sort of. Or, perhaps more correctly, "Yes, but that's a good thing". Shells are d

Base class and Derived class question

2012-11-06 Thread cyberirakli
Hey guys, I'm trying to understand how is working base class and derived class. So, I have to files baseClass.py and derivedClass.py. baseClass.py : >>> class baseClass(): def bFunction(self): print "We are in a base class" derivedClass.py: >>>import baseClass as baseClassMod reload(

Base class and Derived class question

2012-11-06 Thread cyberirakli
Hey guys, I'm trying to understand how is working base class and derived class. So, I have to files baseClass.py and derivedClass.py. baseClass.py : [CODE]class baseClass(): def bFunction(self): print "We are in a base class"[/CODE] derivedClass.py: [CODE]import baseClass as baseClas

RE: Multi-dimensional list initialization

2012-11-06 Thread Shambhu Rajak
Well said Steve, I agree with you... -Shambhu -Original Message- From: Steven D'Aprano [mailto:steve+comp.lang.pyt...@pearwood.info] Sent: Tuesday, November 06, 2012 2:35 PM To: python-list@python.org Subject: Re: Multi-dimensional list initialization On Mon, 05 Nov 2012 21:51:24 -0800,

Re: error

2012-11-06 Thread Dave Angel
On 11/06/2012 07:31 AM, inshu chauhan wrote: > I am getting this error while running my programme.. : > > error: index is out of range Please paste the whole error, including the traceback. It'll show you the line that had the error, as well as the calling sequence that got you there. > > I can

error

2012-11-06 Thread inshu chauhan
I am getting this error while running my programme.. : error: index is out of range I cannot find a valid reason for it in my prog can somebody suggest what may be possible reasons for this error.. The part of the code is : def addpoints (data, points, ix, iy): # makes a list of relevant point

Re: Logging output to be redirected to a particular folder

2012-11-06 Thread Peter Otten
anuradha.raghupathy2...@gmail.com wrote: > Hi, > > Below is the python code that I have. I want to redirect the output to my > C drive..myapp.log. > > I am editing and creating scripts in IDLE and running it as a python shell > or module. > > Can you help? > > import logging > > def main(): >

Logging output to be redirected to a particular folder

2012-11-06 Thread anuradha . raghupathy2010
Hi, Below is the python code that I have. I want to redirect the output to my C drive..myapp.log. I am editing and creating scripts in IDLE and running it as a python shell or module. Can you help? import logging def main(): logging.basicConfig(Filename='c://myapp.log', level=logging.ERR

Re: py2exe with python 3.x

2012-11-06 Thread Tobias Marquardt
Am 05.11.2012 20:39, schrieb Kwpolska: On Mon, Nov 5, 2012 at 8:34 PM, Monkey wrote: Hi, i wonderd if there is a way to convert a py-file to a exe-file with version 3.x of python. I know that it was possible till version 2.7.x. But is there a way to do it in version 3.x? Yours sincerely, Mo

Re: Multi-dimensional list initialization

2012-11-06 Thread Ian Kelly
On Tue, Nov 6, 2012 at 1:21 AM, Andrew Robinson wrote: > If you nest it another time; > [[[None]]]*4, the same would happen; all lists would be independent -- but > the objects which aren't lists would be refrenced-- not copied. > > a=[[["alpha","beta"]]]*4 would yield: > a=[[['alpha', 'beta']], [

Re: Multi-dimensional list initialization

2012-11-06 Thread Steven D'Aprano
On Mon, 05 Nov 2012 21:51:24 -0800, Andrew Robinson wrote: > The most compact notation in programming really ought to reflect the > most *commonly* desired operation. Otherwise, we're really just making > people do extra typing for no reason. There are many reasons not to put minimizing of typin

Re: Coordination between developers in the Python project

2012-11-06 Thread Chris Angelico
On Tue, Nov 6, 2012 at 7:49 PM, Ian Kelly wrote: > On Mon, Nov 5, 2012 at 3:01 PM, Chris Angelico wrote: >> By "URL unshortening service" you mean a simple HTTP request to >> bit.ly:80, right? :) Though I admit there aren't many easy and >> convenient ways to do that without immediately following

Re: Multi-dimensional list initialization

2012-11-06 Thread Andrew Robinson
On 11/05/2012 10:07 PM, Chris Angelico wrote: On Tue, Nov 6, 2012 at 4:51 PM, Andrew Robinson wrote: I really don't think doing a shallow copy of lists would break anyone's program. Well, it's a change, a semantic change. It's almost certainly going to break _something_. But for the sake of a