Re: Naming Conventions, Where's the Convention Waldo?

2010-07-11 Thread Terry Reedy
On 7/11/2010 3:26 AM, rantingrick wrote: Another source of asininity seems to be the naming conventions of the Python language proper! True/False start with an upper case and i applaud this. However str, list, tuple, int, float --need i go on...?-- start with lowercase. This is an anomaly, kno

Re: Learn Python the Hard Way (online tutorial)

2010-07-11 Thread Stephen Hansen
On 7/11/10 10:59 PM, Chris Rebert wrote: > On Sun, Jul 11, 2010 at 10:03 PM, Paul Rubin wrote: >> I just came across this, a python tutorial purportedly intended for >> beginning programmers. I only read the first few pages and I'm not >> crazy about the approach, but I haven't seen it mentioned

Re: Easy questions from a python beginner

2010-07-11 Thread Terry Reedy
On 7/11/2010 1:48 PM, wheres pythonmonks wrote: 2. How can I write a function, "def swap(x,y):..." so that "x = 3; y = 7; swap(x,y);" given x=7,y=3?? (I want to use Perl's Ref "\" operator, or C's&). (And if I cannot do this [other than creating an Int class], is this behavior limited to string

Re: Easy questions from a python beginner

2010-07-11 Thread Steven D'Aprano
On Sun, 11 Jul 2010 21:52:17 -0700, sturlamolden wrote: > On 11 Jul, 21:37, "Alf P. Steinbach /Usenet" +use...@gmail.com> wrote: > >> Oh, I wouldn't give that advice. It's meaningless mumbo-jumbo. Python >> works like Java in this respect, that's all; neither Java nor Python >> support 'swap'. >

Re: Learn Python the Hard Way (online tutorial)

2010-07-11 Thread Chris Rebert
On Sun, Jul 11, 2010 at 10:03 PM, Paul Rubin wrote: > I just came across this, a python tutorial purportedly intended for > beginning programmers.  I only read the first few pages and I'm not > crazy about the approach, but I haven't seen it mentioned here, and some > folks might like it: > >  htt

Re: Easy questions from a python beginner

2010-07-11 Thread Alf P. Steinbach /Usenet
* sturlamolden, on 12.07.2010 06:52: On 11 Jul, 21:37, "Alf P. Steinbach /Usenet" wrote: Oh, I wouldn't give that advice. It's meaningless mumbo-jumbo. Python works like Java in this respect, that's all; neither Java nor Python support 'swap'. x,y = y,x We're talking about defining a 'swa

Re: Easy questions from a python beginner

2010-07-11 Thread Stephen Hansen
On 7/11/10 7:25 PM, Alf P. Steinbach /Usenet wrote: > The alleged facts etc. you're referring are just that, alleged, by you. Two people come together and have a debate. Both present arguments. Both present cases. In the end, they are still in disagreement. You declare us, "religious", and theref

Re: Why doesn't python's list append() method return the list itself?

2010-07-11 Thread Chris Rebert
On Sun, Jul 11, 2010 at 10:03 PM, Nathan Rice wrote: > Yeah, I long ago filed the in place place in the same folder as > all() returning True for an empty iterable If you weren't taught about vacuous truth (or even identity elements) in Discrete Mathematics, someone fscked up. Said behavior is t

Re: Why doesn't python's list append() method return the list itself?

2010-07-11 Thread Stephen Hansen
On 7/11/10 10:03 PM, Nathan Rice wrote: > Yeah, I long ago filed the in place place in the same folder as > strings-as-sequences, all() returning True for an empty iterable and any > returning True rather than the thing which triggered it. You know, the latter two I can see an argument for, and co

Learn Python the Hard Way (online tutorial)

2010-07-11 Thread Paul Rubin
I just came across this, a python tutorial purportedly intended for beginning programmers. I only read the first few pages and I'm not crazy about the approach, but I haven't seen it mentioned here, and some folks might like it: http://learnpythonthehardway.org/home -- http://mail.python.org/m

Re: Why doesn't python's list append() method return the list itself?

2010-07-11 Thread Nathan Rice
Yeah, I long ago filed the in place place in the same folder as strings-as-sequences, all() returning True for an empty iterable and any returning True rather than the thing which triggered it. Almost always annoying and worked around, but that's the price you pay for the other nice stuff :) It j

Re: Easy questions from a python beginner

2010-07-11 Thread sturlamolden
On 11 Jul, 21:37, "Alf P. Steinbach /Usenet" wrote: > Oh, I wouldn't give that advice. It's meaningless mumbo-jumbo. Python works > like > Java in this respect, that's all; neither Java nor Python support 'swap'. x,y = y,x -- http://mail.python.org/mailman/listinfo/python-list

Re: IOError and Try Again to loop the loop.

2010-07-11 Thread Chris Rebert
> On Jul 12, 2:14 pm, Chris Rebert wrote: >> On Sun, Jul 11, 2010 at 8:13 PM, The Danny Bos wrote: >> > Thanks gang, >> > I'm gonna paste what I've put together, doesn't seem right. Am I way >> > off? >> >> > Here's my code. >> >  - It goes through a table Item >> >  - Matches that Item ID to an

Re: IOError and Try Again to loop the loop.

2010-07-11 Thread The Danny Bos
Thanks Chris, Agreed some of the code is a lot useless, I need to go through that stuff. So something like this (apologies for asking for some details, I'm not good at catching): items = Item.objects.all().filter(cover='').order_by('-reference_id') for item in items: url = "http://someaddre

[Python-ideas] explicitation lines in python ?

2010-07-11 Thread geremy condra
On Sun, Jul 11, 2010 at 11:39 PM, Carl M. Johnson wrote: > On Sun, Jun 27, 2010 at 8:25 PM, Nick Coghlan wrote: > >> The availability of "nonlocal" binding semantics also makes the >> semantics much easier to define than they were in those previous >> discussions (the lack of clear semantics for

Re: IOError and Try Again to loop the loop.

2010-07-11 Thread Chris Rebert
On Sun, Jul 11, 2010 at 8:13 PM, The Danny Bos wrote: > Thanks gang, > I'm gonna paste what I've put together, doesn't seem right. Am I way > off? > > Here's my code. >  - It goes through a table Item >  - Matches that Item ID to an API call >  - Grabs the data, saves it and creates the thumbnail

Re: Easy questions from a python beginner

2010-07-11 Thread geremy condra
On Sun, Jul 11, 2010 at 10:39 PM, Steven D'Aprano wrote: > On Mon, 12 Jul 2010 03:12:10 +0200, Alf P. Steinbach /Usenet wrote: > >> * MRAB, on 12.07.2010 00:37: > [...] >>> In Java a variable is declared and exists even before the first >>> assignment to it. In Python a 'variable' isn't declared a

Re: Getting started with python on macintosh snow leopard with mysql - need help

2010-07-11 Thread Benjamin Kaplan
On Sun, Jul 11, 2010 at 1:18 PM, dk wrote: > I have been going round and round trying to configure python 2.6 > running on osx 10.6.x to work with mySQL 5.1.44. > Python seems to work ... i have an installation of mysql 5.1.44 > running and have used it in conjunction for other php/apache projects

Re: IOError and Try Again to loop the loop.

2010-07-11 Thread The Danny Bos
Thanks gang, I'm gonna paste what I've put together, doesn't seem right. Am I way off? Here's my code. - It goes through a table Item - Matches that Item ID to an API call - Grabs the data, saves it and creates the thumbnail - It dies due to Timeouts and Other baloney, all silly, nothing code

Re: Errno 9] Bad file descriptor

2010-07-11 Thread Steven D'Aprano
On Sun, 11 Jul 2010 17:48:40 -0700, joblack wrote: > I get sometimes a > > Errno 9 Bad file descriptor > > the code is too long to show it here You can at least show the actual line that fails. Are you trying to open a file, a named socket, a pipe or a device? > but what are the circumstanc

Re: Easy questions from a python beginner

2010-07-11 Thread Alf P. Steinbach /Usenet
* MRAB, on 12.07.2010 04:09: Alf P. Steinbach /Usenet wrote: * MRAB, on 12.07.2010 00:37: Alf P. Steinbach /Usenet wrote: * Stephen Hansen, on 11.07.2010 21:00: On 7/11/10 11:45 AM, wheres pythonmonks wrote: Follow-up: Is there a way to define compile-time constants in python and have the by

Re: Naming Conventions, Where's the Convention Waldo?

2010-07-11 Thread Steven D'Aprano
On Mon, 12 Jul 2010 02:40:07 +, Steven D'Aprano wrote: > On Mon, 12 Jul 2010 01:31:14 +0100, Mark Lawrence wrote: > >> Well said Steven, or is it Stephen, or Stephan, or Stefen, or what? > > For some reason, when I answer the phone and say "Hello, Steven > speaking?" I often get called Peter

Re: Naming Conventions, Where's the Convention Waldo?

2010-07-11 Thread Steven D'Aprano
On Mon, 12 Jul 2010 01:31:14 +0100, Mark Lawrence wrote: > Well said Steven, or is it Stephen, or Stephan, or Stefen, or what? For some reason, when I answer the phone and say "Hello, Steven speaking?" I often get called Peter. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Easy questions from a python beginner

2010-07-11 Thread Steven D'Aprano
On Mon, 12 Jul 2010 03:12:10 +0200, Alf P. Steinbach /Usenet wrote: > * MRAB, on 12.07.2010 00:37: [...] >> In Java a variable is declared and exists even before the first >> assignment to it. In Python a 'variable' isn't declared and won't exist >> until the first 'assignment' to it. > > That is

Re: IOError and Try Again to loop the loop.

2010-07-11 Thread Alex Hall
It seems like seeing the code, or at least the bit in question, would be easier, but what about: for img in range(0, len(imagesToUpload:)) try: #do the thumbnail / upload thing on images[i] exceptIOError: i=0 This will duplicate a lot of the images already processed, but you said you are ju

Re: IOError and Try Again to loop the loop.

2010-07-11 Thread MRAB
The Danny Bos wrote: Heya, I'm running a py script that simply grabs an image, creates a thumbnail and uploads it to s3. I'm simply logging into ssh and running the script through Terminal. It works fine, but gives me an IOError every now and then. I was wondering if I can catch this error and

Re: IOError and Try Again to loop the loop.

2010-07-11 Thread Chris Rebert
On Sun, Jul 11, 2010 at 7:15 PM, The Danny Bos wrote: > Heya, > > I'm running a py script that simply grabs an image, creates a > thumbnail and uploads it to s3. I'm simply logging into ssh and > running the script through Terminal. It works fine, but gives me an > IOError every now and then. > >

Re: Easy questions from a python beginner

2010-07-11 Thread Alf P. Steinbach /Usenet
* Stephen Hansen, on 12.07.2010 04:02: On 7/11/10 6:12 PM, Alf P. Steinbach /Usenet wrote: However, as stated up-thread, I do not expect facts, logic or general reasoning to have any effect whatsoever on such hard-core religious beliefs. Grow up, and/or get a grip, and/or get over yourself. E

IOError and Try Again to loop the loop.

2010-07-11 Thread The Danny Bos
Heya, I'm running a py script that simply grabs an image, creates a thumbnail and uploads it to s3. I'm simply logging into ssh and running the script through Terminal. It works fine, but gives me an IOError every now and then. I was wondering if I can catch this error and just get the script to

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-11 Thread Steven D'Aprano
On Sun, 11 Jul 2010 17:35:18 -0700, rantingrick wrote: > On Jul 11, 7:02 pm, Steven D'Aprano cybersource.com.au> wrote: > >> Come back when you have profiled your code and can prove that the cost >> of building empty tuples is an actual bottleneck. > > Did you even read this thread, i mean from

Re: Easy questions from a python beginner

2010-07-11 Thread MRAB
Alf P. Steinbach /Usenet wrote: * MRAB, on 12.07.2010 00:37: Alf P. Steinbach /Usenet wrote: * Stephen Hansen, on 11.07.2010 21:00: On 7/11/10 11:45 AM, wheres pythonmonks wrote: Follow-up: Is there a way to define compile-time constants in python and have the bytecode compiler optimize away

Re: Easy questions from a python beginner

2010-07-11 Thread Stephen Hansen
On 7/11/10 6:12 PM, Alf P. Steinbach /Usenet wrote: > However, as stated up-thread, I do not expect facts, logic or general > reasoning to have any effect whatsoever on such hard-core religious > beliefs. Grow up, and/or get a grip, and/or get over yourself. Everyone who disagreed with you, disa

Re: grailbrowser now running under python 2.5 (probably above too)

2010-07-11 Thread Stephen Hansen
On 7/11/10 6:10 PM, rantingrick wrote: > On Jul 11, 7:31 pm, Stephen Hansen wrote: > > You said about macs... >> Copying a file without the resource fork on a mac, *can* result in >> essential data being lost (This is less common then it used to be). As >> simple a task as chown/chmod for posix s

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-11 Thread Brendon Wickham
"i had once considered you one of the foremost intelligent minds within this group. However, after your display within this thread i am beginning to doubt my original beliefs of you." "Oh ... grow a spine already, really. I can't help but thinking of the spineless Robert Ford every time you open y

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-11 Thread Stephen Hansen
On 7/11/10 5:51 PM, rantingrick wrote: > On Jul 11, 7:23 pm, Steven D'Aprano cybersource.com.au> wrote: >> On Sun, 11 Jul 2010 16:22:41 -0700, rantingrick wrote: >>> On Jul 11, 1:19 pm, Mark Dickinson wrote: >> Okay. What fix do you propose? Would your fix maintain the identity "0 ==

Re: Easy questions from a python beginner

2010-07-11 Thread Alf P. Steinbach /Usenet
* MRAB, on 12.07.2010 00:37: Alf P. Steinbach /Usenet wrote: * Stephen Hansen, on 11.07.2010 21:00: On 7/11/10 11:45 AM, wheres pythonmonks wrote: Follow-up: Is there a way to define compile-time constants in python and have the bytecode compiler optimize away expressions like: if is_my_extra

Re: grailbrowser now running under python 2.5 (probably above too)

2010-07-11 Thread rantingrick
On Jul 11, 7:31 pm, Stephen Hansen wrote: You said about macs... > Copying a file without the resource fork on a mac, *can* result in > essential data being lost (This is less common then it used to be). As > simple a task as chown/chmod for posix systems to take ownership of a > file and make it

Re: Why doesn't python's list append() method return the list itself?

2010-07-11 Thread Raymond Hettinger
On Jul 11, 8:59 am, dhruvbird wrote: > Why doesn't python's list append() method return the list itself? For > that matter, even the reverse() and sort() methods? Because Guido thinks that having those methods return None is the best way to communicate that the underlying object has been mutated

Problems running VirtualEnv under Windows.

2010-07-11 Thread ashconnor
Hello, After reading 'Practical Django Projects' I decided that I want to implement the VirtualEnv tip suggested in order to properly segregate code/modules in different projects. I am however having problems with my django installations not using site-packages within the virtualenv but rather att

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-11 Thread rantingrick
On Jul 11, 7:23 pm, Steven D'Aprano wrote: > On Sun, 11 Jul 2010 16:22:41 -0700, rantingrick wrote: > > On Jul 11, 1:19 pm, Mark Dickinson wrote: > > >> Okay.  What fix do you propose?  Would your fix maintain the identity > >> "0 == False"? > > > No because all integers should bool True. An inte

Errno 9] Bad file descriptor

2010-07-11 Thread joblack
I get sometimes a Errno 9 Bad file descriptor the code is too long to show it here but what are the circumstances this could happen? A web search showed nothing. I have especially the feeling Python 2.6 has some problems with Unicode ... and might not find the file. Is that possible? -- http://

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-11 Thread rantingrick
On Jul 11, 7:18 pm, Mark Lawrence wrote: > +1 Oh mark grow a spine already, really. I can't help but thinking of the spineless Robert Ford every time you open your mouth. -- http://mail.python.org/mailman/listinfo/python-list

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-11 Thread rantingrick
On Jul 11, 7:02 pm, Steven D'Aprano wrote: > Come back when you have profiled your code and > can prove that the cost of building empty tuples is an actual bottleneck. Did you even read this thread, i mean from head to tail. I NEVER said building EMPTY tuples was the cause of my rant. My complai

Re: Why doesn't python's list append() method return the list itself?

2010-07-11 Thread News123
dhruvbird wrote: > > On a side note, is there any other way to append to a list using > slices (apart from the one below): > x[len(x):len(x)] = [item to append] dy you mean x.extend([1,2,3]) ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Naming Conventions, Where's the Convention Waldo?

2010-07-11 Thread Mark Lawrence
On 12/07/2010 01:06, Steven D'Aprano wrote: On Sun, 11 Jul 2010 00:26:36 -0700, rantingrick wrote: Another source of asininity seems to be the naming conventions of the Python language proper! True/False start with an upper case and i applaud this. However str, list, tuple, int, float --need i

Re: grailbrowser now running under python 2.5 (probably above too)

2010-07-11 Thread Stephen Hansen
On 7/11/10 5:01 PM, rantingrick wrote: > On Jul 11, 11:57 am, Stephen Hansen wrote: >> On 7/11/10 9:31 AM, Thomas Jollans wrote: >>> trying to >>> support both UNIX and Windows is NOT a good idea. >> >> And you can't lump the Mac in with "UNIX" here, even though it really is >> UNIX at the foundat

Re: Why doesn't python's list append() method return the list itself?

2010-07-11 Thread Steven D'Aprano
On Sun, 11 Jul 2010 08:59:06 -0700, dhruvbird wrote: > Why doesn't python's list append() method return the list itself? For > that matter, even the reverse() and sort() methods? I found this link > (http://code.google.com/edu/languages/google-python- class/lists.html) > which suggests that this i

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-11 Thread Steven D'Aprano
On Sun, 11 Jul 2010 16:22:41 -0700, rantingrick wrote: > On Jul 11, 1:19 pm, Mark Dickinson wrote: > >> Okay.  What fix do you propose?  Would your fix maintain the identity >> "0 == False"? > > No because all integers should bool True. An integer is a value that IS > NOT empty Integers aren'

Re: grailbrowser now running under python 2.5 (probably above too)

2010-07-11 Thread rantingrick
On Jul 11, 5:28 pm, Fuzzyman wrote: > But why hijack someone else's announcement to do that? Congratulations > alone would have been great. However good your intentions your message > came across as "but it would really have been better if you had been > doing something else instead...". Micheal

Re: grailbrowser now running under python 2.5 (probably above too)

2010-07-11 Thread Steven D'Aprano
On Sun, 11 Jul 2010 18:31:39 +0200, Thomas Jollans wrote: > Cross platform file manager. Hmm. Does "cross platform" involve UNIX and > something that isn't UNIX, say, Windows? Erm, no. No, no, no. It won't > work. Well, it would work, but it wouldn't be any good. The UNIX and > Windows concepts of

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-11 Thread Mark Lawrence
On 12/07/2010 01:02, Steven D'Aprano wrote: On Sat, 10 Jul 2010 23:50:05 -0700, rantingrick wrote: You do realize that Python must build a tuple for ever conditional that uses this semantic? This is more bad, bad, bad than integer bool-ing! My bin packer could potentially compute millions of pa

Re: Naming Conventions, Where's the Convention Waldo?

2010-07-11 Thread Steven D'Aprano
On Sun, 11 Jul 2010 00:26:36 -0700, rantingrick wrote: > Another source of asininity seems to be the naming conventions of the > Python language proper! True/False start with an upper case and i > applaud this. However str, list, tuple, int, float --need i go on...?-- > start with lowercase. > >

Re: Naming Conventions, Where's the Convention Waldo?

2010-07-11 Thread Steven D'Aprano
On Sun, 11 Jul 2010 01:30:36 -0700, rantingrick wrote: > On Jul 11, 3:03 am, "Günther Dietrich" wrote: > >> So, it is not a disadvantage that the functions you listed above are >> named in this way. In the contrary, it is an advantage, as it keeps >> newcomers from using stupid variable names. >

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-11 Thread Steven D'Aprano
On Sat, 10 Jul 2010 23:50:05 -0700, rantingrick wrote: > You do realize that > Python must build a tuple for ever conditional that uses this semantic? > This is more bad, bad, bad than integer bool-ing! My bin packer could > potentially compute millions of parts. I do not want to waste valuable >

Re: grailbrowser now running under python 2.5 (probably above too)

2010-07-11 Thread rantingrick
On Jul 11, 11:57 am, Stephen Hansen wrote: > On 7/11/10 9:31 AM, Thomas Jollans wrote: > > trying to > > support both UNIX and Windows is NOT a good idea. > > And you can't lump the Mac in with "UNIX" here, even though it really is > UNIX at the foundation, because there's some very fundamental >

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-11 Thread geremy condra
On Sun, Jul 11, 2010 at 7:22 PM, rantingrick wrote: > On Jul 11, 1:19 pm, Mark Dickinson wrote: > >> Okay.  What fix do you propose?  Would your fix maintain the identity >> "0 == False"? > > No because all integers should bool True. An integer is a value that > IS NOT empty and IS NOT None. Ther

Re: grailbrowser now running under python 2.5 (probably above too)

2010-07-11 Thread rantingrick
On Jul 11, 11:31 am, Thomas Jollans wrote: > On 07/11/2010 07:44 AM, rantingrick wrote: > > Congratulations on this effort Luke. However you know what project i > > would really like to see the community get around? ...dramatic pause > > here... a cross platform Python file browser! > > Cross pla

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-11 Thread rantingrick
On Jul 11, 1:19 pm, Mark Dickinson wrote: > Okay.  What fix do you propose?  Would your fix maintain the identity > "0 == False"? No because all integers should bool True. An integer is a value that IS NOT empty and IS NOT None. Therefore the only logical way to handle integer bool-ing is to say

Re: grailbrowser now running under python 2.5 (probably above too)

2010-07-11 Thread MRAB
John Bokma wrote: Thomas Jollans writes: On 07/11/2010 07:44 AM, rantingrick wrote: On Jul 10, 10:59 pm, Luke Kenneth Casson Leighton wrote: source at:http://github.com/lkcl/grailbrowser $ python grail.py (note the lack of "python1.5" or "python2.4") conversion of the 80 or so regex's to

Re: grailbrowser now running under python 2.5 (probably above too)

2010-07-11 Thread Martin P. Hellwig
On 07/11/10 04:59, Luke Kenneth Casson Leighton wrote: source at: http://github.com/lkcl/grailbrowser $ python grail.py (note the lack of "python1.5" or "python2.4") conversion of the 80 or so regex's to re has been carried out. entirely successfully or not is a matter yet to be determined. al

Re: Naming Conventions, Where's the Convention Waldo?

2010-07-11 Thread rantingrick
On Jul 11, 12:23 pm, MRAB wrote: > If you're so unhappy with Python, why don't you create your own > language. I suggest the name "Rantthon". Ah yes, then i can finally assume my worthy title of the "Ranting Dictator For Life"! ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Easy questions from a python beginner

2010-07-11 Thread MRAB
Alf P. Steinbach /Usenet wrote: * Stephen Hansen, on 11.07.2010 21:00: On 7/11/10 11:45 AM, wheres pythonmonks wrote: Follow-up: Is there a way to define compile-time constants in python and have the bytecode compiler optimize away expressions like: if is_my_extra_debugging_on: print ... when

Re: grailbrowser now running under python 2.5 (probably above too)

2010-07-11 Thread Fuzzyman
On Jul 11, 5:16 pm, rantingrick wrote: > On Jul 11, 9:01 am, a...@pythoncraft.com (Aahz) wrote: > > > As usual, you would rather tell other people what to do instead of doing > > any work yourself. > > Dear God! My statement was intended to fetch responses like... > >   "Hey, that sounds like a gr

Re: how to determine whether pathname1 is below bathname2

2010-07-11 Thread Dan Stromberg
You could probably: cd to dir1 getcwd cd to dir2 getcwd repeat cd .. getcwd if getcwd == dir1's cwd, then under until at / cd to dir1 repeat cd .. getcwd if getcwd == dir2's cwd, then under until at / This should deal with symlinks and junctions, as long as you aren't worried

Re: Possible to create a read-only complex object?

2010-07-11 Thread Chris Rebert
On Sun, Jul 11, 2010 at 9:51 AM, wrote: > I have a complex object with attributes that contain lists, sets, > dictionaries, and other objects. The lists and dictionaries may themselves > contain complex objects. > > I would like to provide a read-only version of this type of object for other > de

Re: Easy questions from a python beginner

2010-07-11 Thread News123
Chris Rebert wrote: > On Sun, Jul 11, 2010 at 2:08 PM, News123 wrote: >> Carl Banks wrote: >>> On Jul 11, 10:48 am, wheres pythonmonks >>> wrote: I'm an old Perl-hacker, and am trying to Dive in Python. >>> Welcome to the light. >>> >>> I have some easy issues (Python 2.6) wh

Re: Easy questions from a python beginner

2010-07-11 Thread Chris Rebert
On Sun, Jul 11, 2010 at 2:08 PM, News123 wrote: > Carl Banks wrote: >> On Jul 11, 10:48 am, wheres pythonmonks >> wrote: >>> I'm an old Perl-hacker, and am trying to Dive in Python. >> >> Welcome to the light. >> >> >>>  I have some >>> easy issues (Python 2.6) >>> which probably can be answered

Re: Easy questions from a python beginner

2010-07-11 Thread News123
Carl Banks wrote: > On Jul 11, 10:48 am, wheres pythonmonks > wrote: >> I'm an old Perl-hacker, and am trying to Dive in Python. > > Welcome to the light. > > >> I have some >> easy issues (Python 2.6) >> which probably can be answered in two seconds: >> >> 1. Why is it that I cannot use prin

Re: Easy questions from a python beginner

2010-07-11 Thread Carl Banks
On Jul 11, 11:45 am, wheres pythonmonks wrote: > On #4:  So there are some hacks, but not something as easy as "import > unimportable" or an @noexport decorator.  The underscore works, so > does "del". Careful. If you have a module that looks like this: def foo(): bar() def bar(): pri

Re: Easy questions from a python beginner

2010-07-11 Thread Carl Banks
On Jul 11, 10:48 am, wheres pythonmonks wrote: > I'm an old Perl-hacker, and am trying to Dive in Python. Welcome to the light. > I have some > easy issues (Python 2.6) > which probably can be answered in two seconds: > > 1.  Why is it that I cannot use print in booleans??  e.g.: > > >>> True a

Re: grailbrowser now running under python 2.5 (probably above too)

2010-07-11 Thread John Bokma
Thomas Jollans writes: > On 07/11/2010 07:44 AM, rantingrick wrote: >> On Jul 10, 10:59 pm, Luke Kenneth Casson Leighton >> wrote: >>> source at:http://github.com/lkcl/grailbrowser >>> >>> $ python grail.py (note the lack of "python1.5" or "python2.4") >>> >>> conversion of the 80 or so regex's

Getting started with python on macintosh snow leopard with mysql - need help

2010-07-11 Thread dk
I have been going round and round trying to configure python 2.6 running on osx 10.6.x to work with mySQL 5.1.44. Python seems to work ... i have an installation of mysql 5.1.44 running and have used it in conjunction for other php/apache projects. I want to learn python and think i need a better

Re: Easy questions from a python beginner

2010-07-11 Thread Alf P. Steinbach /Usenet
* Stephen Hansen, on 11.07.2010 21:00: On 7/11/10 11:45 AM, wheres pythonmonks wrote: Follow-up: Is there a way to define compile-time constants in python and have the bytecode compiler optimize away expressions like: if is_my_extra_debugging_on: print ... when "is_my_extra_debugging" is set t

Re: Easy questions from a python beginner

2010-07-11 Thread Thomas Jollans
On 07/11/2010 08:45 PM, wheres pythonmonks wrote: > Thanks for your answers -- it is much appreciated. > > On #1: I had very often used chained logic with both logging and > functional purposes in Perl, and wanted to duplicate this in Python. > "It reads like english" Using the print_ print wrap

Re: Easy questions from a python beginner

2010-07-11 Thread Stephen Hansen
On 7/11/10 11:45 AM, wheres pythonmonks wrote: > Follow-up: > Is there a way to define compile-time constants in python and have the > bytecode compiler optimize away expressions like: > > if is_my_extra_debugging_on: print ... > > when "is_my_extra_debugging" is set to false? I'd like to pay no

Re: Easy questions from a python beginner

2010-07-11 Thread wheres pythonmonks
Thanks for your answers -- it is much appreciated. On #1: I had very often used chained logic with both logging and functional purposes in Perl, and wanted to duplicate this in Python. "It reads like english" Using the print_ print wrapper works for me. Follow-up: Is there a way to define compi

Re: Easy questions from a python beginner

2010-07-11 Thread Stephen Hansen
On 7/11/10 10:48 AM, wheres pythonmonks wrote: > I'm an old Perl-hacker, and am trying to Dive in Python. I have some > easy issues (Python 2.6) > which probably can be answered in two seconds: > > 1. Why is it that I cannot use print in booleans?? e.g.: True and print "It is true!" Becau

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-11 Thread Mark Dickinson
On Jul 11, 6:38 am, rantingrick wrote: > Seems kinda dumb to build a tuple just so a conditional wont blow > chunks! This integer bool-ing need to be fixed right away! Okay. What fix do you propose? Would your fix maintain the identity "0 == False"? For bonus points, explain how you'd deal with

Re: Easy questions from a python beginner

2010-07-11 Thread Duncan Booth
wheres pythonmonks wrote: > I'm an old Perl-hacker, and am trying to Dive in Python. I have some > easy issues (Python 2.6) > which probably can be answered in two seconds: > > 1.  Why is it that I cannot use print in booleans??  e.g.: True and print "It is true!" > > I found a nice work-

Re: Easy questions from a python beginner

2010-07-11 Thread Michael Torrie
On 07/11/2010 11:48 AM, wheres pythonmonks wrote: > I'm an old Perl-hacker, and am trying to Dive in Python. I have some > easy issues (Python 2.6) > which probably can be answered in two seconds: > > 1. Why is it that I cannot use print in booleans?? e.g.: True and print "It is true!" Th

Re: Why doesn't python's list append() method return the list itself?

2010-07-11 Thread dhruvbird
On Jul 11, 9:19 pm, Thomas Jollans wrote: > On 07/11/2010 05:59 PM, dhruvbird wrote: > > > Why doesn't python's list append() method return the list itself? For > > that matter, even the reverse() and sort() methods? > > I found this link (http://code.google.com/edu/languages/google-python- > > cl

Re: Easy questions from a python beginner

2010-07-11 Thread Thomas Jollans
On 07/11/2010 07:48 PM, wheres pythonmonks wrote: > I'm an old Perl-hacker, and am trying to Dive in Python. I have some > easy issues (Python 2.6) > which probably can be answered in two seconds: > > 1. Why is it that I cannot use print in booleans?? e.g.: True and print "It is true!" pr

Easy questions from a python beginner

2010-07-11 Thread wheres pythonmonks
I'm an old Perl-hacker, and am trying to Dive in Python. I have some easy issues (Python 2.6) which probably can be answered in two seconds: 1.  Why is it that I cannot use print in booleans??  e.g.: >>> True and print "It is true!" I found a nice work-around using eval(compile(.,"","exec"))

Re: Why doesn't python's list append() method return the list itself?

2010-07-11 Thread MRAB
Thomas Jollans wrote: On 07/11/2010 05:59 PM, dhruvbird wrote: Why doesn't python's list append() method return the list itself? For that matter, even the reverse() and sort() methods? I found this link (http://code.google.com/edu/languages/google-python- class/lists.html) which suggests that th

Re: Naming Conventions, Where's the Convention Waldo?

2010-07-11 Thread MRAB
rantingrick wrote: Another source of asininity seems to be the naming conventions of the Python language proper! True/False start with an upper case and i applaud this. However str, list, tuple, int, float --need i go on...?-- start with lowercase. Q: Well what the hell is your problem Rick. Who

Re: Why doesn't python's list append() method return the list itself?

2010-07-11 Thread Antoine Pitrou
On Sun, 11 Jul 2010 08:59:06 -0700 (PDT) dhruvbird wrote: > Why doesn't python's list append() method return the list itself? For > that matter, even the reverse() and sort() methods? > I found this link (http://code.google.com/edu/languages/google-python- > class/lists.html) which suggests that t

Re: grailbrowser now running under python 2.5 (probably above too)

2010-07-11 Thread Stephen Hansen
On 7/11/10 9:31 AM, Thomas Jollans wrote: > Cross platform file manager. Hmm. Does "cross platform" involve UNIX and > something that isn't UNIX, say, Windows? > Erm, no. No, no, no. It won't work. Well, it would work, but it wouldn't > be any good. The UNIX and Windows concepts of "file system" ar

Possible to create a read-only complex object?

2010-07-11 Thread python
I have a complex object with attributes that contain lists, sets, dictionaries, and other objects. The lists and dictionaries may themselves contain complex objects. I would like to provide a read-only version of this type of object for other developers to query for reporting. Is there a way to p

Re: Why doesn't python's list append() method return the list itself?

2010-07-11 Thread Thomas Jollans
On 07/11/2010 06:28 PM, Nathan Rice wrote: > Do list(reversed(list(reversed([1, 2, 3, 4])) + [[]])) > > Though TBH sometimes get annoyed at this behavior myself. There are a > lot of people who are very vocal in support of returning none, and it > makes sense in some ways. Since reversed returns

Re: Plot problem.. ?? No sign at all

2010-07-11 Thread Ritchy lelis
On 11 jul, 13:28, Johan Grönqvist wrote: > 2010-07-11 02:12, Ritchy lelis skrev: > > > On 7 jul, 08:38, Johan Grönqvist  wrote: > > > About the plot draw it's a curve that it's a set of points wich it's > > the result of the comput of the Vref and Vi together. I don't know if > > i had to make a b

Re: grailbrowser now running under python 2.5 (probably above too)

2010-07-11 Thread Thomas Jollans
On 07/11/2010 07:44 AM, rantingrick wrote: > On Jul 10, 10:59 pm, Luke Kenneth Casson Leighton > wrote: >> source at:http://github.com/lkcl/grailbrowser >> >> $ python grail.py (note the lack of "python1.5" or "python2.4") >> >> conversion of the 80 or so regex's to re has been carried out. >> ent

Re: Why doesn't python's list append() method return the list itself?

2010-07-11 Thread Nathan Rice
Do list(reversed(list(reversed([1, 2, 3, 4])) + [[]])) Though TBH sometimes get annoyed at this behavior myself. There are a lot of people who are very vocal in support of returning none, and it makes sense in some ways. Since reversed returns an iterator though, it makes this code horrible and

Re: Why doesn't python's list append() method return the list itself?

2010-07-11 Thread Thomas Jollans
On 07/11/2010 05:59 PM, dhruvbird wrote: > Why doesn't python's list append() method return the list itself? For > that matter, even the reverse() and sort() methods? > I found this link (http://code.google.com/edu/languages/google-python- > class/lists.html) which suggests that this is done to mak

Re: grailbrowser now running under python 2.5 (probably above too)

2010-07-11 Thread rantingrick
On Jul 11, 9:01 am, a...@pythoncraft.com (Aahz) wrote: > As usual, you would rather tell other people what to do instead of doing > any work yourself. Dear God! My statement was intended to fetch responses like... "Hey, that sounds like a great idea" or \ "Hey, lets get hacking on this". I

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-11 Thread Michael Torrie
On 07/11/2010 12:50 AM, rantingrick wrote: > Ah yes, when nothing else seems to work fall back to you default > programming... FUD and ad hominem attacks Please stop calling things what they are not. Stephen's post was not an ad hominem attack, nor was it FUD. Someone who is countering your pre

Why doesn't python's list append() method return the list itself?

2010-07-11 Thread dhruvbird
Why doesn't python's list append() method return the list itself? For that matter, even the reverse() and sort() methods? I found this link (http://code.google.com/edu/languages/google-python- class/lists.html) which suggests that this is done to make sure that the programmer understands that the l

I wish for a tool named "2to6".

2010-07-11 Thread Zooko O'Whielacronx
Folks: I have been (I admit it) a Python 3 skeptic. I even speculated that the Python 3 backward-incompatibility would lead to the obsolescence of Python: http://pubgrid.tahoe-lafs.org/uri/URI:DIR2-RO:ixqhc4kdbjxc7o65xjnveoewym:5x6lwoxghrd5rxhwunzavft2qygfkt27oj3fbxlq4c6p45z5uneq/blog.html Howev

Re: Naming Conventions, Where's the Convention Waldo?

2010-07-11 Thread News123
Andreas Waldenburger wrote: > > Having capitalized boolean values ... that is a bit odd, but as long as > children are starving in Africa, this isn't very high on my gripe-list. > +1 -- http://mail.python.org/mailman/listinfo/python-list

Re: how to determine whether pathname1 is below bathname2

2010-07-11 Thread Gelonida
Hi Thomas, Thomas Jollans wrote: > On 07/11/2010 03:37 PM, Gelonida wrote: >> # >> import os >> def is_below_dir(fname,topdir): >> relpath = os.path.relpath(fname,topdir) >> return not relpath.startswith('..'+os.sep) >> >> print is_below_dir(

Re: Naming Conventions, Where's the Convention Waldo?

2010-07-11 Thread Andreas Waldenburger
On Sun, 11 Jul 2010 15:46:40 +0200 News123 wrote: > Andre Alexander Bell wrote: > > On 07/11/2010 10:30 AM, rantingrick wrote: > > >>> So, it is not a disadvantage that the functions you listed above > >>> are named in this way. In the contrary, it is an advantage, as it > >>> keeps newcomers fr

  1   2   >