Re: "Goto" statement in Python

2017-04-14 Thread Bernd Nawothnig
On 2017-04-13, Grant Edwards wrote: > On 2017-04-13, Rob Gaddi wrote: > >> No, C doesn't support exception handling. As a result, handling error >> conditions in C is a huge pain for which (forward-only) goto is often, >> while not the only remedy, the least painful one. > > Indeed. That is alm

Re: "Goto" statement in Python

2017-04-14 Thread Bernd Nawothnig
On 2017-04-13, Mikhail V wrote: > On 13 April 2017 at 18:48, Ian Kelly wrote: >> On Thu, Apr 13, 2017 at 10:23 AM, Mikhail V wrote: >>> Now I wonder, have we already collected *all* bells and whistles of Python >>> in these two examples, or is there something else for expressing trivial >>> thin

Re: Python Command Line Arguments

2017-04-14 Thread Bernd Nawothnig
On 2017-04-13, Jason Friedman wrote: >> I have this code which I got from https://www.tutorialspoint. >> com/python/python_command_line_arguments.htm The example works fine but >> when I modify it to what I need, it only half works. The problem is the >> try/except. If you don't specify an input/ou

Re: topology rules in python

2016-12-20 Thread Bernd Nawothnig
On 2016-12-20, Xristos Xristoou wrote: > I have a PostGIS database with shapefiles lines, polygons and points > and I want to create a topology rules with python. Any idea how to do > that ?some packages ? http://www.gdal.org/ or: pip install gdal Bernd -- no time toulouse -- https://mail

Re: Detect Linux Runlevel

2016-12-05 Thread Bernd Nawothnig
On 2016-12-05, Wildman wrote: > And I am trying to write it without using external programs, where > possible. That is not the Unix way. > I am a hobby programmer and I've been trying to learn python > for a few months now. The program is 'worthlessware' but it > is a 'learning experience' for m

Re: Python slang

2016-08-07 Thread Bernd Nawothnig
On 2016-08-06, Chris Angelico wrote: > On Sun, Aug 7, 2016 at 5:37 AM, Bernd Nawothnig > wrote: >>> But SQL's NULL is a cross between C's NULL, IEEE's NaN, Cthulhu, and >>> Emrakul. >> >> SQL NULL has the semantic of "unknown". So if on

Re: Python slang

2016-08-06 Thread Bernd Nawothnig
On 2016-08-06, Chris Angelico wrote: > On Sat, Aug 6, 2016 at 11:14 AM, Steven D'Aprano > wrote: >>> I don't ask about `None` instead of `null` because I suppose here it's >>> a matter of disambiguation (null, in many languages, is not equal to >>> null). >> >> Really? Which languages? That's not t

Re: How to get Timezone from latitude/longitude ?

2014-06-25 Thread Bernd Nawothnig
On 2014-06-25, codetars...@gmail.com wrote: > I'm looking for a python-library which can help me to get Timezone and > Timezone-offset(UTC) from latitude/longitude. > > I'm not able to find an easy way to do it. You can find the data as a zipped shapefile here: http://efele.net/maps/tz/world/ D

Re: What is the state of MySQL support for Python 3?

2014-06-24 Thread Bernd Nawothnig
On 2014-06-24, haiz...@gmail.com wrote: > I'm starting a new project from scratch so I think its finally a time > to switch to the latest and greatest Python 3.4. > > But I'm puzzled with MySQL support for Python 3. So far the only > stable library I've found it pymysql. > > All others are either a

Re: why indentation should be part of the syntax

2014-03-02 Thread Bernd Nawothnig
On 2014-03-02, Stefan Behnel wrote: > Haven't seen any mention of it on this list yet, but since it's such an > obvious flaw in quite a number of programming languages, here's a good > article on the recent security bug in iOS, which was due to accidentally > duplicated code not actually being as i

Re: Remove comma from tuples in python.

2014-02-20 Thread Bernd Nawothnig
On 2014-02-21, Mircescu Andrei wrote: > vineri, 21 februarie 2014, 08:49:01 UTC+2, Jaydeep Patil a scris: >> I am getting below tuple from excel. >> >> How should i remove extra commas in each tuple to make it easy for >> operations. >> >> >> >> tuples is: >> >> seriesxlist1 = ((0.0), (0.01),

Re: Reading csv file

2013-12-17 Thread Bernd Nawothnig
On 2013-12-17, Igor Korot wrote: > Hi, ALL, > Is there a better way to do that: > > def Read_CSV_File(filename): > file = open(filename, "r") > reader = csv.DictReader(file) > line = 1 > for row in reader: > if line < 6: > reader.next() >

Re: "Backward"-Iterator - Beginners question

2013-10-31 Thread Bernd Nawothnig
On 2013-10-31, Ulrich Goebel wrote: > I'm locking for an "iterator" type with not only the .next() method, but > with a .previous(), .first() and .last() method, so that I can through > it from the beginning or from the end, and in both directions, even > alternately (for example two steps forwa

Re: Arithmetic with Boolean values

2012-08-12 Thread Bernd Nawothnig
On 2012-08-12, Paul Rubin wrote: >> which can be simplified to: >> for x in range(len(L)//2 + len(L)%2): > > for x in range(sum(divmod(len(L), 2))): ... nice solution. Bernd -- "Die Antisemiten vergeben es den Juden nicht, dass die Juden Geist haben - und Geld." [Friedrich Nietzsche] -- http

Re: why () is () and [] is [] work in other way?

2012-04-23 Thread Bernd Nawothnig
On 2012-04-23, Paul Rubin wrote: > Kiuhnm writes: >> I can't think of a single case where 'is' is ill-defined. > > If I can't predict the output of > > print (20+30 is 30+20) # check whether addition is commutative > print (20*30 is 30*20) # check whether multiplication is commutative >

Re: Appending to []

2012-04-22 Thread Bernd Nawothnig
On 2012-04-22, Steven D'Aprano wrote: > On Sat, 21 Apr 2012 14:48:44 +0200, Bernd Nawothnig wrote: > >> On 2012-04-20, Rotwang wrote: >>> since a method doesn't assign the value it returns to the instance on >>> which it is called; what it does to the

Re: why () is () and [] is [] work in other way?

2012-04-21 Thread Bernd Nawothnig
On Sat, Apr 21, 2012 at 03:43:03PM -0400, Dave Angel wrote: > On 04/21/2012 09:48 AM, Bernd Nawothnig wrote: > > On Sat, Apr 21, 2012 at 09:21:50AM -0400, Dave Angel wrote: > >>>>>>> [] is [] > >>>> False > >>> Same for that. > >>

Re: Appending to []

2012-04-21 Thread Bernd Nawothnig
On 2012-04-21, Kiuhnm wrote: > Sorry if I wasn't clear. I meant that one should either relies on > side-effects and write something like >a.append('x').append('t').append('z') > or use a more functional style and write >a = a + [x] + [z] > Mixing the two doesn't seem very elegant to me. >

Re: Appending to []

2012-04-21 Thread Bernd Nawothnig
On 2012-04-21, Kiuhnm wrote: >> Returning a None-value is pretty useless. Why not returning self, which >> would be >> the resulting list in this case? Returning self would make the >> language a little bit more functional, without any drawback. >> >> Then

Re: why () is () and [] is [] work in other way?

2012-04-21 Thread Bernd Nawothnig
On 2012-04-20, dmitrey wrote: > I have spent some time searching for a bug in my code, it was due to > different work of "is" with () and []: () is () > True You should better not rely on that result. I would consider it to be an implementation detail. I may be wrong, but would an implementat

Re: Appending to []

2012-04-21 Thread Bernd Nawothnig
On 2012-04-20, Rotwang wrote: > since a method doesn't assign the value it returns to the instance on > which it is called; what it does to the instance and what it returns are > two completely different things. Returning a None-value is pretty useless. Why not returning self, which would be the

Re: Empty string is False right?

2009-01-31 Thread Bernd Nawothnig
On 2009-01-31, AJ Ostergaard wrote: > Thanks for that but why: '' and True > '' > Surely that should be False?!? It is: #v+ >>> bool('' and True) False #v- Bernd -- No time toulouse -- http://mail.python.org/mailman/listinfo/python-list

Re: Recommended version of gcc for Python?

2005-05-16 Thread Bernd Nawothnig
On 2005-05-16, Dave Kuhlman wrote: > Is there a recommended version of gcc that I should be using to > compile Python? I've compiled Python 2.4 with gcc 3.3.4 on Ubuntu > Debian GNU/Linux. However, I notice that gcc 3.5 and gcc 4.0 are > available for installation. I am on Gentoo Linux and use

Re: newbie - variable "buried in quotes"

2005-05-16 Thread Bernd Nawothnig
On 2005-05-16, plsullivan wrote: > Thanks guys but I am still not getting it. This part --> > gp.FeatureclassToCoverage_conv­ersion("'Database > [EMAIL PROTECTED]' > POLYGON", prcl83, "", "DOUBLE") <-- % luser is one long command. Yes, I understood you perfectly well. > I need to be able to

Re: newbie - variable "buried in quotes"

2005-05-16 Thread Bernd Nawothnig
On 2005-05-16, plsullivan wrote: > If I follow your response Bernd, it looks like you interpreted that as > several lines. It actually should all be on one line. That's what made > me wonder if there is a line continuation character. The lines are concatenated to one string as I wrote it. See al

Re: newbie - variable "buried in quotes"

2005-05-16 Thread Bernd Nawothnig
On 2005-05-16, plsullivan wrote: > I've got a variable deep inside some quotes needed by the application I > am using. I can't figure out how to make this work. (Also, is there a > line continuation character?) > luser = win32api.GetUserName() > gp.FeatureclassToCoverage_conversion("'Database > [

Re: German spam event [was: Re: Schily ueber Deutschland]

2005-05-16 Thread Bernd Nawothnig
On 2005-05-16, François Pinard wrote: >> I don't think that post was really from MAL. It seems to be a >> sporgery attack on the newsgroup. Sigh. > For the last two days, I receive quite an amount of robotic rejects, > after my name was used as the forged From: Same with me after my follow-up.

Re: A new to Python question

2005-05-15 Thread Bernd Nawothnig
On 2005-05-15, M.E.Farmer wrote: >> No. You claimed > > This will only create a tuple in memory > > That is not what I said please do not edit my words and call it a > quote! Again the whole sentence: Message-ID: <[EMAIL PROTECTED]> | This will only create a tuple in memory that has no name t

Re: Schily ueber Deutschland

2005-05-15 Thread Bernd Nawothnig
On 2005-05-15, [EMAIL PROTECTED] wrote: > Lese selbst: > http://www.heise.de/newsticker/meldung/59427 Ja, schlimm. Trotzdem ist das hier a) eine englischsprachige NG und b) geht es hier um die Programmiersprache Python Lass es also bitte endlich! Bernd -- Those who desire to give up freed

Re: A new to Python question

2005-05-14 Thread Bernd Nawothnig
On 2005-05-14, M.E.Farmer wrote: > I explained what i meant in previous post there was nothing more than > just a discussion No. You claimed This will only create a tuple in memory But we just learned that this is not the case. > I have no real problem here just more of a sore point in style

Re: A new to Python question

2005-05-14 Thread Bernd Nawothnig
> On 2005-05-14, M.E.Farmer wrote: > (x,y,dotp,sumx,maxv) = abc(x,y,dotp,sumx,maxv) > This will only create a tuple in memory that has no name to reference > it by! Maybe. But it does not seem to hurt. And I am not sure the tupel _is_ really created in that situation. > How would you access the

Re: A new to Python question

2005-05-14 Thread Bernd Nawothnig
On 2005-05-14, Philippe C. Martin wrote: > You're thinking you're passing the arguments as reference That is the way Fortran handles them: [...] >> Right now I'm taking a simple program I wrote in Fortran Bernd -- Those who desire to give up freedom in order to gain security, will not hav

Re: A new to Python question

2005-05-14 Thread Bernd Nawothnig
On 2005-05-14, David wrote: > abc(x,y,dotp,sumx,maxv) (x,y,dotp,sumx,maxv) = abc(x,y,dotp,sumx,maxv) Bernd -- Those who desire to give up freedom in order to gain security, will not have, nor do they deserve, either one. [T. Jefferson] -- http://mail.python.org/mailman/listinfo/python-list

Re: global lists

2005-05-08 Thread Bernd Nawothnig
On 2005-05-08, andrea crotti wrote: > I have a little "problem", I don't understand the reason of this: > a = [10,1,2,3] > def foo(): > global a > for el in a: > el = el*2 Simple data types (as integer) are _not_ implemented as references as you obviously expected. Instead el is copied b