Re: Default value for optional parameters unexpected behaviour?

2011-06-26 Thread Thomas L. Shinnick
At 01:39 PM 6/26/2011, Shashank Singh wrote: On Sun, Jun 26, 2011 at 11:58 PM, Marc Aymerich wrote: > Hi, > I'm trying to define a function that has an optional parameter which > should be an empty list whenever it isn't given. However, it takes as > value the same value as the last time the fun

Re: Is the Usenet to mailing list gateway borked?

2011-06-29 Thread Thomas 'PointedEars' Lahn
Andrew Berg wrote: > […] As for your question in the Subject, I do not know since I am reading the newsgroup. Therefore, however, I can tell you that the mailing list to Usenet gateway is seriously borked, as missing References header fields are not generated by the gateway. As a result, the

Re: Is the Usenet to mailing list gateway borked?

2011-06-30 Thread Thomas 'PointedEars' Lahn
Thomas Guettler wrote: > On 30.06.2011 03:24, Thomas 'PointedEars' Lahn wrote: >> Andrew Berg wrote: >>> […] >> >> As for your question in the Subject, I do not know since I am reading the >> newsgroup. >> >> Therefore, however, I

Re: Is the Usenet to mailing list gateway borked?

2011-07-02 Thread Thomas 'PointedEars' Lahn
TP wrote: > Thomas 'PointedEars' Lahn wrote: >> [Why are threads broken in the newsgroup?] > > Not sure if this is relevant. I use mail.google.com to follow mailing > lists and a large proportion of python-list traffic ends up in my > gmail spam folder for some re

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-17 Thread Thomas 'PointedEars' Lahn
Thorsten Kampe wrote: > * Andrew Berg (Sun, 17 Jul 2011 05:02:22 -0500) >> I still don't understand. Whitespace to the left of an assignment to >> signify an indent and whitespace around operators to align values (in >> a multi-line assignment) are not the same. > > When I'm (consistently, of cou

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-17 Thread Thomas 'PointedEars' Lahn
Dotan Cohen wrote: > On Sat, Jul 16, 2011 at 19:51, rantingrick wrote: >> -- >> Evidence: Tabs ARE superior! >> -- > > I am also a recent spaces-to-tabs convert. One of the reasons is that > I've disc

Re: a little parsing challenge ☺

2011-07-17 Thread Thomas 'PointedEars' Lahn
Chris Angelico wrote: > On Sun, Jul 17, 2011 at 5:47 PM, Xah Lee wrote: >> the problem is to write a script that can check a dir of text files >> (and all subdirs) and reports if a file has any mismatched matching >> brackets. > > I wonder will it be possible to code the whole thing as a single

Re: Ordered list question

2011-07-17 Thread Thomas 'PointedEars' Lahn
jyoun...@kc.rr.com wrote: ^^ Something is missing there. > I'm currently working on a project where I'm looping through xml elements, > pulling the 'id' attribute (which will be coerced to a number) No, usually it won't. > as well as the element tag. That's element _type name_.

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-17 Thread Thomas 'PointedEars' Lahn
Thorsten Kampe wrote: > * Thomas 'PointedEars' Lahn (Sun, 17 Jul 2011 14:35:15 +0200) >> Thorsten Kampe wrote: >> > * Andrew Berg (Sun, 17 Jul 2011 05:02:22 -0500) >> >> I still don't understand. Whitespace to the left of an assignment >> >>

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-17 Thread Thomas 'PointedEars' Lahn
Anders J. Munch wrote: > Steven D'Aprano wrote: >> I can't fathom why 8 position tabs were *ever* the default, let alone >> why they are still the default. > > That's because they were not invented as a means for programmers to vary > indentation. > > Originally, tabs were a navigation device: W

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-17 Thread Thomas 'PointedEars' Lahn
Dotan Cohen wrote: > On Sun, Jul 17, 2011 at 15:53, Thomas 'PointedEars' Lahn >> […] I do not understand how you can consider using a non-fixed-width >> font in programming "a real pleasure" as many them show a lot of >> ambiguities in source code. T

Re: a little parsing challenge ☺

2011-07-17 Thread Thomas 'PointedEars' Lahn
Raymond Hettinger wrote: > Thomas 'PointedEars' Lahn wrote: >> Did you notice the excessive crosspost? Please do not feed the troll. > > IMO, this was a legitimate cross post since it is for a multi-language > programming challenge and everyone can learn from compa

Re: a little parsing challenge ☺

2011-07-17 Thread Thomas 'PointedEars' Lahn
Thomas 'PointedEars' Lahn wrote: > It is possible [to parse the parentheses language], with Perl-compatible > Regular Expressions (PCRE), provided that you have enough memory, to use > such an extended Regular Expression (not to be confused with EREs³)⁴: > > \((([^()

Re: a little parsing challenge ☺

2011-07-18 Thread Thomas 'PointedEars' Lahn
Rouslan Korneychuk wrote: > I don't know why, but I just had to try it (even though I don't usually > use Perl and had to look up a lot of stuff). I came up with this: I don't know why … you replied to my posting/e-mail (but quoted nothing from it, much less referred to its content), and posted

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-18 Thread Thomas 'PointedEars' Lahn
Gregory Ewing wrote: > Anders J. Munch wrote: >> > Cameron Simpson wrote: >> >> Personally, I like to use the tab _key_ as an input device, but to >> >> have my editor write real spaces to the file in consequence. >> Just like in the old days:) > > Most editors can be configured to do that. T

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-18 Thread Thomas 'PointedEars' Lahn
Anssi Saari wrote: > Thorsten Kampe writes: >> The "perfect programming font" is just the one that looks so good that >> you would also use it for writing email. Dejavu Sans Mono is pretty >> good. Consolas looks also looks good but it is Windows only. > > How is Consolas Windows only? Not that

Re: a little parsing challenge ☺

2011-07-18 Thread Thomas 'PointedEars' Lahn
rsed the order in the report line as I think it is more natural this way. I have tested the code superficially with a directory containing a single text file. Watch for word-wrap: # encoding: utf-8 ''' Created on 2011-07-18 @author: Thomas 'PointedEars' L

Re: Partial Function Application -- Advantages over normal function?

2011-07-18 Thread Thomas 'PointedEars' Lahn
Dave Angel wrote: > On 01/-10/-28163 02:59 PM, Terry Reedy wrote: >> def makeadder(y) >> def _add(x): return x+y >> add2 = makeadder(2) > > A couple of typos in that code: > > > def makeaddr(y): > def _add(x): return x+y > return _add I agree about the `return' statement, but not

Re: Partial Function Application -- Advantages over normal function?

2011-07-18 Thread Thomas 'PointedEars' Lahn
Thomas 'PointedEars' Lahn wrote: > Dave Angel wrote: >> On 01/-10/-28163 02:59 PM, Terry Reedy wrote: >>> def makeadder(y) >>> def _add(x): return x+y >>> add2 = makeadder(2) >> >> A couple of typos in that code: >> >>

Re: a little parsing challenge ☺

2011-07-18 Thread Thomas 'PointedEars' Lahn
Thomas 'PointedEars' Lahn wrote: > with open(os.path.join(dirpath, name), 'r') as f: SHOULD be with open(os.path.join(dirpath, name), 'rb') as f: (as in the original), else the some code units might not be read properly. -- PointedEa

Re: os.path.isdir do not work for Foder named '2011-07-03'

2011-07-18 Thread Thomas 'PointedEars' Lahn
Steven D'Aprano wrote: > Nulpum wrote: >> I want to make sure that folder exists. >> >> '2011-07-03' is really exists. but 'os.path.isdir' say false >> >> Does anyone know why? > > Yes. > print "logs/2011-07-03" > logs/2011-07-03 print "logs\2011-07-03" > logs�1-07-03 > > Don't use

Re: PEP 8 and extraneous whitespace

2011-07-21 Thread Thomas 'PointedEars' Lahn
Dan Sommers wrote: > bruno.desthuilli...@gmail.com wrote: >> 1/ you can consider the equal sign ('=') is the "binding operator". >> >> 2/ since {'key':'val'} is equivalent to dict(key=val), you can consider >> colons as a binding operator here > > But PEP 8 (under Other Recommendations) indicate

Re: Convert '165.0' to int

2011-07-21 Thread Thomas 'PointedEars' Lahn
Billy Mays wrote: > On 07/21/2011 08:46 AM, Web Dreamer wrote: >> If you do not want to use 'float()' try: >> >> int(x.split('.')[0]) > > This is right. Assuming that the value of `x' is in the proper format, of course. Else you might easily cut to the first one to three digits of a string rep

Re: A little complex usage of Beautiful Soup Parsing Help!

2011-07-21 Thread Thomas 'PointedEars' Lahn
SAKTHEESH wrote: > I am using Beautiful Soup to parse a html to find all text that is Not > contained inside any anchor elements > > I came up with this code which finds all links within href _anchors_ _with_ `href' _attribute_ (commonly: links.) > but not the other way around. What would tha

Re: Convert '165.0' to int

2011-07-24 Thread Thomas 'PointedEars' Lahn
Billy Mays wrote: > On 7/21/2011 10:40 PM, Thomas 'PointedEars' Lahn wrote: >> Billy Mays wrote: >>> On 07/21/2011 08:46 AM, Web Dreamer wrote: >>>> If you do not want to use 'float()' try: >>>> >>>> int(x.split('.

Re: can I use element tree for handling special characters in xml text?

2011-07-27 Thread Thomas 'PointedEars' Lahn
hackingKK wrote: > I have been waiting a lot to ask this question and I did ask some days > back but probably could not put it the proper way. You still can't. But to spare everyone yet another try: > I want to know how I can safely include

Re: PEP 8 and extraneous whitespace

2011-07-27 Thread Thomas 'PointedEars' Lahn
Chris Rebert wrote: > John Gordon wrote: >> Neil Cerutti writes: >>> You can fit much more code per unit of horizontal space with a >>> proportionally spaced font. As a result, that issue, while valid, >>> is significantly reduced. >> >> Is it? I assume one major reason for the 80-character limit

Re: Pipe in the "return" statement

2011-07-27 Thread Thomas 'PointedEars' Lahn
Ethan Furman wrote: > Billy Mays wrote: >> On 07/25/2011 10:16 AM, Archard Lias wrote: >>> On Jul 25, 2:03 pm, Ian Collins wrote: On 07/26/11 12:00 AM, Archard Lias wrote: > Still I dont get how I am supposed to understand the pipe and its > task/ idea/influece on control flow, of: >

Re: PEP 8 and extraneous whitespace

2011-08-01 Thread Thomas 'PointedEars' Lahn
OKB (not okblacke) wrote: > Thomas 'PointedEars' Lahn wrote: >> Automatic word-wrap, where available, really is not a solution; it >> is a bad workaround to a problem caused by the original author of >> the source code that can be easily avoided by them t

Re: string to unicode

2011-08-15 Thread Thomas 'PointedEars' Lahn
thon-is-there-a-way-to- determine-the-encoding-of-text-file> Improving Billy Mays' "matching brackets" checker, chardet worked for me (the test file was UTF-8-encoded). Watch for word-wrap: --- # encoding

Re: Design principles: no bool arguments

2011-08-25 Thread Thomas 'PointedEars' Lahn
Stefan Behnel wrote: > Maarten, 25.08.2011 09:52: >> On Aug 25, 9:13 am, Steven D'Aprano wrote: >>> One design principle often mentioned here (with a certain degree of >>> disagreement[1]) is the idea that as a general rule, you shouldn't write >>> functions that take a bool argument to switch bet

Re: Design principles: no bool arguments

2011-08-25 Thread Thomas 'PointedEars' Lahn
Stefan Behnel wrote: > Thomas 'PointedEars' Lahn, 25.08.2011 11:29: >> Stefan Behnel wrote: >>> It's totally unreadable to find this in the code: >>> >>> data1.merge_with(data2, true); >>> >>> Requires you to either a

Re: Design principles: no bool arguments

2011-08-26 Thread Thomas 'PointedEars' Lahn
Ian Kelly wrote: > Thomas 'PointedEars' Lahn wrote: >> Both variants work (even in Py3) if you only define [a named argument]. >> You have to define [a keyword argument, e.g. `kwargs']. >> >> so that >> >> data1.merge_with(data2, True); &

Re: Python IDE/Eclipse

2011-08-26 Thread Thomas 'PointedEars' Lahn
Dave Boland wrote: > I'm looking for a good IDE -- easy to setup, easy to use -- for Python. > Any suggestions? PyDev (currently 2.2.1.2011073123, from the Aptana Studio 3.0.4 Plugin; but I can see that 2.2.2 has been released). > I use Eclipse for other projects and have no problem with usin

Re: Installing WebDAV server

2011-08-30 Thread Thomas 'PointedEars' Lahn
Fokke Nauta wrote: > I'm running a PC with XP Pro32, […] > To do some research with some calender systems and to share the Outlook > calendar I need a WebDAV server. After googling I found the Python WebDAV > server. > I installed Python 3.2.1 and extracted the packages PyWebDAV and PyXML. > Now I

Re: Installing WebDAV server

2011-08-30 Thread Thomas 'PointedEars' Lahn
Fokke Nauta wrote: > "Thomas 'PointedEars' Lahn" wrote in message > news:6545843.yvfaxzv...@pointedears.de... It's attribution _line_, not attribution novel. Your quotes are hardly legible, too → <http://insideoe.com/> >> Fokke Nauta wrote: >>

Re: Installing WebDAV server

2011-09-03 Thread Thomas 'PointedEars' Lahn
Fokke Nauta wrote: > "Thomas 'PointedEars' Lahn" […]: >> Fokke Nauta wrote: >>> "Thomas 'PointedEars' Lahn" […] wrote: >>>> The Python shell executes Python code. The above obviously is not >>>> Python >>&g

Re: Installing WebDAV server

2011-09-04 Thread Thomas 'PointedEars' Lahn
Fokke Nauta wrote: > "Thomas 'PointedEars' Lahn" wrote in message > news:109595831.vcn276c...@pointedears.de... > > > > If you don't have anything better to contribute, please stop answering. > > Es gen�gt schon. I should have

Re: Floating point multiplication in python

2011-09-06 Thread Thomas 'PointedEars' Lahn
Thomas Rachel wrote: > Now if you multiply two values with an error, the error also propagates > into the result - PLUs the result can have its own error source - in the > same order of magnitude. > > (a+e) * (a+e) = a*a + 2*a*e + e*e. So your new error term is 2*a*e + e*e >

Re: nntplib encoding problem

2011-02-27 Thread Thomas L. Shinnick
At 08:12 PM 2/27/2011, you wrote: On 28/02/2011 01:31, Laurent Duchesne wrote: Hi, I'm using python 3.2 and got the following error: nntpClient = nntplib.NNTP_SSL(...) nntpClient.group("alt.binaries.cd.lossless") nntpClient.over((534157,534157)) ... 'subject': 'Myl\udce8ne Farmer - Anamorpho

Re: Switching between Python releases under Windows

2011-03-08 Thread Thomas L. Shinnick
At 10:03 AM 3/8/2011, Tim Golden wrote: On 08/03/2011 15:58, Tim Golden wrote: On 08/03/2011 14:55, Edward Diener wrote: I have multiple versions of Python installed under Vista. Is there any easy way of switching between them so that invoking python and file associations for Python extensions

Re: Syntax Error

2011-03-18 Thread Thomas L. Shinnick
At 11:39 PM 3/18/2011, Manatee wrote: I hope this is the place to post this question. I am a really new pythonista. I am studying Tkinter and when I run this basic code, I get a syntax error on line 20, print "hi there, everyone". Its a simple print line, but I can't see the problem. I am using

Re: Regex in if statement.

2011-03-20 Thread Thomas L. Shinnick
At 07:46 PM 3/20/2011, Ken D'Ambrosio wrote: Hey, all -- I know how to match and return stuff from a regex, but I'd like to do an if, something like (from Perl, sorry): if (/MatchTextHere/){DoSomething();} How do I accomplish this in Python? You say you've done matching and accessing stuff fr

Re: file print extra spaces

2011-03-22 Thread Thomas L. Shinnick
At 08:33 PM 3/22/2011, monkeys paw wrote: When i open a file in python, and then print the contents line by line, the printout has an extra blank line between each printed line (shown below): >>> f=open('authors.py') >>> i=0 >>> for line in f: print(line) i=i+1 if i > 14:

Re: detecting newline character

2011-04-23 Thread Thomas 'PointedEars' Lahn
Daniel Geržo wrote: > I need to detect the newline characters used in the file I am reading. > For this purpose I am using the following code: > > def _read_lines(self): > with contextlib.closing(codecs.open(self.path, "rU")) as fobj: > fobj.readlines() > if isinstance(fobj

Re: detecting newline character

2011-04-23 Thread Thomas 'PointedEars' Lahn
Chris Rebert wrote: > On Sat, Apr 23, 2011 at 11:09 AM, Daniel Geržo wrote: >> I need to detect the newline characters used in the file I am reading. >> For this purpose I am using the following code: >> >> def _read_lines(self): >> with contextlib.closing(codecs.open(self.path, "rU")) as fob

Re: detecting newline character

2011-04-23 Thread Thomas 'PointedEars' Lahn
Daniel Geržo wrote: > Thomas 'PointedEars' Lahn wrote: >> Chris Rebert wrote: >>> Daniel Geržo wrote: >>>> [f.newlines is None after f.readlines() >>>> when f = codecs.open(…, mode='rU', encoding='ascii'), >>>>

Re: detecting newline character

2011-04-24 Thread Thomas 'PointedEars' Lahn
Daniel Geržo wrote: > On 24.4.2011 9:05, jmfauth wrote: >> Use the io module. > > For the record, when I use io.open(file=self.path, mode="rt", > encoding=enc)) as fobj: > > my tests are passing and everything seems to work fine. > > That indicates there is a bug with codecs module and universa

Re: detecting newline character

2011-04-24 Thread Thomas 'PointedEars' Lahn
Daniel Geržo wrote: > Thomas 'PointedEars' Lahn wrote: >> It is clear now that codecs.open() would not support universal newlines >> from at least Python 2.6 forward as it is *documented* that it opens >> files in *binary mode* only. The source code that I have po

[SOLVED] detecting newline character

2011-04-24 Thread Thomas 'PointedEars' Lahn
Daniel Geržo wrote: > On 23.4.2011 21:18, Thomas 'PointedEars' Lahn wrote: >> Daniel Geržo wrote: >>> [f = codecs.open(…, mode='rU', encoding='ascii') and f.newlines] >> >> […] >> The only reason I can think of for this not

Re: Reliably call code after object no longer exists or is "unreachable"?

2011-04-27 Thread Thomas 'PointedEars' Lahn
Jack Bates wrote: > Python's __del__ or destructor method works (above) - but only in the > absence of reference cycles (below). An object, with a __del__ method, > in a reference cycle, causes all objects in the cycle to be > "uncollectable". This can cause memory leaks and because the object is

Re: use of index (beginner's question)

2011-04-27 Thread Thomas 'PointedEars' Lahn
Chris Angelico wrote: > Rusty Scalf wrote: >> list1 = ['pig', 'horse', 'moose'] >> list2 = ['62327', '49123', '79115'] >> n = 2 >> s2 = "list" + `n` I would prefer the clearer s2 = "list" + str(n) or s2 = "list%s" % n >> a = s2[list1.index('horse')] >> print a > > s2 is a string with th

Re: Zope with mySQL

2011-04-30 Thread Thomas 'PointedEars' Lahn
harryjatt wrote: > Hi, i am doing web development with Zope. My connected database is mySQL. > I am new to this combination.I have to upload the files to mySQL with > programming in zope and then downloading them via zope.Can you help me in > this regard? Perhaps. > I will be very thankfull to y

Re: Python competitions and learnings

2011-05-01 Thread Thomas 'PointedEars' Lahn
harrismh777 wrote: > Terry Reedy wrote: >>> And Im looking for feedback from peoples who best in python. Here I >>> make some video tutorial about this service http://checkio.blip.tv/ >>> >>> What do you think about it? >> >> Pretty impressive. My main disappointment is that you are using 2.7 >>

Re: Customize help output from optparse (or argparse)

2011-05-12 Thread Thomas 'PointedEars' Lahn
Thorsten Kampe wrote: > I'm using optparse for a little Python script. > > 1. The output from "--help" is: > """ > Usage: script.py > > script.py does something > > Options: > -h, --help show this help message and exit > """ > > I would prefer to have the description before the usage, lik

Re: list equal to subclass of list?

2011-05-12 Thread Thomas 'PointedEars' Lahn
Ethan Furman wrote: > PS > I have a broken sense of humor -- sometimes it works, sometimes it > doesn't. My apologies in advance if my attempt at humor was not funny. Now that was very unpythonic. Know where your roots are! :) -- PointedEars Bitte keine Kopien per E-Mail. / Please do not Cc:

Re: Need Assistance on this program.

2011-05-12 Thread Thomas 'PointedEars' Lahn
vijay swaminathan wrote: > I have already done that. But for some reason my response went > as a new thread. Attaching the code again. JFYI: Please DO NOT post attachments in a non-binary newsgroup or to a mailing list (are there binary ones at all?) again. TIA. -- PointedEars Bitte keine Kop

Re: connect SIGINT to custom interrupt handler

2011-05-15 Thread Thomas 'PointedEars' Lahn
Christoph Scheingraber wrote: > I now have signal.siginterrupt(signal.SIGINT, False) in the line > below signal.signal(signal.SIGINT, interrupt_handler) > > Unfortunately, pressing ^c still results in the same interrupt error. I > also tried putting signal.siginterrupt into the interrupt_handler

Re: English Idiom in Unix: Directory Recursively

2011-05-18 Thread Thomas A. Russ
the iterative code. To my mind that isn't really an iterative algorithm anymore if it ends up simulating the call stack. Tree walks are the canonical example of what can't be done in an iterative fashion without the addition of an explicitly managed stack -- Thomas A. Russ, US

Re: English Idiom in Unix: Directory Recursively

2011-05-18 Thread Thomas A. Russ
Hans Georg Schaathun writes: > ["Followup-To:" header set to comp.lang.python.] > On 17 May 2011 23:42:20 -0700, Thomas A. Russ >wrote: > : Tree walks are the canonical example of what can't be done in an > : iterative fashion without the addition of an ex

Re: English Idiom in Unix: Directory Recursively

2011-05-19 Thread Thomas A. Russ
"Pascal J. Bourguignon" writes: > t...@sevak.isi.edu (Thomas A. Russ) writes: > > > > This will only work if there is a backpointer to the parent. > > No, you don't need backpointers; some cases have been mentionned in the > other answer, but in gen

Re: English Idiom in Unix: Directory Recursively

2011-05-19 Thread Thomas A. Russ
oint is that there are algorithms that are inherently recursive and for which there is no natural iterative algorithm. -- Thomas A. Russ, USC/Information Sciences Institute -- http://mail.python.org/mailman/listinfo/python-list

Re: connect SIGINT to custom interrupt handler

2011-05-20 Thread Thomas 'PointedEars' Lahn
Christoph Scheingraber wrote: > On 2011-05-15, Thomas 'PointedEars' Lahn wrote: >> Obviously. `signal' refers to an `int' object, probably by something >> like >> >> signal = 42 >> >> before. E.g. `print' or a debugger will te

Re: and becomes or and or becomes and

2011-05-22 Thread Thomas 'PointedEars' Lahn
Stef Mientki wrote: > must of us will not use single bits these days, > but at first sight, this looks funny : > a=2 b=6 a and b > 6 a & b > 2 a or b > 2 a | b > 6 Change the order of the operands and see what happens. -- PointedEars Bitte keine Kopien per E-Mail

Re: Weird problem matching with REs

2011-05-29 Thread Thomas 'PointedEars' Lahn
Andrew Berg wrote: > On 2011.05.29 10:19 AM, Roy Smith wrote: >> Named after the governor of Tarsus IV? > Judging by the graphic at http://kodos.sourceforge.net/help/kodos.html , > it's named after the Simpsons character. I don't think that's a coincidence; both are from other planets and both

Re: manually sorting images?

2016-09-04 Thread Thomas 'PointedEars' Lahn
Ulli Horlacher wrote: > I need to sort images (*.jpg), visually, not by file name. > It looks, there is no standard UNIX tool for this job? Depends. What are the sort keys? -- PointedEars Twitter: @PointedEars2 Please do not cc me. / Bitte keine Kopien per E-Mail. -- https://mail.python.org/

Re: Expression can be simplified on list

2016-09-12 Thread Thomas 'PointedEars' Lahn
Chris Angelico wrote: > On Mon, Sep 12, 2016 at 9:14 PM, Daiyue Weng wrote: >> Hi, I found that when I tried to make an equality test on empty like, >> >> if errors == []: >> >> PyCharm always warns me, >> >> Expression can be simplified. >> >> I am wondering what's wrong and how to fix this? >>

Re: How to extend a tuple of tuples?

2016-09-13 Thread Thomas 'PointedEars' Lahn
John Gordon wrote: > […] Thomas 'PointedEars' Lahn […] writes: It is supposed to be an attribution *line*, _not_ an attribution novel. >> >> The obvious way does not work - >> >> >> >> a += (5, 6) >> ^^ >>

Re: Expression can be simplified on list

2016-09-13 Thread Thomas 'PointedEars' Lahn
Chris Angelico wrote: > […] Thomas 'PointedEars' Lahn […] wrote: >> If I knew that it is always going to be a list or a tuple, I would check >> its length instead: >> >> if len(errors) == 0: > > I wouldn't. I'd use boolification here too.

Re: correct way to catch exception with Python 'with' statement

2016-11-28 Thread Thomas 'PointedEars' Lahn
Ganesh Pal wrote: > I am using Python 2.7 and Linux As a rule of thumb¹, use at least Python 3.3 for new programs. > What will be the best way to catch the exception in the above program ? > Can we replace both the with statement in the above program with > something like below > > try: >

Re: The right way to 'call' a class attribute inside the same class

2016-12-12 Thread Thomas 'PointedEars' Lahn
Juan C. wrote: > I'm watching a Python course and was presented a topic regarding classes. > One of the examples were: > > box.py > > class Box: > serial = 100 > > def __init__(self, from_addr, to_addr): > self.from_addr = from_addr > self.to_addr = to_addr > sel

Re: The right way to 'call' a class attribute inside the same class

2016-12-12 Thread Thomas 'PointedEars' Lahn
Thomas 'PointedEars' Lahn wrote: > Note that (AIUI) in this example the instances of the class referred by > “C” do not have an *own* “foo” property in the beginning, so until bar() > is called on them, they inherit that property (and its value) from that > class

Re: The right way to 'call' a class attribute inside the same class

2016-12-12 Thread Thomas 'PointedEars' Lahn
Juan C. wrote: > On Mon, Dec 12, 2016 at 12:34 PM, Thomas 'PointedEars' Lahn > wrote: >> To call something means generally in programming, and in Python, to >> execute it as a function instead: In the code above, the class object >> referred to by “Box” is ca

Re: Python constructors have particular semantics, and ‘Foo.__init__’ doesn't qualify

2016-12-15 Thread Thomas 'PointedEars' Lahn
Ben Finney wrote: > Chris Angelico writes: >> On Tue, Dec 13, 2016 at 10:17 AM, Ben Finney >> wrote: >> > If the differences didn't matter I would agree that “overly >> > pedantic” is fair. But those differences trip up newcomers. Thinking >> > of ‘Foo.__init__’ leads people to wonder where the

Re: The right way to 'call' a class attribute inside the same class

2016-12-19 Thread Thomas 'PointedEars' Lahn
Chris Angelico wrote: > On Mon, Dec 19, 2016 at 9:52 AM, Erik wrote: >> 1) Method call: >>"obj.foo(1, 2, 3)" is syntactic sugar for "obj.foo(obj, 1, 2, 3)". > > And the bit you have to be REALLY careful of when working with both > Python and JS is that you have to have "obj.foo(...)" as a si

Reviews of book on introductory Python (was: Need reviews for my book on introductory python)

2017-01-28 Thread Thomas 'PointedEars' Lahn
mm0fmf wrote: > […] Python, the name of the language, is a proper noun and should be > captialised. In the few pages I read, Python appears as "python" and > "Python", randomly losing the capital letter. Lacking capitalisation > would suggest to me that some or all words are consistently written >

Re: [beginner] What's wrong?

2016-04-02 Thread Thomas 'PointedEars' Lahn
Marko Rauhamaa wrote: > Steven D'Aprano : >> So you're saying that learning to be a fluent speaker of English is a >> pre-requisite of being a programmer? > > No more than learning Latin is a prerequisite of being a doctor. Full ACK. Probably starting with the Industrial Revolution enabled by t

Re: writing to command line thru python gui

2016-04-02 Thread Thomas 'PointedEars' Lahn
A. ElKader wrote: > I posted this question, no reply : > > Any advice : > > http://unix.stackexchange.com/questions/273573/write-to-terminal-in-tkinter-gui I do not think that this newsgroup/mailing list is meant as an advertisement board to get your questions answered on Q&A forums on the Web

Re: [beginner] What's wrong?

2016-04-03 Thread Thomas 'PointedEars' Lahn
Michael Torrie wrote: > Mark, your messages are showing up to the list as being from "python," > at least on my email. Any reason for this? Depends on which Mark you are addressing and how you are reading e-mail. The messages of Mark Lawrence, for example, appear to me as technically correct a

Re: [beginner] What's wrong?

2016-04-03 Thread Thomas 'PointedEars' Lahn
Rustom Mody wrote: > On Saturday, April 2, 2016 at 10:42:27 PM UTC+5:30, Thomas 'PointedEars' > Lahn wrote: >> Marko Rauhamaa wrote: >> > Steven D'Aprano : >> >> So you're saying that learning to be a fluent speaker of English is a >>

Re: Import graphics error

2016-04-05 Thread Thomas 'PointedEars' Lahn
Nicolae Morkov wrote: > […] > *Following the instructions I copied The graphic modules by John Zelle in > Python folder in Lib folder * > **And when I installed graphic library the error was :* * > > Traceback (most recent call last): > File > "C:/Users/Nicolae/AppData/Local/Programs/Python/Pytho

Re: WP-A: A New URL Shortener

2016-04-06 Thread Thomas 'PointedEars' Lahn
Chris Angelico wrote: > In other words, you are assuming that the string escaping *in the > module* is buggy. Well, duh. This is exactly what I said about not > having stupid bugs. The developer of a MySQL binding library should > know the *entire* rules for escaping, and, duh, that's going to > i

Re: [beginner] What's wrong?

2016-04-06 Thread Thomas 'PointedEars' Lahn
Rustom Mody wrote: > On Sunday, April 3, 2016 at 5:17:36 PM UTC+5:30, Thomas 'PointedEars' Lahn > wrote: >> Rustom Mody wrote: >> > When python went to full unicode identifers it should have also added >> > pragmas for which blocks the programmer intended

Re: function to remove and punctuation

2016-04-10 Thread Thomas 'PointedEars' Lahn
Peter Otten wrote: > gesh...@gmail.com wrote: >> how to write a function taking a string parameter, which returns it after >> you delete the spaces, punctuation marks, accented characters in python ? > > Looks like you want to remove more characters than you want to keep. In > this case I'd decid

String concatenation (was: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?)

2016-05-08 Thread Thomas 'PointedEars' Lahn
DFS wrote: > sSQL = "line 1\n" > sSQL += "line 2\n" > sSQL += "line 3" What is wrong with it in Python is that it is unnecessarily inefficient. Python has implicit string concatenation if all operands are string literals: #-

Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?

2016-05-10 Thread Thomas 'PointedEars' Lahn
DFS wrote: > On 5/8/2016 8:44 PM, Thomas 'PointedEars' Lahn wrote: >> DFS wrote: >>> sSQL = "line 1\n" >>> sSQL += "line 2\n" >>> sSQL += "line 3" >> >> […] >> #

Re: making executables smaller

2016-07-27 Thread Thomas 'PointedEars' Lahn
Carter Temm wrote: > I’m writing a couple different projects at the moment, and when I compile > it into a single executable using pyinstaller, it becomes extremely large. > I’m guessing this is because of the modules used. Because I’m not that > skilled at python, I put stuff like for example, im

Re: use import *

2016-08-01 Thread Thomas 'PointedEars' Lahn
Ganesh Pal wrote: > is it a good programming practice to use [from … ] import * ? No; but it is not as harmful as one would think either. > if answer is "NO " then are there situation where you are forced to use > impo

Problem cmpiling M2Crypto

2005-11-29 Thread Thomas G. Apostolou
Hello all. i am trying to make some win32 binaries of M2Crypto 0.15 What I use is: Python 2.3.3 openssl-0.9.7i swigwin 1.3.27 I have build the openssl binaries and have installed the Swig binary python dir is C:\Program Files\Plone 2\Python openssl dir is c:\openssl Swig dir is c:\swig so I ha

Re: Problem cmpiling M2Crypto

2005-12-01 Thread Thomas G. Apostolou
or macros. building '__m2crypto' extension C:\SWIG\swig.exe -python -ISWIG -I"c:\openssl\include" -o SWIG/_m2crypto.c SWIG/_m2crypto.i SWIG\_lib.i(527): Error: Syntax error in input(1). error: command 'swig.exe' failed with exit status 1 any help would be n

Re: Problem cmpiling M2Crypto

2005-12-01 Thread Thomas G. Apostolou
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thomas G. Apostolou wrote: > > >> C:\Program Files\Plone 2\Python\lib\distutils\extension.py:128: > > UserWarning: > >> Unknown Extension options: 'swig_opts' &g

Re: Problem cmpiling M2Crypto

2005-12-02 Thread Thomas G. Apostolou
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thomas G. Apostolou wrote: > > > I still get the error: > > "SWIG/_m2crypto.c(80) : fatal error C1083: Cannot open include file: > > 'Python.h': No such file or di

Re: Problem cmpiling M2Crypto under Plone

2005-12-02 Thread Thomas G. Apostolou
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thomas G. Apostolou wrote: > > > So what you say is that the Python installed with Plone doesn't have > > Python.h in ./include but Python installers from Python.org do have

Problem patching SimpleXMLRPCServer.py

2005-12-06 Thread Thomas G. Apostolou
access private attribute "%s"' % i ) else: obj = getattr(obj,i) return obj def list_public_methods(obj): """Returns a list of attribute strings, found in the specified object, which represent callable attributes"""

Re: Problem patching SimpleXMLRPCServer.py

2005-12-06 Thread Thomas G. Apostolou
Its ok now, it seems the problem was that i had saved the file in UTF-8 format ??? I got it again and saved it in Greek(ISO) format and it now goes fine "Thomas G. Apostolou" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello all, > I use Python

Question about start using ZServerSSL on win box...

2005-12-07 Thread Thomas G. Apostolou
2\Zope\bin" Do i HAVE to reinstall Plone and set it not to run as service? Thank you in advance... Thomas G. Apostolou -- http://mail.python.org/mailman/listinfo/python-list

Re: PHP = Perl Improved

2005-12-09 Thread Thomas G. Marshall
Roedy Green said something like: > On 9 Dec 2005 11:15:16 -0800, "Xah Lee" <[EMAIL PROTECTED]> wrote, quoted > or indirectly quoted someone who said : > >> recently i got a project that involves the use of php. In 2 days, i >> read almost the entirety of the php doc. Finding it a breeze because it

Re: Lisp-likeness

2005-03-15 Thread Thomas A. Russ
you can use simultaneously? The lisp snippet creates new functions each time the addn function is called, so one can interleave calls to the individual functions. -- Thomas A. Russ, USC/Information Sciences Institute -- http://mail.python.org/mailman/listinfo/python-list

Re: if else python

2015-11-25 Thread Thomas 'PointedEars' Lahn
Scott Montreuil wrote: > I have an if statement which seems to run both commands and I cannot > figure out why. (just learning so I may be missing something obvious) Any > ideas? Use a Python IDE and debugger. I recommend PyDev, but YMMV. > while True: > global latit,longt,jlatit,jlongt

Re: Accessing container's methods

2015-12-07 Thread Thomas 'PointedEars' Lahn
Tony van der Hoff wrote: > I have a class A, containing embedded embedded classes, which need to > access methods from A. Let the name of the "embedded class" (which is not embedded at all in your example code) be E. You could either store the information in the E instance upon or after constr

<    28   29   30   31   32   33   34   35   36   37   >