Re: dunder-docs (was Python is DOOMED! Again!)

2015-02-01 Thread Emile van Sebille
On 2/1/2015 12:45 PM, Chris Angelico wrote: Simple answer: You write dunder methods and the interpreter calls them. You don't call them yourself. I can't currently think of any situation where it's appropriate to call a dunder method manually (cue the swamping of such situations on the list); yo

Re: __pycache__

2015-02-03 Thread Emile van Sebille
On 2/3/2015 6:21 AM, Dennis Lee Bieber wrote: The second is to use Google... https://www.google.com/?gws_rd=ssl#q=python+idle+can%27t+make+connection but the first page of results isn't helping -- lots of reports of the problem, but no firm remedy listed. it was suggested to me rec

Re: __pycache__

2015-02-03 Thread Emile van Sebille
On 2/3/2015 8:31 AM, Mark Lawrence wrote: On 03/02/2015 14:34, Emile van Sebille wrote: On 2/3/2015 6:21 AM, Dennis Lee Bieber wrote: The second is to use Google... https://www.google.com/?gws_rd=ssl#q=python+idle+can%27t+make+connection but the first page of results isn't he

Re: fuzzysearch: find not exactly what you're looking for!

2015-02-12 Thread Emile van Sebille
On 2/12/2015 11:51 AM, Tal Einat wrote: Hi everyone, I'd like to introduce a Python library I've been working on for a while: fuzzysearch. I would love to get as much feedback as possible: comments, suggestions, bugs and more are all very welcome! I adapt difflib's SequenceMatcher for my fuzzy

Re: Odd version scheme

2015-02-12 Thread Emile van Sebille
On 2/12/2015 11:16 AM, Ian Kelly wrote: Things break down again when we get to Python XIX. 'XVIII' < 'XIX' False Looks to me like you better check if your PEP313 patch is installed properly. :) Emile -- https://mail.python.org/mailman/listinfo/python-list

Re: singleton ... again

2014-02-13 Thread Piet van Oostrum
t of it; but > we already have it built in :-) There is a use case for a singleton class: when creating the singleton object takes considerable resources and you don't need it always in your program. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: A curious bit of code...

2014-02-13 Thread Emile van Sebille
On 2/13/2014 11:59 AM, Zachary Ware wrote: In a fit of curiosity, I did some timings: Snip of lots of TMTOWTDT/TIMTOWTDI/whatever... timed examples :) But I didn't see this one: s[::len(s)-1] Emile -- https://mail.python.org/mailman/listinfo/python-list

Re: A curious bit of code...

2014-02-13 Thread Emile van Sebille
On 2/13/2014 1:10 PM, Chris Angelico wrote: On Fri, Feb 14, 2014 at 8:06 AM, Peter Otten <__pete...@web.de> wrote: For the record: s = "x" s[::len(s)-1] Traceback (most recent call last): File "", line 1, in ValueError: slice step cannot be zero And that, my friends, is a classic exampl

Re: Puzzling PDF

2014-02-16 Thread Emile van Sebille
You On 2/16/2014 6:00 AM, F.R. wrote: Hi all, Struggling to parse bank statements unavailable in sensible data-transfer formats, I use pdftotext, which solves part of the problem. The other day I encountered a strange thing, when one single figure out of many erroneously converted into letters.

Re: Python 2.7 importing pyc files without py files

2014-02-19 Thread Emile van Sebille
On 2/19/2014 2:03 PM, Mircescu Andrei wrote: > If there are only pyc files, the loading time of the application is > much more than if I have pyc and py files. It is behind with 2 > minutes more than if it had py files You may get some clues by starting python as /path/to/python/python2.7 -vv

Re: python

2014-02-24 Thread Emile van Sebille
On 2/24/2014 12:31 AM, Karthik Reddy wrote: I worked as a weblogic administrator and now i am changing to development and i am very much interested in python . please suggest me what are the things i need to learn more rather than python to get an I.T job. I came to know about Django

modification time in Python - Django: datetime != datetime :-(

2014-03-03 Thread Jaap van Wingerde
elease:7.4 Codename: wheezy jaap@liakoster:~$ uname -a Linux liakoster.shrl.nl 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1+deb7u1 x86_64 GNU/Linux jaap@liakoster:~$ ... -- Jaap van Wingerde e-mail: 1234567...@vanwingerde.nl -- https://mail.python.org/mailman/listinfo/python-list

Re: modification time in Python - Django: datetime != datetime :-(

2014-03-03 Thread Jaap van Wingerde
Op schreef Chris Angelico in bericht : > See if ls is actually giving you ctime rather than mtime - compare the > results if you ask for os.path.getctime. jaap@liakoster:~$ python Python 2.7.3 (default, Jan 2 2013, 13:56:14) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "licen

Re: modification time in Python - Django: datetime != datetime :-(

2014-03-04 Thread Jaap van Wingerde
('%Y-%m-%dT%H:%M:%SZ',gmtime(os.path.getmtime(os.path.dirname(os.path.realpath(__file__ ))+'/templates/art_index.html'))) ... -- Jaap van Wingerde e-mail: 1234567...@vanwingerde.nl -- https://mail.python.org/mailman/listinfo/python-list

Re: find and replace string in binary file

2014-03-05 Thread Emile van Sebille
On 3/5/2014 1:59 AM, loial wrote: Unfortunately I have to use python 2.6 for this Did you try it? Emile -- https://mail.python.org/mailman/listinfo/python-list

Re: Save to a file, but avoid overwriting an existing file

2014-03-12 Thread Emile van Sebille
On 3/12/2014 5:29 AM, zoom wrote: 2. Alternatively, a unique string could be generated to assure that no same file exists. I can see one approach to this is to include date and time in the file name. But this seems to me a bit clumsy, and is not unique, i.e. it could happen (at least in theory)

Re: which book to read next??

2014-04-21 Thread Emile van Sebille
On 4/21/2014 7:13 AM, lee wrote: 4, the python standard library by examples I'd take this on -- it provides a comprehensive overview of what's where in the standard library which you'll likely use a lot. which one is suitable for me?? That we can't answer. :) Emile -- https://mail.py

Re: Basic help

2014-05-20 Thread Emile van Sebille
On 5/20/2014 7:25 AM, Pat Fourie wrote: Good Day all. I am new to Python. Welcome -- I need to maintain software written on Python 1.5.2. I'd point you to the tutorial for a start. See the docs at https://docs.python.org/release/1.5.2/ I will upgrade after learning more. My question is

Re: Introdution

2014-06-02 Thread Emile van Sebille
On 6/2/2014 3:56 PM, Mark Lawrence wrote: On 02/06/2014 23:01, Hisham Mughal wrote: HI! plz tell me about books for python i am beginner of this lang.. Regards, Hisham Either http://www.diveintopython.net/ or http://www.diveintopython3.net/ depending on whether you're using Python 2 or 3.

Re: http post goes into $_REQUEST instead into $_FILES

2013-08-16 Thread Piet van Oostrum
me, mimetype, body)) return and then use it like: form.add_fake_file('file', 'test1.txt', 'This is a test.') -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- http://mail.python.org/mailman/listinfo/python-list

Re: refresing the edited python function

2013-08-21 Thread Piet van Oostrum
text. I use Komodo IDE when i want an IDE functionality, > and never restart Komodo, over hours of work. > IPython's IDE just works the way alex23 described. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- http://mail.python.org/mailman/listinfo/python-list

Re: I wonder if I would be able to collect data from such page using Python

2013-08-21 Thread Piet van Oostrum
srcnode.find_previous_sibling('div').string print("Date: {0}".format(date)) print("Source: {0}".format(source)) cont = srcnode.find_next_siblings('p', class_='articleParagraph enarticleParagraph') contents = '\n'.join([c.get_text() for c in cont]) print("Contents: {0}".format(contents)) -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- http://mail.python.org/mailman/listinfo/python-list

Re: Python script help

2013-08-23 Thread Piet van Oostrum
;]) print url html = urlopen(url).read() fn = generate_filename(url) with open(fn, 'wb') as outfile: outfile.write(html) #### You should add a more intelligent filename generator, filter out mail: urls and possibly others and add

Re: Lambda function Turing completeness

2013-08-24 Thread Piet van Oostrum
expressions, so this helps. We don't have to emulate booleans and conditions with weird lambda expressions. In Python's lambda expressions you can not use statements, only expressions, so without conditional expressiosn Python's booleans wouldn't be very useful. The rema

Re: Lambda function Turing completeness

2013-08-24 Thread Piet van Oostrum
nside a lambda expression, so this makes all this even nicer. -- [1] http://en.wikipedia.org/wiki/Fixed-point_combinator#Y_combinator -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- http://mail.python.org/mailman/listinfo/python-list

Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-03 Thread Piet van Oostrum
address) and certain Microsoft programs use that to display as the From address instead of the real From address. It's against the rules, but then, Microsoft makes its own rules and who is going to stop them? And maybe there are other mail programs that do the same. AFAIK there is no way to get rid of that Sender line. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-04 Thread Piet van Oostrum
s an error in the transmission, error messages should go to Charles. At least that is what the RFC's say. And I think that is the logical way to do it. Now some Microsoft mail programs will send replies to Charles, which is incorrect. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP

Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-04 Thread Piet van Oostrum
, SUBJECT ) + MESSAGE + "\r\n" You could even change that to: MESSAGE = "From: %s\r\n" + "To: %s\r\n" + "Subject: %s\r\n\r\n%s\r\n" % (FROM, TO, SUBJECT, MESSAGE) which I think is nicer. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-04 Thread Piet van Oostrum
he sent email, as this is something Gmail automatically provides. Maybe as some kind of spam detector, which is reasonable. Actually providing the Sender in situations like this is what the RFC requires, so Gmail is totally, completely correct in doing this. The problem is completely on the rec

Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-04 Thread Piet van Oostrum
, let it show all headers. Or if you don't trust that, just let the mail be sent to me. I can see exactly how it is. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-04 Thread Piet van Oostrum
Piet van Oostrum writes: > Ferrous Cranus writes: > >> I this hoq you mean? > [...] >> >> SUBJECT = u"Mail από τον επισκέπτη: ( %s )" % FROM >> >> MESSAGE = &qu

Re: how to detect comment in source code file ?

2013-09-05 Thread Piet van Oostrum
. Comments begin at any # > character that is not inside a string (something inside ' or " pairs). You could consider this a kind of nested comment :) # if condition: # # calculate the amount # amount = sum(parts) -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DA

Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread Piet van Oostrum
# send the mail > server.sendmail( MESSAGE ) > > both fail. The first thing you should do then is to look up the documentation of sendmail. http://docs.python.org/ has a good index where you can look for sendmail. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE14

Re: Multiprocessing / threading confusion

2013-09-05 Thread Piet van Oostrum
t all ticks are deliverd. In my system, only one tick per thread, and then it disappears. I have no idea if this is a bug. I certainly couldn't find it documented. The solution to this is to put a join statement in gogo: def gogo(qu): w = Worker(qu) w.start() w.join() -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Multiprocessing / threading confusion

2013-09-05 Thread Piet van Oostrum
Piet van Oostrum writes: > def run(self): > for n in range(5): > self.que.put('%s tick %d' % (self._pid, n)) > # do some work > time.sleep(1) > self.que.put('%s has exited' % self._pid) To preven

Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread Piet van Oostrum
olution would be to filter your mesaage through procmail or similar on your receiving computer. For example put the from address in an X-From header and let the filter replace the From header with the address from the X-From. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: file handling issues

2013-09-06 Thread Piet van Oostrum
d value to be lost and the file probably to be closed. Just messy. print("writing %s" % str(keys[0])+pasw) f.write(str(keys[0])+pasw) f.close() else: hesin=0 And how are people supposed to guess an 8 character password? Are they supposed to do that weird calculation on their calculators or some such? -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Chardet, file, ... and the Flexible String Representation

2013-09-06 Thread Piet van Oostrum
there are none. And you would have a lot more peace of mind if you stopped doing this. [*] array in the C sense. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Multiprocessing / threading confusion

2013-09-06 Thread Piet van Oostrum
) msg = self.q.get() print(msg) if 'END' in msg: break ..main.. processes = [] for i in range(5): d = Process(target=Worker, args=(debug_q,)) d.start() processes.append(d) for p in processes:

Re: file handling issues

2013-09-07 Thread Piet van Oostrum
user. If you use an internet connection then of course you can keep the relevant data outside of the reach of the user. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Tryign to send mail via a python script by using the local MTA

2013-09-17 Thread Piet van Oostrum
isking that temporarily your email cannot be delivered. I think you should give up this unholy idea, and just stick with the standard. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Making it a MultiThread!

2013-09-21 Thread Piet van Oostrum
ultiprocessing.current_process().name My advice would be to just do the GUI in the main module, and if the Action needs more time, the create a new Thread or Process in the Action class. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Making it a MultiThread!

2013-09-24 Thread Piet van Oostrum
. Very, very long files usually are not a good idea. Also you imported multiprocessing through anothe module. This obscures the structure of the application, and is unnecesary. You should only access a module through another module if you add a layer of abstraction that makes it easier or more

Re: python, pythontex and plots

2013-09-24 Thread Piet van Oostrum
ater. But if I am correct then the following might work: \newcommand{\filename}{} \edef\filename{\py{outputfile}} \includegraphics[scale=0.75]{\filename} -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: removing BOM prepended by codecs?

2013-09-24 Thread Piet van Oostrum
ion. The only difference is Fedora 18 v > Fedora 17. > > The BOMs are certainly there: > > <86> %R 10C0203z-621 > %A François-Xavier Le_Bourdonnec > > 000 206 255 373 % R 1 0 C 0 2 0 3 z - > That is not a BOM or SIG. It isn't

Re: Referrer key missing form os.environ dictionary?

2013-09-25 Thread Piet van Oostrum
ADDR'] )[0] or > UnKnown Host' >^ > SyntaxError: invalid syntax > > > i dont see anything wrong with that line, and the carret is actually > pointing to the "host". There is an apostrophe (') missing before UnKnown. host = socket.gethostbyaddr(

Re: Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2

2013-09-26 Thread Piet van Oostrum
python-requests.org/en/latest/) or the Uploading Files part from Doug Hellmann's page (http://doughellmann.com/2009/07/pymotw-urllib2-library-for-opening-urls.html). This is for Python2; I can send you a Python3 version if you want. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP k

Re: Weird bahaviour from shlex - line no

2013-09-28 Thread Piet van Oostrum
hars are > returned as single characters, so there is no need to peek ahead and the > lineno is not altered. > > In short: this looks like an implementation accident. I think shlex should be changed to give the line number of the start of the token in self.lineno. It isn't

Re: Handling 3 operands in an expression without raising an exception

2013-09-29 Thread Piet van Oostrum
> point you react that you want to get to Londen without boat > or plane but just by bicycle. And in further exchange make it > clear that using a bike is more important than arriving in London. And then the easiests would be to put your bicycle in the train. -- Piet v

Re: class implementation

2013-09-30 Thread Piet van Oostrum
les? -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: what is wrong in my code?? (python 3.3)

2013-09-30 Thread Piet van Oostrum
ding: import codecs sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach()) [Note: I haven't tested this] -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Functional Programming and python

2013-09-30 Thread Piet van Oostrum
is > bullshit. Tail recursion optimization throws away valuable stack trace information in case of an error. > 2. Lambda-expression body is limited to one expression. Why ? Allowing general statements in a lambda body makes indentation more difficult, I think. -- Piet van Oostrum W

Re: Functional Programming and python

2013-10-01 Thread Piet van Oostrum
Antoon Pardon writes: > Op 30-09-13 20:55, Piet van Oostrum schreef: >> Franck Ditter writes: >> >>> Good approach of FP in Python, but two points make me crazy : >>> 1. Tail recursion is not optimized. We are in 2013, why ? This is known >>> technolo

Re: I haev fixed it

2013-10-01 Thread Piet van Oostrum
FILE ON MY > ACCOUNT? > > PLEASE ANSWER ME, I WONT GET MAD, BUT THIS IS AN IMPORTANT SECURITY RISK. > > SOMEONES MUST HAVE ACCESS TO MY ACCOUNT, DOES THE SOURCE CODE OF MY MAIN > PYTHON SCRIPT APPEARS SOMEPLACE AGAIN?!?! These questions show that the one who put that

Re: JUST GOT HACKED

2013-10-01 Thread Piet van Oostrum
FILE ON MY > ACCOUNT? > > PLEASE ANSWER ME, I WONT GET MAD, BUT THIS IS AN IMPORTANT SECURITY RISK. > > SOMEONES MUST HAVE ACCESS TO MY ACCOUNT, DOES THE SOURCE CODE OF MY MAIN > PYTHON SCRIPT APPEARS SOMEPLACE AGAIN?!?! This shows that the warning was correct. -- Piet van Oos

Re: JUST GOT HACKED

2013-10-04 Thread Piet van Oostrum
also find it interesting to solve Python problems. I did not like Nikos' arrogance, ignorance and his refusal to use perfectly good solutions. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Why didn't my threads exit correctly ?

2013-10-05 Thread Piet van Oostrum
ist now, thanks again. Also make sure that l_ip and l_result are Queues instead of lists, as MRAB suggested. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Database statements via python but database left intact

2013-10-06 Thread Piet van Oostrum
sing, and also to study the underlying computer science concepts. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Odd-length string

2013-10-06 Thread Piet van Oostrum
7;'.join(tulemus2), and then to convert it to a string you have to specify the encoding, which should be 'ascii', as you say it is ASCII. str(b''.join(tulemus2), 'ascii') or b''.join(tulemus2).decode('ascii') But note: If your

Re: HEX to ASCII

2013-10-06 Thread Piet van Oostrum
\\', b'r', b'3', > b'\x1f', b'V', b's', b'9', b'\x1d'] > > the Key- is the key im using to decrypt the code. everything else is > generated by the decrytion process and the unhexlify command. So my guess is, > the join command cant handle the b"u" type of format. how can i get rid of > the b. > > Or does anyone have a better idea how to translate HEX into ASCII and sort > out the lines that make sense Why do you post the same question twice under different subjects? -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Select fails when cookie tried to get a numeric value

2013-10-06 Thread Piet van Oostrum
nd convert them one after one if you think it is necessary. For example a script that is seldom used can stay as CGI script. And last but not least: not every Apache installation has mod-wsgi enabled. I think most hosting providers don't. -- Piet van Oostrum WWW: http://pietva

Re: HEX to ASCII

2013-10-07 Thread Piet van Oostrum
oint with xxx = b''.join(tulemus2), and then you have another byte string. If you are sure this is ASCII (which means all bytes are < 128), the you can convert it to a string with str(xxx, 'ascii') or xxx.decode('ascii'). If there are bytes > 127 then you ha

Re: Tail recursion to while iteration in 2 easy steps

2013-10-07 Thread Piet van Oostrum
Alain Ketterlin writes: > BTW, does the original callable object have a ref counter? Is it garbage > collected in that case? If not, would it be considered a bug? In CPython ALL objects have ref counters. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE1

Re: Tail recursion to while iteration in 2 easy steps

2013-10-07 Thread Piet van Oostrum
mputation are you talking about? And what magica; effects? AFAIK there is no magic in computer science, although every sufficiently advanced ... -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Tail recursion to while iteration in 2 easy steps

2013-10-07 Thread Piet van Oostrum
ll optimization there is no need to do tail recursion optimization. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Re for Apache log file format

2013-10-09 Thread Piet van Oostrum
(7)() > -> pattern = re.compile(r'(?P\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s+' > (Pdb) n >> /Users/user/Documents/Python/apache.py(17)() > -> match = re.search(pattern, string) > (Pdb) Also as Andreas has noted the r'(?P\"\")\s+' part is wrong. It should probably be r'(?P\".*?\")\s+' And the r'(?P\((.*?)\))') will also not match as there is text outside the (). Should probably also be r'(?P\".*?\")') or something like it. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Cookie gets changed when hit comes from a referrer

2013-10-09 Thread Piet van Oostrum
65 # this cookie will > expire in a year > As Ian already has told you (but apparently you didn't pay attention to), your expires is wrong. So if your cookies disappear you should get this right first. from datetime import datetime, timedelta expiretime = datetime.u

Re: closure = decorator?

2013-10-10 Thread Piet van Oostrum
in this area). In Python, however, you can define the __call__ method and with this they become almost identical in behaviour. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3.2 | WIndows 7 -- Multiprocessing and files not closing

2013-10-10 Thread Piet van Oostrum
27;c:/testfile.h5' filename = 'c:\\testfile.h5' filename = r'c:\testfile.h5' -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3.2 | WIndows 7 -- Multiprocessing and files not closing

2013-10-10 Thread Piet van Oostrum
h the same problem posted a smaller, more complete example here: > Then you should give us real code (a minimal example) that we can try. You use myFunction in your example that isn't defined in your code. And by the way, why don't you close f just after reading? Or even better, use

Re: class implementation

2013-10-10 Thread Piet van Oostrum
therefore _WorldProper is not defined. from import * is considered bad practice anyway. It is better just to import the things you need. from pykkar import World, Pykkar, _WorldProper I have looked a bit in this pykkar.py and I think it is badly structured for extension. The three classes

Re: Multi-threading in Python vs Java

2013-10-11 Thread Piet van Oostrum
e Python will serve you just fine! Check out the threading > module, knock together a quick test, and spin it up! But it only works if the external C library has been written to release the GIL around the long computations. If not, then the OP could try to write a wrapper around them that does th

Re: Unicode Objects in Tuples

2013-10-11 Thread Piet van Oostrum
more help. But you can do everything you want with 2.x, I think. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Inter-process locking

2013-10-11 Thread Piet van Oostrum
ditions. File locking is generally the best solution for this kind of problems, unless you can make use of OS level semaphores. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Inter-process locking

2013-10-13 Thread Piet van Oostrum
can be done in a platform independent way without the risk of race conditions. Maybe I have to find out. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Would you l like to take over lockfile?

2013-10-13 Thread Piet van Oostrum
Skip Montanaro writes: > I don't have the time or inclination to continue supporting lockfile ( > https://pypi.python.org/ > pypi/lockfile/). If you'd like to take it over, let me know. > > Skip Hi Skip, I am interested. -- Piet van Oostrum WWW: http://pi

Re: Python was designed

2013-10-15 Thread Piet van Oostrum
cc, that I did not know) and used it to generate a parser for Algol 68. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: urllib2 timeout issue

2013-10-16 Thread Piet van Oostrum
socket.setdefaulttimeout(5) > > and it didn't make any difference. > > In both cases, Python version is "Python 2.7.3". > > Am I missing something ? > I would guess the difference to be caused by DNS. Maybe the DNS configuration on the RPi is not optimal. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: converting letters to numbers

2013-10-16 Thread Piet van Oostrum
IRC Lisp uses % for comments, but it may need to be doubled. (It's > been doubled in the examples I've seen, and I don't remember the > syntax.) > Perhaps Scheme has the same convention, but Scheme could be considered a > part of the Lisp clade. Lisp and scheme use

Re: Python was designed

2013-10-16 Thread Piet van Oostrum
ll due respect, Mark, your remarks are rubbish. Nobody talked about parsing input with binary switches except you. I answered that 40 years ago I wrote a parser generator that generated a parser for Algol 68 (and another one for Algol 60 I should have added). And all this was using punched cards.

Re: Python was designed (was Re: Multi-threading in Python vs Java)

2013-10-17 Thread Piet van Oostrum
ors that translated into pure C code, which was then compiled with a C compiler. The resulting intermediate C code would be an object-oriented program in C. IIRC, the C code was reasonably clear, not really convoluted, so you would have been able to write it yourself. -- Piet van Oostrum WWW: http://piet

Re: Markers on a matplotlib plot

2013-10-17 Thread Piet van Oostrum
t.show() > > I would like to place markers on the 4 curves when the price is equal to $20 > label it A, and when the price is equal to $40 and label it B. Does anyone > know how I can accomplish this. Something like: plt.plot(20,40, 'bo') plt.annotate('B', (20,40), xytex

Re: ANN: matplotlib 1.3.1

2013-10-18 Thread Piet van Oostrum
with tcl.h from Tcl 8.5 lipo: can't figure out the architecture type of: /var/folders/5r/5r4ywY4e2ReN7U+8ZPQSJTI/-Tmp-//ccXN6p4b.out error: command 'gcc-4.2' failed with exit status 1 You have new mail in /var/mail/piet bash-3.2$ hg ftp -su -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: ANN: matplotlib 1.3.1

2013-10-19 Thread Piet van Oostrum
Ned Deily writes: > In article , > Piet van Oostrum wrote: >> I tried to install it from source, on Mac OS X 10.6.8, with Python >> 3.3.2, and Tck/Tk 8.5 installed as Frameworks, but I get an error during >> compilation. It seems it doesn't find the Tcl/TK f

Re: Python Front-end to GCC

2013-10-21 Thread Piet van Oostrum
could make it easy. A language specification in BNF is just syntax. It doesn't say anything about semantics. So how could this be used to produce executable C code for a program? BNF is used to produce parsers. But a parser isn't sufficient. -- Piet van Oostrum WWW: http://pietvanoos

Re: Python Front-end to GCC

2013-10-22 Thread Piet van Oostrum
kens relate to each other. Syntax is grammar. Tokens are part of the grammar (but often specified separately with a different grammar, usually regular expressions, which is a subset of BNF). So are you just confused or are you trollong? -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Front-end to GCC

2013-10-22 Thread Piet van Oostrum
Neil Cerutti writes: > > Context-sensitive grammars can be parse, too. > That's not English. Do you mean "parsed"? But context-sentitive grammars cannot be specified by BNF. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https:/

Re: Python Front-end to GCC

2013-10-22 Thread Piet van Oostrum
mplete, it is not clear that > you will be able to compile it at all. That's the difference between > a calculator and a computer. You think a language that is not Turing-complete cannot be compiled? What nonsense is that. Please Mark, spare us your nonsense. -- Piet van Oostrum

Re: functools and objective usage

2013-10-22 Thread Piet van Oostrum
> functionality differ, Do you have experience with objective usage ? > http://docs.python.org/2/library/functools.html#partial-objects > What do you mean with "objective usage"? -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Cookie aint retrieving when visiting happens from a backlink.

2013-10-26 Thread Piet van Oostrum
my internet connection and then trying both the back button and entering the URL in the address bar. So it has nothing to do with referrer, I think. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Cookie aint retrieving when visiting happens from a backlink.

2013-10-26 Thread Piet van Oostrum
Piet van Oostrum writes: > Νίκος Αλεξόπουλος writes: > >> There is no set of cookie returned back when visitor comes from a referer. >> >> Isn't this strange? >> No matter if you visit a webpage as a direct hit or via a referer the >> cookie on the v

Re: how to avoid checking the same condition repeatedly ?

2013-10-28 Thread Piet van Oostrum
he condition every time through the for loop, even though there > is no chance for needs_processing to change inside the loop, which does not > look very efficient. I bet in most cases you won't notice the time used to check the condition. Beware of premature optimization! -- Piet van Oost

Re: trying to strip out non ascii.. or rather convert non ascii

2013-10-29 Thread Piet van Oostrum
sking for evidence you know you will never get. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Problem installing matplotlib 1.3.1 with Python 2.7.6 and 3.3.3 (release candidate 1)

2013-11-03 Thread Piet van Oostrum
ython should also include the Tcl/Tk header files. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Help me with this code PLEASE

2013-11-05 Thread Piet van Oostrum
CONVERT FROM LISTS TO LONG STRINGS SO I CAN STORE SUCCESSFULLY LIST > PYTHON DATATYPE TO MYSQL SCALAR STRING. > > EVERYHTIGN I TRIED FAILED. Then why don't you use the simple solution: use a relational database to store the data? -- Piet van Oostrum WWW: http://pietvanoostrum.c

Re: Help me with this code

2013-11-07 Thread Piet van Oostrum
returns None. So the print sequence_b(10) dosn't make sense. If the print is only for debugging the use the following: def sequence_b(N): result = 0 for k in range (1,N): step = ((-1)**(k+1))/(2*k-1) print(step) ## debug output result += step return result

Re: Adding 'download' column to existing 'visitors' table (as requested)

2013-11-07 Thread Piet van Oostrum
use an extra table of downlaods that i asoociate with table > visitors with a foreing key but decided to add an additional 'download' > column into the existant visitors table: Nikos, you are an excellent member of the Greek society. Listening to you makes it so much easier to under

Re: Adding 'download' column to existing 'visitors' table (as requested)

2013-11-08 Thread Piet van Oostrum
Sibylle Koczian writes: > Am 07.11.2013 14:14, schrieb Piet van Oostrum: >> Nick the Gr33k writes: >> >>> I have decided to take your advice. >>> I wasn't able to fit those 'lists' of mine into MySQL's varchar() >>> datatype afte

Re: splitting file/content into lines based on regex termination

2013-11-09 Thread Piet van Oostrum
', '#9 /\n58#0#', '10178#000#C S#S#124##001##DAY#Computer Systems#Roper,\nPaul#3#MWF#11:00am#11:50am#1170 TMCB ', '#41 /\n145#0#', '10178#000#C S#S#124##002##DAY#Computer Systems#Roper,\nPaul#3#MWF#2:00pm#2:50pm#1170 TMCB ', '#40 /\n120#0#

Re: Sort list of dictionaries

2015-03-02 Thread Emile van Sebille
On 3/2/2015 10:17 AM, Charles Heizer wrote: Hello, I'm new to python and I'm trying to find the right way to solve this issue I have. I'm trying to sort this list by name and then by version numbers. The problem I'm having is that I can not get the version numbers sorted with the highest at t

<    1   2   3   4   5   6   7   8   9   10   >