[issue24159] Misleading TypeError when pickling bytes to a file opened as text

2015-05-10 Thread Jon Clements
Changes by Jon Clements jon...@googlemail.com: -- nosy: +joncle ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24159 ___ ___ Python-bugs-list

[issue23864] issubclass without registration only works for one-trick pony collections ABCs.

2015-04-04 Thread Jon Clements
Changes by Jon Clements jon...@googlemail.com: -- nosy: +joncle ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23864 ___ ___ Python-bugs-list

[issue18925] select.poll.modify is not documented

2013-12-07 Thread Jon Clements
Jon Clements added the comment: Was looking up epoll.modify and noticed in the docs it's listed as Modify a register file descriptor. - I believe that should be Modify a registered file descriptor... -- nosy: +joncle ___ Python tracker rep

[issue19363] Python 2.7's future_builtins.map is not compatible with Python 3's map

2013-10-23 Thread Jon Clements
Changes by Jon Clements jon...@googlemail.com: -- nosy: +joncle ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19363 ___ ___ Python-bugs-list

[issue15136] Decimal accepting Fraction

2012-06-22 Thread Jon Clements
New submission from Jon Clements jon...@googlemail.com: I'm not a numeric expert but I was looking at a post on S/O which related to converting a Fraction to a certain amount of decimal places. I've had a hunt on the tracker but couldn't find anything relevant, but if I've missed it, I

[issue15136] Decimal accepting Fraction

2012-06-22 Thread Jon Clements
Jon Clements jon...@googlemail.com added the comment: Mark - I bow to your superiour knowledge here. However, would not a classmethod of .from_fraction be welcome? ie, I could write: d = D.from_fraction(5, 7) Then the documents labour the point about what you've mentioned? Just an idea

[issue15136] Decimal accepting Fraction

2012-06-22 Thread Jon Clements
Jon Clements jon...@googlemail.com added the comment: Not sure what's going on with my machine today: keep sending things to early. I meant: D.from_fraction(F) where if F is not of type Fraction, then the args are used to construct a Fraction - so can use an existing or create one

[issue15136] Decimal accepting Fraction

2012-06-22 Thread Jon Clements
Jon Clements jon...@googlemail.com added the comment: The more I think about this - the shades of grey kick in. D.from_fraction(F or creatable F) Then it would be 'reasonable to assume' for a F.to_decimal() to exist. Possibly with an optional context argument. Then, what happens if I do D

Re: Is that safe to use ramdom.random() for key to encrypt?

2012-06-17 Thread Jon Clements
On Sun, 17 Jun 2012 23:17:37 +, Steven D'Aprano wrote: On Mon, 18 Jun 2012 08:41:57 +1000, Chris Angelico wrote: On Mon, Jun 18, 2012 at 3:06 AM, Rafael Durán Castañeda rafadurancastan...@gmail.com wrote: The language Python includes a SystemRandom class that obtains cryptographic

Re: Is that safe to use ramdom.random() for key to encrypt?

2012-06-16 Thread Jon Clements
On Sun, 17 Jun 2012 12:31:04 +1000, Chris Angelico wrote: On Sun, Jun 17, 2012 at 12:15 PM, Yesterday Paid howmuchisto...@gmail.com wrote: I'm making cipher program with random.seed(), random.random() as the key table of encryption. I'm not good at security things and don't know much about

Re: file pointer array

2012-06-06 Thread Jon Clements
On 06/06/12 18:54, Prasad, Ramit wrote: data= [] for index in range(N, 1): # see Chris Rebert's comment with open('data%d.txt' % index,'r') as f: data.append( f.readlines() ) I think data.extend(f) would be a better choice. Jon. --

Re: file pointer array

2012-06-06 Thread Jon Clements
On 06/06/12 19:51, MRAB wrote: On 06/06/2012 19:28, Jon Clements wrote: On 06/06/12 18:54, Prasad, Ramit wrote: data= [] for index in range(N, 1): # see Chris Rebert's comment with open('data%d.txt' % index,'r') as f: data.append( f.readlines() ) I think data.extend(f) would be a better

Re: Compare 2 times

2012-06-06 Thread Jon Clements
On 06/06/12 14:39, Christian Heimes wrote: Am 06.06.2012 14:50, schrieb loial: I have a requirement to test the creation time of a file with the current time and raise a message if the file is more than 15 minutes old. Platform is Unix. I have looked at using os.path.getctime for the file

Re: DBF records API

2012-06-01 Thread Jon Clements
On 01/06/12 23:13, Tim Chase wrote: On 06/01/12 15:05, Ethan Furman wrote: MRAB wrote: I'd probably think of a record as being more like a dict (or an OrderedDict) with the fields accessed by key: record[name] but: record.deleted Record fields are accessible both by key and by

Re: sqlite INSERT performance

2012-05-31 Thread Jon Clements
On Thursday, 31 May 2012 16:25:10 UTC+1, duncan smith wrote: On 31/05/12 06:15, John Nagle wrote: On 5/30/2012 6:57 PM, duncan smith wrote: Hello, I have been attempting to speed up some code by using an sqlite database, but I'm not getting the performance gains I expected. SQLite is

Re: Email Id Verification

2012-05-25 Thread Jon Clements
On Friday, 25 May 2012 14:36:18 UTC+1, Grant Edwards wrote: On 2012-05-25, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thu, 24 May 2012 05:32:16 -0700, niks wrote: Hello everyone.. I am new to asp.net... I want to use Regular Expression validator in Email id

Re: Dynamic comparison operators

2012-05-25 Thread Jon Clements
Any time you find yourself thinking that you want to use eval to solve a problem, take a long, cold shower until the urge goes away. If you have to ask why eval is dangerous, then you don't know enough about programming to use it safely. Scrub it out of your life until you have learned

usenet reading

2012-05-25 Thread Jon Clements
Hi All, Normally use Google Groups but it's becoming absolutely frustrating - not only has the interface changed to be frankly impractical, the posts are somewhat random of what appears, is posted and whatnot. (Ironically posted from GG) Is there a server out there where I can get my news

Re: A question of style (finding item in list of tuples)

2012-05-21 Thread Jon Clements
On Monday, 21 May 2012 13:37:29 UTC+1, Roy Smith wrote: I've got this code in a django app: CHOICES = [ ('NONE', 'No experience required'), ('SAIL', 'Sailing experience, new to racing'), ('RACE', 'General racing experience'), ('GOOD', 'Experienced

Re: key/value store optimized for disk storage

2012-05-05 Thread Jon Clements
On Friday, 4 May 2012 16:27:54 UTC+1, Steve Howell wrote: On May 3, 6:10 pm, Miki Tebeka miki.teb...@gmail.com wrote: I'm looking for a fairly lightweight key/value store that works for this type of problem: I'd start with a benchmark and try some of the things that are already in

Re: HTML Code - Line Number

2012-04-28 Thread Jon Clements
On Friday, 27 April 2012 18:09:57 UTC+1, smac...@comcast.net wrote: Hello, For scrapping purposes, I am having a bit of trouble writing a block of code to define, and find, the relative position (line number) of a string of HTML code. I can pull out one string that I want, and then there

Re: HTML Code - Line Number

2012-04-27 Thread Jon Clements
SMac2347 at comcast.net writes: Hello, [snip] Any thoughts as to how to define a function to do this, or do this some other way? All insight is much appreciated! Thanks. Did you not see my reply to your previous thread? And why do you want the line number? Jon. --

Re: Web Scraping - Output File

2012-04-26 Thread Jon Clements
SMac2347 at comcast.net writes: Hello, I am having some difficulty generating the output I want from web scraping. Specifically, the script I wrote, while it runs without any errors, is not writing to the output file correctly. It runs, and creates the output .txt file; however, the

Re: Using arguments in a decorator

2012-04-21 Thread Jon Clements
On Saturday, 21 April 2012 09:25:40 UTC+1, Steven D#39;Aprano wrote: On Fri, 20 Apr 2012 09:10:15 -0700, Jon Clements wrote: But I don't know how. I know that I can see the default arguments of the original function using func.__defaults__, but without knowing the number and names

Re: Newbie, homework help, please.

2012-04-21 Thread Jon Clements
On Saturday, 21 April 2012 18:35:26 UTC+1, someone wrote: On Saturday, April 21, 2012 12:28:33 PM UTC-5, someone wrote: Ok, this is my dillema, not only am I new to this programming buisness, before the last few days, I did not even know what python was, and besides opening up the

Re: Using arguments in a decorator

2012-04-20 Thread Jon Clements
On Friday, 20 April 2012 16:57:06 UTC+1, Rotwang wrote: Hi all, here's a problem I don't know how to solve. I'm using Python 2.7.2. I'm doing some stuff in Python which means I have cause to call functions that take a while to return. Since I often want to call such a function more than

Re: Regular expressions, help?

2012-04-19 Thread Jon Clements
On Thursday, 19 April 2012 07:11:54 UTC+1, Sania wrote: Hi, So I am trying to get the number of casualties in a text. After 'death toll' in the text the number I need is presented as you can see from the variable called text. Here is my code I'm pretty sure my regex is correct, I think it's

Re: How do you refer to an iterator in docs?

2012-04-19 Thread Jon Clements
On Thursday, 19 April 2012 13:21:20 UTC+1, Roy Smith wrote: Let's say I have a function which takes a list of words. I might write the docstring for it something like: def foo(words): Foo-ify words (which must be a list) What if I want words to be the more general case of something

Re: escaping

2012-04-16 Thread Jon Clements
On Monday, 16 April 2012 11:03:31 UTC+1, Kiuhnm wrote: On 4/16/2012 4:42, Steven D'Aprano wrote: On Sun, 15 Apr 2012 23:07:36 +0200, Kiuhnm wrote: This is the behavior I need: path = path.replace('\\', '') msg = . {} .. '{}' .. {} ..format(a, path, b) Is there a

Re: ordering with duck typing in 3.1

2012-04-09 Thread Jon Clements
On Monday, 9 April 2012 12:33:25 UTC+1, Neil Cerutti wrote: On 2012-04-07, Jon Clements jon...@googlemail.com wrote: Any reason you can't derive from int instead of object? You may also want to check out functions.total_ordering on 2.7+ functools.total_ordering I was temporarily

ordering with duck typing in 3.1

2012-04-07 Thread Jon Clements
Any reason you can't derive from int instead of object? You may also want to check out functions.total_ordering on 2.7+ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Gotcha's?

2012-04-05 Thread Jon Clements
On Wednesday, 4 April 2012 23:34:20 UTC+1, Miki Tebeka wrote: Greetings, I'm going to give a Python Gotcha's talk at work. If you have an interesting/common Gotcha (warts/dark corners ...) please share. (Note that I want over http://wiki.python.org/moin/PythonWarts already). Thanks,

Re: Async IO Server with Blocking DB

2012-04-04 Thread Jon Clements
On Tuesday, 3 April 2012 23:13:24 UTC+1, looking for wrote: Hi We are thinking about building a webservice server and considering python event-driven servers i.e. Gevent/Tornado/ Twisted or some combination thereof etc. We are having doubts about the db io part. Even with connection

Re: Best way to structure data for efficient searching

2012-04-02 Thread Jon Clements
On Wednesday, 28 March 2012 19:39:54 UTC+1, larry@gmail.com wrote: I have the following use case: I have a set of data that is contains 3 fields, K1, K2 and a timestamp. There are duplicates in the data set, and they all have to processed. Then I have another set of data with 4

Re: help with subclassing problem

2012-04-02 Thread Jon Clements
On Thursday, 29 March 2012 21:23:20 UTC+1, Peter wrote: I am attempting to subclass the date class from the datetime package. Basically I want a subclass that can take the date as a string (in multiple formats), parse the string and derive the year,month and day information to create a

Re: Data mining/pattern recogniton software in Python?

2012-03-23 Thread Jon Clements
On Friday, 23 March 2012 16:43:40 UTC, Grzegorz Staniak wrote: Hello, I've been asked by a colleague for help in a small educational project, which would involve the recognition of patterns in a live feed of data points (readings from a measuring appliance), and then a more general

Re: Fetching data from a HTML file

2012-03-23 Thread Jon Clements
On Friday, 23 March 2012 13:52:05 UTC, Sangeet wrote: Hi, I've got to fetch data from the snippet below and have been trying to match the digits in this to specifically to specific groups. But I can't seem to figure how to go about stripping the tags! :( trtd

Re: Python is readable (OT)

2012-03-22 Thread Jon Clements
On Thursday, 22 March 2012 08:56:17 UTC, Steven D#39;Aprano wrote: On Wed, 21 Mar 2012 18:35:16 -0700, Steve Howell wrote: On Mar 21, 11:06 am, Nathan Rice nathan.alexander.r...@gmail.com wrote: [snip]. Different programming languages are good for different things because they have

Re: urllib.urlretrieve never returns???

2012-03-19 Thread Jon Clements
On Monday, 19 March 2012 19:32:03 UTC, Laszlo Nagy wrote: The pythonw.exe may not have the rights to access network resources. Have you set a default timeout for sockets? import socket socket.setdefaulttimeout(10) # 10 seconds I have added pythonw.exe to allowed exceptions. Disabled

Re: Style question (Poll)

2012-03-15 Thread Jon Clements
On Wednesday, 14 March 2012 21:16:05 UTC, Terry Reedy wrote: On 3/14/2012 4:49 PM, Arnaud Delobelle wrote: On 14 March 2012 20:37, Croephacroe...@gmail.com wrote: Which is preferred: for value in list: if not value is another_value: value.do_something() break Do you

Re: How to decide if a object is instancemethod?

2012-03-14 Thread Jon Clements
On Wednesday, 14 March 2012 13:28:58 UTC, Cosmia Luna wrote: class Foo(object): def bar(self): return 'Something' func = Foo().bar if type(func) == type 'instancemethod': # This should be always true pass # do something here What should type at type 'instancemethod'?

Re: Jinja2 + jQuery tabs widget

2012-03-14 Thread Jon Clements
On Wednesday, 14 March 2012 14:16:35 UTC, JoeM wrote: Hi All, I'm having issues including a {block} of content from Jinja2 template into a jQueryUI tab. Does anyone know if such a thing is possible? An example is below, which gives me a 500 error when loading the page. Thanks, Joe

Re: Global join function?

2012-03-14 Thread Jon Clements
On Wednesday, 14 March 2012 18:41:27 UTC, Darrel Grant wrote: In the virtualenv example bootstrap code, a global join function is used. http://pypi.python.org/pypi/virtualenv subprocess.call([join(home_dir, 'bin', 'easy_install'), 'BlogApplication']) In

Re: Fast file data retrieval?

2012-03-12 Thread Jon Clements
On Monday, 12 March 2012 20:31:35 UTC, MRAB wrote: On 12/03/2012 19:39, Virgil Stokes wrote: I have a rather large ASCII file that is structured as follows header line 9 nonblank lines with alphanumeric data header line 9 nonblank lines with alphanumeric data ... ... ...

Re: Finding MIME type for a data stream

2012-03-08 Thread Jon Clements
On Thursday, 8 March 2012 23:40:13 UTC, Tobiah wrote: I have to assume you're talking python 2, since in python 3, strings cannot generally contain image data. In python 2, characters are pretty much interchangeable with bytes. Yeah, python 2 if you're looking for a specific,

Re: os.stat last accessed attribute updating last accessed value

2012-02-06 Thread Jon Clements
On Feb 4, 9:33 pm, Python_Junkie software.buy.des...@gmail.com wrote: I am trying to obtain the last accessed date.  About 50% of the files' attributes were updated such that the file was last accessed when this script touches the file. I was not opening the files Anyone have a thought of

Re: Constraints -//- first release -//- Flexible abstract class based validation for attributes, functions and code blocks

2012-01-27 Thread Jon Clements
On Jan 27, 6:38 am, Nathan Rice nathan.alexander.r...@gmail.com wrote: May I suggest a look at languages such as ATS and Epigram? They use types that constrain values specifically to prove things about your program. Haskell is a step, but as far as proving goes, it's less powerful than it

Re: Find the mime type of a file.

2012-01-25 Thread Jon Clements
On Jan 25, 5:04 pm, Olive di...@bigfoot.com wrote: I want to have a list of all the images in a directory. To do so I want to have a function that find the mime type of a file. I have found mimetypes.guess_type but it only works by examining the extension. In GNU/Linux the file utility do much

Re: Parsing a serial stream too slowly

2012-01-23 Thread Jon Clements
On Jan 23, 9:48 pm, M.Pekala mcdpek...@gmail.com wrote: Hello, I am having some trouble with a serial stream on a project I am working on. I have an external board that is attached to a set of sensors. The board polls the sensors, filters them, formats the values, and sends the formatted

Re: can some one help me with my code. thanks

2012-01-20 Thread Jon Clements
On Jan 20, 9:26 pm, Terry Reedy tjre...@udel.edu wrote: On 1/20/2012 2:46 PM, Terry Reedy wrote: On 1/20/2012 1:49 PM, Tamanna Sultana wrote: can some one help me?? I would like to create a function that, given a bin, which is a list (example below), generates averages for the

Re: my new project, is this the right way?

2011-11-14 Thread Jon Clements
On Nov 14, 10:41 am, Tracubik affdfsdfds...@b.com wrote: Hi all, i'm developing a new program. Mission: learn a bit of database management Idea: create a simple, 1 window program that show me a db of movies i've seen with few (10) fields (actors, name, year etc) technologies i'll use: python

Re: Py2.7/FreeBSD: maximum number of open files

2011-11-14 Thread Jon Clements
On Nov 14, 5:03 pm, Tobias Oberstein tobias.oberst...@tavendo.de wrote: I need 50k sockets + 100 files. Thus, this is even more strange: the Python (a Twisted service) will happily accept 50k sockets, but as soon as you do open() a file, it'll bail out. A limit of 32k smells like

Re: Get keys from a dicionary

2011-11-11 Thread Jon Clements
On Nov 11, 1:31 pm, macm moura.ma...@gmail.com wrote: Hi Folks I pass a nested dictionary to a function. def Dicty( dict[k1][k2] ):         print k1         print k2 There is a fast way (trick) to get k1 and k2 as string. Whithout loop all dict. Just it! Regards macm I've tried to

Re: simple file flow question with csv.reader

2011-11-02 Thread Jon Clements
On Nov 2, 11:50 pm, Terry Reedy tjre...@udel.edu wrote: On 11/2/2011 7:06 PM, Dennis Lee Bieber wrote: On Wed, 2 Nov 2011 14:13:34 -0700 (PDT), Mattmacma...@gmail.com declaimed the following in gmane.comp.python.general: I have a few hundred .csv files, and to each file, I want to

Re: understand program used to create file

2011-11-01 Thread Jon Clements
On Nov 1, 7:27 pm, pacopyc paco...@gmail.com wrote: Hi, I have about 1 files .doc and I want know the program used to create them: writer? word? abiword? else? I'd like develop a script python to do this. Is there a module to do it? Can you help me? Thanks My suggestion would be the same

Re: Loop through a dict changing keys

2011-10-16 Thread Jon Clements
On Oct 16, 12:53 am, PoD p...@internode.on.net wrote: On Sat, 15 Oct 2011 11:00:17 -0700, Gnarlodious wrote: What is the best way (Python 3) to loop through dict keys, examine the string, change them if needed, and save the changes to the same dict? So for input like this: {'Mobile':

Re: Reading a file into a data structure....

2011-10-13 Thread Jon Clements
On Oct 13, 10:59 pm, MrPink tdsimp...@gmail.com wrote: This is a continuing to a post I made in August:http://groups.google.com/group/comp.lang.python/browse_thread/thread/... I got some free time to work with Python again and have some followup questions. For example, I have a list in a

Re: Looking for browser emulator

2011-10-13 Thread Jon Clements
On Oct 14, 3:19 am, Roy Smith r...@panix.com wrote: I've got to write some tests in python which simulate getting a page of HTML from an http server, finding a link, clicking on it, and then examining the HTML on the next page to make sure it has certain features. I can use urllib to do the

Re: Looking for browser emulator

2011-10-13 Thread Jon Clements
On Oct 14, 3:19 am, Roy Smith r...@panix.com wrote: I've got to write some tests in python which simulate getting a page of HTML from an http server, finding a link, clicking on it, and then examining the HTML on the next page to make sure it has certain features. I can use urllib to do the

Re: Usefulness of the not in operator

2011-10-08 Thread Jon Clements
On Oct 8, 11:42 am, candide cand...@free.invalid wrote: Python provides      -- the not operator, meaning logical negation      -- the in operator, meaning membership On the other hand, Python provides the not in operator meaning non-membership. However, it seems we can reformulate any not

Re: Simplest way to resize an image-like array

2011-09-30 Thread Jon Clements
On Sep 30, 5:40 pm, John Ladasky lada...@my-deja.com wrote: Hi folks, I have 500 x 500 arrays of floats, representing 2D grayscale images, that I need to resample at a lower spatial resolution, say, 120 x 120 (details to follow, if you feel they are relevant). I've got the numpy, and scipy,

Re: Wrote a new library - Comments and suggestions please!

2011-09-27 Thread Jon Clements
On Sep 27, 6:33 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: Robert Kern wrote: On 9/27/11 10:24 AM, Tal Einat wrote: I don't work with SAS so I have no reason to invest any time developing for it. Also, as far as I can tell, SAS is far from free or open-source,

Re: Wrote a new library - Comments and suggestions please!

2011-09-26 Thread Jon Clements
On Sep 26, 12:23 pm, Tal Einat talei...@gmail.com wrote: The library is called RunningCalcs and is useful for running several calculations on a single iterable of values. https://bitbucket.org/taleinat/runningcalcs/http://pypi.python.org/pypi/RunningCalcs/ I'd like some input on how this

Re: Need help with simple OOP Python question

2011-09-05 Thread Jon Clements
On Sep 5, 3:43 pm, Peter Otten __pete...@web.de wrote: Kristofer Tengström wrote: Thanks everyone, moving the declaration to the class's __init__ method did the trick. Now there's just one little problem left. I'm trying to create a list that holds the parents for each instance in the

Re: How does this work?

2011-06-05 Thread Jon Clements
On Jun 5, 4:37 am, Ben Finney ben+pyt...@benfinney.id.au wrote: jyoun...@kc.rr.com writes: I was surfing around looking for a way to split a list into equal sections. I came upon this algorithm: f = lambda x, n, acc=[]: f(x[n:], n, acc+[(x[:n])]) if x else acc f(Hallo Welt, 3)

Re: checking if a list is empty

2011-05-06 Thread Jon Clements
On May 7, 12:51 am, Ian Kelly ian.g.ke...@gmail.com wrote: On Fri, May 6, 2011 at 4:21 PM, Philip Semanchuk phi...@semanchuk.com wrote: What if it's not a list but a tuple or a numpy array? Often I just want to iterate through an element's items and I don't care if it's a list, set, etc.

Re: Finding empty columns. Is there a faster way?

2011-04-21 Thread Jon Clements
On Apr 21, 5:40 pm, nn prueba...@latinmail.com wrote: time head -100 myfile  /dev/null real    0m4.57s user    0m3.81s sys     0m0.74s time ./repnullsalt.py '|' myfile 0 1 Null columns: 11, 20, 21, 22, 23, 24, 25, 26, 27, 30, 31, 33, 45, 50, 68 real    1m28.94s user    1m28.11s

Re: TextWrangler run command not working properly

2011-04-14 Thread Jon Clements
On Apr 14, 9:52 pm, Fabio oakw...@email.it wrote: Hi to all, I have troubles with TextWrangler run command in the shebang (#!) menu. I am on MacOSX 10.6.7. I have the built-in Python2.5 which comes installed by mother Apple. Then I installed Python2.6, and left 2.5 untouched (I was suggested

Re: pattern matching

2011-02-24 Thread Jon Clements
On Feb 24, 2:11 am, monkeys paw mon...@joemoney.net wrote: if I have a string such as 'td01/12/2011/td' and i want to reformat it as '20110112', how do i pull out the components of the string and reformat them into a DDMM format? I have: import re test = re.compile('\d\d\/') f =

Re: Arrays/List, filters, Pytho, Ruby

2011-02-11 Thread Jon Clements
On Feb 11, 9:24 pm, LL.Snark ll.sn...@gmail.com wrote: Hi, I'm looking for a pythonic way to translate this short Ruby code : t=[6,7,8,6,7,9,8,4,3,6,7] i=t.index {|x| xt.first} If you don't know Ruby, the second line means : What is the index, in array t, of the first element x such that

Re: For loop comprehensions

2011-02-11 Thread Jon Clements
On Feb 11, 11:10 pm, Benjamin S Wolf bsw...@google.com wrote: It occurred to me as I was writing a for loop that I would like to write it in generator comprehension syntax, eg.   for a in b if c: rather than using one of the more verbose but allowable syntaxes:   for a in (x for x in b if

Re: Converting getCSS Count Code from java to python

2011-02-02 Thread Jon Clements
On Feb 1, 4:23 am, SMERSH009 smersh0...@gmail.com wrote: Hi, I'd love some help converting this code to the python equivalent: private int getCSSCount(String aCSSLocator){     String jsScript = var cssMatches = eval_css(\%s\, window.document);cssMatches.length;;     return

Re: how to tell if cursor is sqlite.Cursor or psycopg2.Cursor

2011-01-24 Thread Jon Clements
On Jan 24, 7:44 pm, dmaziuk dmaz...@bmrb.wisc.edu wrote: Hi everyone, I've wrapper class around some sql statements and I'm trying to add a method that does:   if my_cursor is a sqlite cursor, then run select last_insert_rowid()   else if it's a psycopg2 cursor, then run select currval(

Re: statement level resumable exception

2011-01-21 Thread Jon Clements
On Jan 21, 8:41 am, ilejn ilja.golsht...@gmail.com wrote: Arnaud, it looks like a solution. Perhaps it is better than plain try/accept and than proxy class with __getattr__. It is not for free, e.g. because syntax check such as parentheses matching is lazy too, though looks very

Re: Developing a program to make a family tree.

2011-01-14 Thread Jon Clements
On Jan 14, 7:39 pm, Ata Jafari a.j.romani...@gmail.com wrote: Hi there. I'm trying to develop a program like family tree maker. I have all information, so there is no need to search on the net. This must be something like trees. Can someone help me? I'm at the beginning. Thanks. -- Ata J.

Re: Career path - where next?

2011-01-12 Thread Jon Clements
On Jan 12, 4:37 pm, Alan Harris-Reid aharrisr...@googlemail.com wrote: Hi there, I wonder if any Python folk out there can help me. For many years I was a contractor developing desktop and web applications using Visual Foxpro as my main language, with Foxpro, SQL-server and Oracle as back-end

Re: Building sys.path at run-time?

2010-12-30 Thread Jon Clements
On Dec 30, 4:24 am, Roy Smith r...@panix.com wrote: In article 87k4irhpoa@benfinney.id.au,  Ben Finney ben+pyt...@benfinney.id.au wrote: Roy Smith r...@panix.com writes: I've got a problem that I'm sure many people have solved many times. Our project has a bunch of python scripts

Re: Hosting a Python based TCP server

2010-12-23 Thread Jon Clements
On Dec 23, 12:01 pm, Oltmans rolf.oltm...@gmail.com wrote: Hi all, I'm writing a very small TCP server(written in Python) and now I want to host it on some ISP so that it can be accessed anywhere from the Internet. I've never done that before so I thought I should ask for some advice. Do you

Re: Partition Recursive

2010-12-23 Thread Jon Clements
On Dec 23, 5:26 pm, macm moura.ma...@gmail.com wrote: Hi Folks I have this: url = 'http://docs.python.org/dev/library/stdtypes.html? highlight=partition#str.partition' So I want convert to myList =

Re: help with link parsing?

2010-12-22 Thread Jon Clements
On Dec 22, 4:24 pm, Colin J. Williams cjwilliam...@gmail.com wrote: On 21-Dec-10 12:22 PM, Jon Clements wrote: import lxml from urlparse import urlsplit doc = lxml.html.parse('http://www.google.com') print map(urlsplit, doc.xpath('//a/@href')) [SplitResult(scheme='http', netloc

Re: Modifying an existing excel spreadsheet

2010-12-21 Thread Jon Clements
On Dec 20, 9:56 pm, Ed Keith e_...@yahoo.com wrote: I have a user supplied 'template' Excel spreadsheet. I need to create a new excel spreadsheet based on the supplied template, with data filled in. I found the tools herehttp://www.python-excel.org/, 

Re: help with link parsing?

2010-12-21 Thread Jon Clements
On Dec 20, 7:14 pm, Littlefield, Tyler ty...@tysdomain.com wrote: Hello all, I have a question. I guess this worked pre 2.6; I don't remember the last time I used it, but it was a while ago, and now it's failing. Anyone mind looking at it and telling me what's going wrong? Also, is there a

Re: Scanning directories for new files?

2010-12-21 Thread Jon Clements
On Dec 21, 7:17 pm, Matty Sarro msa...@gmail.com wrote: Hey everyone. I'm in the midst of writing a parser to clean up incoming files, remove extra data that isn't needed, normalize some values, etc. The base files will be uploaded via FTP. How does one go about scanning a directory for new

Specialisation / Interests

2010-12-21 Thread Jon Clements
Hi all, Was thinking tonight (now this morning my time): What would we consider the long time posters on c.l.p consider what they respond to and offer serious advice on. For instance: - Raymond Hettinger for algo's in collections and itertools - MRAB for regex's (never seen him duck a post

Re: Case Sensitive Section names configparser

2010-12-08 Thread Jon Clements
On Dec 8, 10:32 am, RedBaron dheeraj.gup...@gmail.com wrote: Is there any way by which configParser's get() function can be made case insensitive? I would probably subclass dict to create a string specific, case insensitive version, and supply it as the dict_type. See

Re: Login using usrllib2

2010-12-01 Thread Jon Clements
On Dec 1, 10:16 am, Chris Rebert c...@rebertia.com wrote: On Wed, Dec 1, 2010 at 1:53 AM,  dudeja.ra...@gmail.com wrote: Hi All, I'm using urllib2 module to login to an https server. However I'm unable to login as the password is not getting accepted. Here is the code: import

Re: Packages at Python.org

2010-12-01 Thread Jon Clements
On Dec 1, 8:56 pm, kirby.ur...@gmail.com kirby.ur...@gmail.com wrote: http://packages.python.org/dbf/ So how *do* you get source code from such a web place?  I'm not finding a tar ball or installer.  Sorry if I'm missing something obvious, like a link to Sourceforge. Thanks to very

Re: Packages at Python.org

2010-12-01 Thread Jon Clements
On Dec 1, 10:32 pm, Ethan Furman et...@stoneleaf.us wrote: kirby.ur...@gmail.com wrote: With Microsoft abandoning Visual FoxPro come 2015, we have 100K developers jumping ship (rough guess), perhaps to dot NET, but not necessarily.** This page is potentially getting a lot of hits (I'm

Re: Parsing markup.

2010-11-26 Thread Jon Clements
On Nov 26, 4:03 am, MRAB pyt...@mrabarnett.plus.com wrote: On 26/11/2010 03:28, Joe Goldthwaite wrote:   I’m attempting to parse some basic tagged markup.  The output of the   TinyMCE editor returns a string that looks something like this;     pThis is a paragraph with bbold/b and iitalic/i

Re: memory management - avoid swapping/paging

2010-10-22 Thread Jon Clements
On 21 Oct, 16:45, Nobody nob...@nowhere.com wrote: On Thu, 21 Oct 2010 02:34:15 -0700, Jon Clements wrote: I'm after something that says: I want 512mb of physical RAM, I don't want you to page/swap it, if you can't do that, don't bother at all. Now I'm guessing, that an OS might be able

Re: Reading Outlook .msg file using Python

2010-10-21 Thread Jon Clements
On 20 Oct, 18:13, John Henry john106he...@hotmail.com wrote: On Oct 20, 9:01 am, John Henry john106he...@hotmail.com wrote: On Oct 20, 1:41 am, Tim Golden m...@timgolden.me.uk wrote: On 19/10/2010 22:48, John Henry wrote: Looks like this flag is valid only if you are getting

memory management - avoid swapping/paging

2010-10-21 Thread Jon Clements
Hi all, Is there a cross-platform way using Python to guarantee that an object will never be swapped/paged to disk? I'll be honest and say I'm really not sure if this is a particular language question or rather specific to an OS. Under linux it appears I could create a ramfs and mmap a file

Re: PEP 249 (database api) -- executemany() with iterable?

2010-10-13 Thread Jon Clements
On 12 Oct, 20:21, J. Gerlach gerlach_jo...@web.de wrote: Am 12.10.2010 17:10, schrieb Roy Smith: [A]re there any plans to update the api to allow an iterable instead of a sequence? sqlite3 (standard library, python 2.6.6., Windows 32Bit) does that already:: import sqlite3 as sql

Re: PEP 249 (database api) -- executemany() with iterable?

2010-10-12 Thread Jon Clements
On 12 Oct, 16:10, Roy Smith r...@panix.com wrote: PEP 249 says about executemany():         Prepare a database operation (query or command) and then         execute it against all parameter sequences or mappings         found in the sequence seq_of_parameters. are there any plans to update

Re: PEP 249 (database api) -- executemany() with iterable?

2010-10-12 Thread Jon Clements
On 12 Oct, 18:32, Roy Smith r...@panix.com wrote: On Oct 12, 1:20 pm, Jon Clements jon...@googlemail.com wrote: On 12 Oct, 16:10, Roy Smith r...@panix.com wrote: PEP 249 says about executemany():         Prepare a database operation (query or command) and then         execute

Re: PEP 249 (database api) -- executemany() with iterable?

2010-10-12 Thread Jon Clements
On 12 Oct, 18:53, Jon Clements jon...@googlemail.com wrote: On 12 Oct, 18:32, Roy Smith r...@panix.com wrote: On Oct 12, 1:20 pm, Jon Clements jon...@googlemail.com wrote: On 12 Oct, 16:10, Roy Smith r...@panix.com wrote: PEP 249 says about executemany():         Prepare

[issue9944] Typo in doc for itertools recipe of consume

2010-09-24 Thread Jon Clements
New submission from Jon Clements jon...@googlemail.com: Very low priority. def consume(iterator, n): Advance the iterator n-steps ahead. If n is none, consume entirely. # Use functions that consume iterators at C speed. if n is None: # feed the entire iterator into a zero

re.sub: escaping capture group followed by numeric(s)

2010-09-17 Thread Jon Clements
Hi All, (I reckon this is probably a question for MRAB and is not really Python specific, but anyhow...) Absolutely basic example: re.sub(r'(\d+)', r'\1', 'string1') I've been searching around and I'm sure it'll be obvious when it's pointed out, but how do I use the above to replace 1 with 11?

Re: re.sub: escaping capture group followed by numeric(s)

2010-09-17 Thread Jon Clements
On 17 Sep, 19:59, Peter Otten __pete...@web.de wrote: Jon Clements wrote: (I reckon this is probably a question for MRAB and is not really Python specific, but anyhow...) Absolutely basic example: re.sub(r'(\d+)', r'\1', 'string1') I've been searching around and I'm sure it'll

Re: palindrome iteration

2010-08-28 Thread Jon Clements
On Aug 28, 11:55 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Sat, 28 Aug 2010 09:22:13 +0300, Jussi Piitulainen wrote: Terry Reedy writes: On 8/27/2010 3:43 PM, Jussi Piitulainen wrote: Dave Angel writes: [snip] Not everything needs to be a built-in method. There

  1   2   3   >