Re: [Tutor] How to deploy Django project in Google App Engine
Date: Sat, 26 May 2012 09:40:03 -0400 From: bgai...@gmail.com To: sur...@live.com CC: tutor@python.org Subject: Re: [Tutor] How to deploy Django project in Google App Engine On 5/26/2012 5:41 AM, Surya K wrote: I wrote a Django project and would like to deploy on Google App Engine. I searched a lot on net and couldn't find a proper tutorial till now. So, can any one explain me?? Did you look at http://www.allbuttonspressed.com/blog/django/2010/01/Native-Django-on-App-Engine? -- Bob Gailer 919-636-4239 Chapel Hill NC This seems to be a nice articles stating directly.. but I have one problem.1. In the test app, the project hierarchy is something like this:/ "project files" - setting.py, __init__.py, manage.py, etc.. However, the Django's dir hierarchy in my PC (i.e, Django 1.4) is quite different./ , manage.py - __init__.py, settings.py, views.py etc... so, where should I store those folders mentioned in the website http://www.allbuttonspressed.com/blog/django/2010/01/Native-Django-on-App-Engine? Thanks Surya ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How to deploy Django project in Google App Engine
On 5/28/2012 3:46 AM, Surya K wrote: I have one problem. 1. In the test app, the project hierarchy is something like this: / "project files" - setting.py, __init__.py, manage.py, etc.. However, the Django's dir hierarchy in my PC (i.e, Django 1.4) is quite different. / , manage.py - __init__.py, settings.py, views.py etc... so, where should I store those folders mentioned in the website http://www.allbuttonspressed.com/blog/django/2010/01/Native-Django-on-App-Engine? AI am a relative newbie to Django - and I don't know. I recommend asking on a django mailing list such as django-us...@googlegroups.com. Thanks Surya -- Bob Gailer 919-636-4239 Chapel Hill NC ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] manipulating data to delete blank spaces
Hi, I'd like to eliminate the no data fields in this XML file, since Tableau, the graphing software doesn't allow this. What would be the easiest way to approach this? I'm a complete neophyte, having gone through the first 15 chapters of the "Think Like a Computer Scientist." Long ways to go and appreciate any help. Cheers. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] manipulating data to delete blank spaces
On 28/05/12 23:15, Brendan Dornan wrote: Hi, I’d like to eliminate the no data fields in this XML file, since Tableau, the graphing software doesn’t allow this. What would be the easiest way to approach this? I’m a complete neophyte, having gone through the first 15 chapters of the “Think Like a Computer Scientist.” Long ways to go and appreciate any help. Cheers. Ummm, what XML file? Maybe it got stripped in transit, or maybe you forgot to attach it. Or if its big can you put it on a pastebin? -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Concatenating Strings
I am trying to understand the point behind using the '+' character when trying to concatenate strings. I am new to learning Python and going through the book "Python Programming for Absolute Beginners 3rd ed." and do not understand the point or reason for concatenating strings. The reason I do not understand is when experimenting to understand what was being taught I wrote: print("\nThis string" "may not" "seem terr" "ibly impressive") then wrote: print("\nThis string" + "may not" + "seem terr" + "ibly impressive") and the both printed the same output..so why would I want to use '+' to add strings if there seems to be no reason too? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Concatenating Strings
On 05/28/2012 10:00 PM, Jeremy Duenas wrote: > I am trying to understand the point behind using the '+' character when > trying to concatenate strings. I am new to learning Python and going through > the book "Python Programming for Absolute Beginners 3rd ed." and do not > understand the point or reason for concatenating strings. The reason I do > not understand is when experimenting to understand what was being taught I > wrote: > > > print("\nThis string" "may not" "seem terr" "ibly impressive") > > > then wrote: > > > > print("\nThis string" + "may not" + "seem terr" + "ibly impressive") > > > > > and they both printed the same output..so why would I want to use '+' to add > strings if there seems to be no reason too? > > > As long as they're all literal strings, you can use the implicit concatenation. Or you can just make one longer string. Makes no difference, other than white space and sometimes prettiness. However, as soon as one of the strings is a variable of type "str" then you need the "plus sign." -- DaveA ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Concatenating Strings
Thanks for the replays all your responses makes perfect sense looking at it that way. I agree the example in the book explained it simply, just made no sense as to why and how it is really used. What ya'll have explained to me makes sense and thank you. I can see the importance of it now. From: brian arb [mailto:brianjames...@gmail.com] Sent: Monday, May 28, 2012 7:22 PM To: Jeremy Duenas Cc: tutor@python.org Subject: Re: [Tutor] Concatenating Strings Your right that example from the book is a terrible example the point or the reason to concatenating strings. here is a simple usage of where concatenating strings prints out a simple string as a counter in a loop. >>> for i in range(5): ... print(str(i) + ' in for loop') ... 0 in for loop 1 in for loop 2 in for loop 3 in for loop 4 in for loop On Mon, May 28, 2012 at 10:00 PM, Jeremy Duenas wrote: I am trying to understand the point behind using the '+' character when trying to concatenate strings. I am new to learning Python and going through the book "Python Programming for Absolute Beginners 3rd ed." and do not understand the point or reason for concatenating strings. The reason I do not understand is when experimenting to understand what was being taught I wrote: print("\nThis string" "may not" "seem terr" "ibly impressive") then wrote: print("\nThis string" + "may not" + "seem terr" + "ibly impressive") and the both printed the same output..so why would I want to use '+' to add strings if there seems to be no reason too? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Concatenating Strings
On Mon, May 28, 2012 at 07:07:20PM -0700, Steve Willoughby wrote: > On 28-May-12 19:00, Jeremy Duenas wrote: > >and the both printed the same output……so why would I want to use > >‘+’ to > >add strings if there seems to be no reason too? > > Juxtaposing strings only works with constants, which may be convenient > in some cases, but it won't work at all when concatenating other string > values. > > a="hello" > b="world" > > a+b# will yield "helloworld" but > a b# is a syntax error > > Using + is arguably preferable when you have a choice to make, since it > works in all cases, including constants. I'll argue differently: even though + works with string literals as well as variables, you shouldn't use it. Python the language promises that implicit concatenation of literals will be performed at compile time. That is, if you write source code: print("hello " "world") # implicit concatenation any implementation of Python (such as PyPy, IronPython, Jython, etc.) must ensure that the literals "hello " and "world" are concatenated at compile-time into a single string "hello world", not at run-time. But the same is not the case for + concatenation: print("hello " + "world") # explicit concatenation which may be done either at compile-time, or at run-time, depending on the implementation and version of Python, or the presence of optimizations, or the phase of the moon for all we know. Now, normally this won't matter. The nanosecond or so that it takes to concatenate two short strings like that is trivial. Even if it happens at run-time, who will care? But the *intent* is more clear: implicit concatenation clearly states that these substrings belong together, in a way that + doesn't. (At least in my mind.) Furthermore, there are times where run-time concatentation of literals does add some small, but measurable, cost: for i in range(1000): print("hello " + "world") do_something_useful(i) In this case, versions of Python that delay the concatenation to run-time will have to add the two substrings not once, but ten million times. Versions of Python that do it at compile time only need to add them together once. Of course, nobody sensible should be concatenating such small strings like that when they could just write "hello world" as a single string. Why would you bother? But this is a useful feature when you have longer strings: print("This is some longer string, where it is not appropriate to " "use a triple-quoted string because it adds linebreaks, but " "the string is too long to fit on a single line. In this case " "implicit string concatenation is the ideal solution to the " "problem. Don't forget to leave a space at the end of each " "line (or the beginning if you prefer).") In cases like this, the difference between a compile-time concatenation and run-time may be significant, especially inside a fast loop. -- Steven ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Concatenating Strings
On Tue, May 29, 2012 at 03:51:21PM +1000, Steven D'Aprano wrote: > > Using + is arguably preferable when you have a choice to make, since it > > works in all cases, including constants. > > I'll argue differently: even though + works with string literals as well > as variables, you shouldn't use it. Oops, that sentence is unclear -- what I meant is that you shouldn't use + to concatenate two string literals, not that you should never use it at all! When you have one or both are variables, you MUST use + rather than implicit concatenation. Sorry for any confusion. -- Steven ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Python 2.7 Static Version and Postgresql
Hello to the list, I'm working on a python script that has to interact with a Postgresql database, and the only python version I can use is python 2.7-static. I have two questions: 1) Is there any way to add libraries to this version? 2)If not, what would you recommend as a method to work with the Postgresql API? Thanks, Opher Lubzens ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Concatenating Strings
Your right that example from the book is a terrible example the point or the reason to concatenating strings. here is a simple usage of where concatenating strings prints out a simple string as a counter in a loop. >>> for i in range(5): ... print(str(i) + ' in for loop') ... 0 in for loop 1 in for loop 2 in for loop 3 in for loop 4 in for loop On Mon, May 28, 2012 at 10:00 PM, Jeremy Duenas wrote: > I am trying to understand the point behind using the ‘+’ character when > trying to concatenate strings. I am new to learning Python and going > through the book “Python Programming for Absolute Beginners 3rd ed.” and > do not understand the point or reason for concatenating strings. The reason > I do not understand is when experimenting to understand what was being > taught I wrote: > > ** ** > > print(“\nThis string” “may not” “seem terr” “ibly impressive”) > > ** ** > > then wrote: > > ** ** > > print(“\nThis string” + “may not” + “seem terr” + “ibly impressive”) > > ** ** > > ** ** > > and the both printed the same output……so why would I want to use ‘+’ to > add strings if there seems to be no reason too? > > ** ** > > ** ** > > ** ** > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Concatenating Strings
On 28-May-12 19:00, Jeremy Duenas wrote: and the both printed the same output……so why would I want to use ‘+’ to add strings if there seems to be no reason too? Juxtaposing strings only works with constants, which may be convenient in some cases, but it won't work at all when concatenating other string values. a="hello" b="world" a+b# will yield "helloworld" but a b# is a syntax error Using + is arguably preferable when you have a choice to make, since it works in all cases, including constants. -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor