Re: extracting string.Template substitution placeholders

2014-01-16 Thread gmflanagan
On Sunday, January 12, 2014 3:08:31 PM UTC, Eric S. Johansson wrote: > As part of speech recognition accessibility tools that I'm building, I'm > > using string.Template. In order to construct on-the-fly grammar, I need > > to know all of the identifiers before the template is filled in. what i

Re: Converting folders of jpegs to single pdf per folder

2014-01-16 Thread vasishtha . spier
On Thursday, January 16, 2014 12:07:59 PM UTC-8, Tim Golden wrote: > > Here's a quick example. > This should walk down the Python directory, creating a text file for > each directory. The textfile will contain the names of all the files in > the directory. (NB this might create a lot of text fi

Re: Is it possible to protect python source code by compiling it to .pyc or .pyo?

2014-01-16 Thread Steven D'Aprano
On Thu, 16 Jan 2014 16:58:48 -0800, Sam wrote: > I would like to protect my python source code. It need not be foolproof > as long as it adds inconvenience to pirates. What makes you think that "pirates" will be the least bit interested in your code? No offence intended, I'm sure you worked real

Re: Guessing the encoding from a BOM

2014-01-16 Thread Rustom Mody
On Friday, January 17, 2014 7:10:05 AM UTC+5:30, Tim Chase wrote: > On 2014-01-17 11:14, Chris Angelico wrote: > > UTF-8 specifies the byte order > > as part of the protocol, so you don't need to mark it. > You don't need to mark it when writing, but some idiots use it > anyway. If you're sniffin

Re: Compiling main script into .pyc

2014-01-16 Thread Terry Reedy
On 1/16/2014 10:19 PM, MRAB wrote: On 2014-01-17 02:56, bob gailer wrote: On 1/16/2014 8:01 PM, Sam wrote: One thing I observe about python byte-code compiling is that the main script does not gets compiled into .pyc. Only imported modules are compiled into .pyc. May I know how can I compile t

Re: Compiling main script into .pyc

2014-01-16 Thread Dave Angel
MRAB Wrote in message: > On 2014-01-17 02:56, bob gailer wrote: >> On 1/16/2014 8:01 PM, Sam wrote: >>> One thing I observe about python byte-code compiling is that the main >>> script does not gets compiled into .pyc. Only imported modules are compiled >>> into .pyc. >>> >>> May I know how can

Re: Compiling main script into .pyc

2014-01-16 Thread MRAB
On 2014-01-17 02:56, bob gailer wrote: On 1/16/2014 8:01 PM, Sam wrote: One thing I observe about python byte-code compiling is that the main script does not gets compiled into .pyc. Only imported modules are compiled into .pyc. May I know how can I compile the main script into .pyc? Duh? Jus

Re: Compiling main script into .pyc

2014-01-16 Thread Ned Batchelder
On 1/16/14 8:01 PM, Sam wrote: One thing I observe about python byte-code compiling is that the main script does not gets compiled into .pyc. Only imported modules are compiled into .pyc. May I know how can I compile the main script into .pyc? It is to inconvenience potential copy-cats. The

Re: Compiling main script into .pyc

2014-01-16 Thread bob gailer
On 1/16/2014 8:01 PM, Sam wrote: One thing I observe about python byte-code compiling is that the main script does not gets compiled into .pyc. Only imported modules are compiled into .pyc. May I know how can I compile the main script into .pyc? Duh? Just import it! -- https://mail.python.org/

Re: Process datafeed in one MySql table and output to another MySql table

2014-01-16 Thread Jason Friedman
> > I have a datafeed which is constantly sent to a MySql table. The table > grows constantly as the data feeds in. I would like to write a python > script which process the data in this table and output the processed data > to another table in another MySql database in real-time. > > Which are the

Re: Process datafeed in one MySql table and output to another MySql table

2014-01-16 Thread Denis McMahon
On Thu, 16 Jan 2014 17:03:24 -0800, Sam wrote: > I have a datafeed which is constantly sent to a MySql table ... > Which are the python libraries which are suitable for this purpose? Are > there any useful sample code or project on the web that I can use as > reference? Did you search for mysql

Re: Python solve problem with string operation

2014-01-16 Thread Asaf Las
inpu = "3443331123377" tstr = inpu[0] for k in range(1, len(inpu)): if inpu[k] != inpu[k-1] : tstr = tstr + inpu[k] print(tstr) -- https://mail.python.org/mailman/listinfo/python-list

Re: Guessing the encoding from a BOM

2014-01-16 Thread Tim Chase
On 2014-01-17 11:14, Chris Angelico wrote: > UTF-8 specifies the byte order > as part of the protocol, so you don't need to mark it. You don't need to mark it when writing, but some idiots use it anyway. If you're sniffing a file for purposes of reading, you need to look for it and remove it from

Re: Is it possible to protect python source code by compiling it to .pyc or .pyo?

2014-01-16 Thread Ethan Furman
On 01/16/2014 05:09 PM, Chris Angelico wrote: On Fri, Jan 17, 2014 at 11:58 AM, Sam wrote: I would like to protect my python source code. It need not be foolproof as long as it adds inconvenience to pirates. Is it possible to protect python source code by compiling it to .pyc or .pyo? Does .

Re: Guessing the encoding from a BOM

2014-01-16 Thread Steven D'Aprano
On Thu, 16 Jan 2014 11:37:29 -0800, Albert-Jan Roskam wrote: > On Thu, 1/16/14, Chris > Angelico wrote: > > Subject: Re: Guessing the encoding from a BOM To: > Cc: "python-list@python.org" Date: Thursday, > January 16, 2014, 7:06 PM > > On Fri,

Re: Python solve problem with string operation

2014-01-16 Thread Rhodri James
On Thu, 16 Jan 2014 22:24:40 -, Nac Temha wrote: Hi everyone, I want to do operation with chars in the given string. Actually I want to grouping the same chars. For example; input : "3443331123377" operation-> (3)(44)()(333)(11)(2)(33)(77) output: "34131237" How can I

Re: Is it possible to protect python source code by compiling it to .pyc or .pyo?

2014-01-16 Thread Chris Angelico
On Fri, Jan 17, 2014 at 11:58 AM, Sam wrote: > I would like to protect my python source code. It need not be foolproof as > long as it adds inconvenience to pirates. > > Is it possible to protect python source code by compiling it to .pyc or .pyo? > Does .pyo offer better protection? > The only

Re: Is it possible to protect python source code by compiling it to .pyc or .pyo?

2014-01-16 Thread Ben Finney
Sam writes: > I would like to protect my python source code. Protect it from what? If there's some specific activity you want to prevent or restrict, please say what it is, since “protect” is a rather loaded term. > It need not be foolproof as long as it adds inconvenience to pirates. I doubt

Process datafeed in one MySql table and output to another MySql table

2014-01-16 Thread Sam
I have a datafeed which is constantly sent to a MySql table. The table grows constantly as the data feeds in. I would like to write a python script which process the data in this table and output the processed data to another table in another MySql database in real-time. Which are the python li

Re: Is it possible to protect python source code by compiling it to .pyc or .pyo?

2014-01-16 Thread Ned Batchelder
On 1/16/14 7:58 PM, Sam wrote: I would like to protect my python source code. It need not be foolproof as long as it adds inconvenience to pirates. Is it possible to protect python source code by compiling it to .pyc or .pyo? Does .pyo offer better protection? First, .pyc and .pyo are nearl

Compiling main script into .pyc

2014-01-16 Thread Sam
One thing I observe about python byte-code compiling is that the main script does not gets compiled into .pyc. Only imported modules are compiled into .pyc. May I know how can I compile the main script into .pyc? It is to inconvenience potential copy-cats. -- https://mail.python.org/mailman/li

Re: interactive help on the base object

2014-01-16 Thread Terry Reedy
On 12/6/2013 8:35 PM, Terry Reedy wrote: On 12/6/2013 12:03 PM, Mark Lawrence wrote: Is it just me, or is this basically useless? >>> help(object) Help on class object in module builtins: class object | The most base type Given that this can be interpreted as 'least desirable', it could

Is it possible to protect python source code by compiling it to .pyc or .pyo?

2014-01-16 Thread Sam
I would like to protect my python source code. It need not be foolproof as long as it adds inconvenience to pirates. Is it possible to protect python source code by compiling it to .pyc or .pyo? Does .pyo offer better protection? -- https://mail.python.org/mailman/listinfo/python-list

Re: Python solve problem with string operation

2014-01-16 Thread giacomo boffi
giacomo boffi writes: > % python a.py > 34131237 % cat a.py i="3443331123377";n=0 while n+1!=len(i):i,n=(i[:n]+i[n+1:],n) if i[n+1]==i[n] else (i,n+1) print i % python a.py 34131237 % -- for Nikos -- https://mail.python.org/mailman/listinfo/python-list

Re: Python solve problem with string operation

2014-01-16 Thread Denis McMahon
On Fri, 17 Jan 2014 00:24:40 +0200, Nac Temha wrote: > Hi everyone, > > I want to do operation with chars in the given string. Actually I want > to grouping the same chars. > > For example; > > input : "3443331123377" > operation-> (3)(44)()(333)(11)(2)(33)(77) > output: "341312

Re: Python solve problem with string operation

2014-01-16 Thread giacomo boffi
Nac Temha writes: > Hi everyone, > > I want to do operation with chars in the given string. Actually I want to > grouping the same chars. > > For example; > > input : "3443331123377" > operation-> (3)(44)()(333)(11)(2)(33)(77) > output: "34131237" > > > > How can I do without list

Re: Guessing the encoding from a BOM

2014-01-16 Thread Chris Angelico
On Fri, Jan 17, 2014 at 6:37 AM, Albert-Jan Roskam wrote: > Can you elaborate on that? Unless your utf-8 files will only contain ascii > characters I do not understand why you would not want a bom utf-8. It's completely unnecessary, and could cause problems (the BOM is actually whitespace, albei

Re: Unicode strings as arguments to exceptions

2014-01-16 Thread Terry Reedy
On 1/16/2014 9:16 AM, Steven D'Aprano wrote: On Thu, 16 Jan 2014 13:34:08 +0100, Ernest Adrogué wrote: Hi, There seems to be some inconsistency in the way exceptions handle Unicode strings. Yes. I believe the problem lies in the __str__ method. For example, KeyError manages to handle Unicode

Re: Unicode strings as arguments to exceptions

2014-01-16 Thread Terry Reedy
On 1/16/2014 7:34 AM, Ernest Adrogué wrote: Hi, There seems to be some inconsistency in the way exceptions handle Unicode strings. For instance, KeyError seems to not have a problem with them raise KeyError('a') Traceback (most recent call last): File "", line 1, in KeyError: 'a' raise

Re: Python solve problem with string operation

2014-01-16 Thread John Gordon
In Mark Lawrence writes: > > input = "3443331123377" > > output = [] > > previous_ch = None > > for ch in input: > > if ch != previous_ch: > > output.append(ch) > > previous_ch = ch > > print ''.join(output) > > > Cheat, you've used a list :) Ack! I missed that

Re: Python solve problem with string operation

2014-01-16 Thread Mark Lawrence
On 16/01/2014 22:30, John Gordon wrote: In Nac Temha writes: --047d7b6d95d0367a3d04f01de490 Content-Type: text/plain; charset=ISO-8859-1 Hi everyone, I want to do operation with chars in the given string. Actually I want to grouping the same chars. For example; input : "34433

Re: Python solve problem with string operation

2014-01-16 Thread Tim Chase
On 2014-01-17 00:24, Nac Temha wrote: > Hi everyone, > > I want to do operation with chars in the given string. Actually I > want to grouping the same chars. > > For example; > > input : "3443331123377" > operation-> (3)(44)()(333)(11)(2)(33)(77) > output: "34131237" > > How can

Re: Python solve problem with string operation

2014-01-16 Thread John Gordon
In Nac Temha writes: > --047d7b6d95d0367a3d04f01de490 > Content-Type: text/plain; charset=ISO-8859-1 > Hi everyone, > I want to do operation with chars in the given string. Actually I want to > grouping the same chars. > For example; > input : "3443331123377" > operation-> (3)(44)(1

Python solve problem with string operation

2014-01-16 Thread Nac Temha
Hi everyone, I want to do operation with chars in the given string. Actually I want to grouping the same chars. For example; input : "3443331123377" operation-> (3)(44)()(333)(11)(2)(33)(77) output: "34131237" How can I do without list, regular expression. just using string op

Re: 'Straße' ('Strasse') and Python 2

2014-01-16 Thread Travis Griggs
On Jan 16, 2014, at 2:51 AM, Robin Becker wrote: > I assure you that I fully understand my ignorance of ... Robin, don’t take this personally, I totally got what you meant. At the same time, I got a real chuckle out of this line. That beats “army intelligence” any day. -- https://mail.

Re: Converting folders of jpegs to single pdf per folder

2014-01-16 Thread vasishtha . spier
On Thursday, January 16, 2014 12:12:01 PM UTC-8, Tim Golden wrote: > On 16/01/2014 20:07, Tim Golden wrote: > > > This should walk down the Python directory, > s/the Python directory/some directory/ > (Sorry, I initially had it walking os.path.dirname(sys.executable)) > TJG Thanks Tim thats very

Re: Converting folders of jpegs to single pdf per folder

2014-01-16 Thread Tim Golden
On 16/01/2014 20:07, Tim Golden wrote: This should walk down the Python directory, s/the Python directory/some directory/ (Sorry, I initially had it walking os.path.dirname(sys.executable)) TJG -- https://mail.python.org/mailman/listinfo/python-list

Re: Converting folders of jpegs to single pdf per folder

2014-01-16 Thread Tim Golden
On 16/01/2014 19:50, vasishtha.sp...@gmail.com wrote: On Thursday, January 16, 2014 11:41:04 AM UTC-8, Tim Golden wrote: The usual go-to library for PDF generation is ReportLab. I haven't used it for a long while but I'm quite certain it would have no problem including images. Do I take it

Re: Converting folders of jpegs to single pdf per folder

2014-01-16 Thread Mark Lawrence
On 16/01/2014 19:50, vasishtha.sp...@gmail.com wrote: On Thursday, January 16, 2014 11:41:04 AM UTC-8, Tim Golden wrote: On 16/01/2014 19:11, Harry Spier wrote: Dear list members, I have a directory that contains about a hundred subdirectories named J0001,J0002,J0003 . . . etc.

Re: Converting folders of jpegs to single pdf per folder

2014-01-16 Thread vasishtha . spier
On Thursday, January 16, 2014 11:41:04 AM UTC-8, Tim Golden wrote: > On 16/01/2014 19:11, Harry Spier wrote: > > > > > > Dear list members, > > > > > > I have a directory that contains about a hundred subdirectories named > > > J0001,J0002,J0003 . . . etc. > > > Each of these subdirectories c

Re: Guessing the encoding from a BOM

2014-01-16 Thread Albert-Jan Roskam
On Thu, 1/16/14, Chris Angelico wrote: Subject: Re: Guessing the encoding from a BOM To: Cc: "python-list@python.org" Date: Thursday, January 16, 2014, 7:06 PM On Fri, Jan 17, 2014 at 5:01 AM, Björn Lindqvist wrote: > 2014/1/16 Steven D'Ap

Re: Converting folders of jpegs to single pdf per folder

2014-01-16 Thread Tim Golden
On 16/01/2014 19:11, Harry Spier wrote: Dear list members, I have a directory that contains about a hundred subdirectories named J0001,J0002,J0003 . . . etc. Each of these subdirectories contains about a hundred JPEGs named P001.jpg, P002.jpg, P003.jpg etc. I need to write a python script that

Converting folders of jpegs to single pdf per folder

2014-01-16 Thread Harry Spier
Dear list members, I have a directory that contains about a hundred subdirectories named J0001,J0002,J0003 . . . etc. Each of these subdirectories contains about a hundred JPEGs named P001.jpg, P002.jpg, P003.jpg etc. I need to write a python script that will cycle thru each directory and convert

Re: Guessing the encoding from a BOM

2014-01-16 Thread Tim Chase
On 2014-01-17 05:06, Chris Angelico wrote: > > You might want to add the utf8 bom too: '\xEF\xBB\xBF'. > > I'd actually rather not. It would tempt people to pollute UTF-8 > files with a BOM, which is not necessary unless you are MS Notepad. If the intent is to just sniff and parse the file acco

Re: Python glob and raw string

2014-01-16 Thread Neil Cerutti
On 2014-01-16, Chris Angelico wrote: >> Hmmm... I might be doing too much in __init__. ;) > > Hmm, why is it even a class? :) I guess you elided all the > stuff that makes it impractical to just use a non-class > function. I didn't remove anything that makes it obviously class-worthy, just timest

Re: Python glob and raw string

2014-01-16 Thread Chris Angelico
On Fri, Jan 17, 2014 at 5:14 AM, Neil Cerutti wrote: > class Miner: > def __init__(self, archive): > # setup goes here; prepare to acquire the data > self.descend(os.path.join(archive, '*')) > > def descend(self, path): > for fname in glob.glob(os.path.join(path, '*

Re: Python glob and raw string

2014-01-16 Thread Neil Cerutti
On 2014-01-16, Xaxa Urtiz wrote: > Hello everybody, i've got a little problem, i've made a script > which look after some files in some directory, typically my > folder are organized like this : > > [share] > folder1 > ->20131201 > -->file1.xml > -->file2.txt > ->20131202 > -->file9696009.tmp > --

Re: Python glob and raw string

2014-01-16 Thread Xaxa Urtiz
Le jeudi 16 janvier 2014 17:49:57 UTC+1, Xaxa Urtiz a écrit : > Hello everybody, i've got a little problem, i've made a script which look > after some files in some directory, typically my folder are organized like > this : > > > > [share] > > folder1 > > ->20131201 > > -->file1.xml > > --

Re: Guessing the encoding from a BOM

2014-01-16 Thread Chris Angelico
On Fri, Jan 17, 2014 at 5:01 AM, Björn Lindqvist wrote: > 2014/1/16 Steven D'Aprano : >> def guess_encoding_from_bom(filename, default): >> with open(filename, 'rb') as f: >> sig = f.read(4) >> if sig.startswith((b'\xFE\xFF', b'\xFF\xFE')): >> return 'utf_16' >> elif si

Re: Guessing the encoding from a BOM

2014-01-16 Thread Björn Lindqvist
2014/1/16 Steven D'Aprano : > def guess_encoding_from_bom(filename, default): > with open(filename, 'rb') as f: > sig = f.read(4) > if sig.startswith((b'\xFE\xFF', b'\xFF\xFE')): > return 'utf_16' > elif sig.startswith((b'\x00\x00\xFE\xFF', b'\xFF\xFE\x00\x00')): >

Re: data validation when creating an object

2014-01-16 Thread Robert Kern
On 2014-01-16 04:05, Roy Smith wrote: Rita writes: I know its frowned upon to do work in the __init__() method and only declarations should be there. In article , Ben Finney wrote: Who says it's frowned on to do work in the initialiser? Where are they saying it? That seems over-broad, I

Re: data validation when creating an object

2014-01-16 Thread Robert Kern
On 2014-01-16 16:18, Roy Smith wrote: On Thursday, January 16, 2014 10:46:10 AM UTC-5, Robert Kern wrote: I prefer to keep my __init__() methods as dumb as possible to retain the flexibility to construct my objects in different ways. Sure, it's convenient to, say, pass a filename and have the _

Re: Building and accessing an array of dictionaries

2014-01-16 Thread Mark Lawrence
On 16/01/2014 09:48, Chris Angelico wrote: On Thu, Jan 16, 2014 at 8:41 PM, Sam wrote: I would like to build an array of dictionaries. Most of the dictionary example on the net are for single dictionary. dict = {'a':'a','b':'b','c':'c'} dict2 = {'a':'a','b':'b','c':'c'} dict3 = {'a':'a','b':'

Python glob and raw string

2014-01-16 Thread Xaxa Urtiz
Hello everybody, i've got a little problem, i've made a script which look after some files in some directory, typically my folder are organized like this : [share] folder1 ->20131201 -->file1.xml -->file2.txt ->20131202 -->file9696009.tmp -->file421378932.xml etc so basically in the share i'v

Re: data validation when creating an object

2014-01-16 Thread Skip Montanaro
I suspect when best to validate inputs depends on when they come in, and what the cost is of having objects with invalid state. If the input is something that is passed along when the object is instantiated, you kind of have to validate in __init__ or __new__, right? Let's create a stupid example:

Re: data validation when creating an object

2014-01-16 Thread Roy Smith
On Thursday, January 16, 2014 10:46:10 AM UTC-5, Robert Kern wrote: > I prefer to keep my __init__() methods as dumb as possible to retain the > flexibility to construct my objects in different ways. Sure, it's convenient > to, > say, pass a filename and have the __init__() open() it for me. Bu

Re: Is it possible to get string from function?

2014-01-16 Thread Roy Smith
On Thursday, January 16, 2014 5:59:42 AM UTC-5, Albert-Jan Roskam wrote: > what would be wrong with the following approach: > > import unittest > class Test(unittest.TestCase): > > receipts = {} > > def unique_value(self, k, v): > assert Test.receipts.get(k) is None, "Duplicate:

Re: 'Straße' ('Strasse') and Python 2

2014-01-16 Thread Tim Chase
On 2014-01-16 14:07, Steven D'Aprano wrote: > The unicode type in Python 2.x is less-good because: > > - it is missing some functionality, e.g. casefold; Just for the record, str.casefold() wasn't added until 3.3, so earlier 3.x versions (such as the 3.2.3 that is the default python3 on Debian St

Re: Is it possible to get string from function?

2014-01-16 Thread Peter Otten
Albert-Jan Roskam wrote: > On Thu, 1/16/14, Peter Otten <__pete...@web.de> wrote: >> class Foo(unittest.TestCase): >> @unique_receipt("foo") >> def test_t1(self, RECEIPT): >> pass > Very cool approach. Question, though: what would be wrong > with the following approach: >

Re: Unicode strings as arguments to exceptions

2014-01-16 Thread Roy Smith
In article <52d7e9a0$0$2$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Thu, 16 Jan 2014 13:34:08 +0100, Ernest Adrogué wrote: > > > Hi, > > > > There seems to be some inconsistency in the way exceptions handle > > Unicode strings. > > Yes. I believe the problem lies in

Re: Is it possible to get string from function?

2014-01-16 Thread Roy Smith
In article <52d7874d$0$6599$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Is the mapping of receipt string to test fixed? That is, is it important > that test_t1 *always* runs with "some string", test_t2 "some other > string", and so forth? Yes. -- https://mail.python.org/mai

Re: Unicode strings as arguments to exceptions

2014-01-16 Thread Steven D'Aprano
On Thu, 16 Jan 2014 13:34:08 +0100, Ernest Adrogué wrote: > Hi, > > There seems to be some inconsistency in the way exceptions handle > Unicode strings. Yes. I believe the problem lies in the __str__ method. For example, KeyError manages to handle Unicode, although in an ugly way: py> str(KeyE

Re: 'Straße' ('Strasse') and Python 2

2014-01-16 Thread Steven D'Aprano
On Thu, 16 Jan 2014 10:51:42 +, Robin Becker wrote: > On 16/01/2014 00:32, Steven D'Aprano wrote: >>> >Or are you saying thatwww.unicode.org is wrong about the definitions >>> >of Unicode terms? >> No, I think he is saying that he doesn't know Unicode anywhere near as >> well as he thinks he

Re: 'StraÃYe' ('Strasse') and Python 2

2014-01-16 Thread Robin Becker
On 16/01/2014 12:06, Frank Millman wrote: .. I assure you that I fully understand my ignorance of unicode. Until recently I didn't even know that the unicode in python 2.x is considered broken and that str in python 3.x is considered 'better'. Hi Robin I am pretty sure that Steven was

Re: Python 3.x adoption

2014-01-16 Thread Piet van Oostrum
Travis Griggs writes: > Personally, I wish they’d start python4, sure would take the heat out of > the 3 vs 2 debates. And maybe there’d be a program called twentyfour as > a result. twelve would be sufficient, I would think. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE14

Unicode strings as arguments to exceptions

2014-01-16 Thread Ernest Adrogué
Hi, There seems to be some inconsistency in the way exceptions handle Unicode strings. For instance, KeyError seems to not have a problem with them >>> raise KeyError('a') Traceback (most recent call last): File "", line 1, in KeyError: 'a' >>> raise KeyError(u'ä') Traceback (most recent call

Re: 'Stra�Ye' ('Strasse') and Python 2

2014-01-16 Thread Frank Millman
"Robin Becker" wrote in message news:52d7b9be.9020...@chamonix.reportlab.co.uk... > On 16/01/2014 00:32, Steven D'Aprano wrote: >>> >Or are you saying thatwww.unicode.org is wrong about the definitions >>> >of >>> >Unicode terms? >> No, I think he is saying that he doesn't know Unicode anywher

Re: data validation when creating an object

2014-01-16 Thread Rita
Thanks everyone for the replies. On Thu, Jan 16, 2014 at 1:36 AM, Cameron Simpson wrote: > On 16Jan2014 15:53, Ben Finney wrote: > > Roy Smith writes: > > > Ben Finney wrote: > > > > Who says it's frowned on to do work in the initialiser? Where are > they > > > > saying it? That seems ove

Re: Python program distribution - a source of constant friction

2014-01-16 Thread Nicholas Cole
On Tue, Jan 7, 2014 at 12:09 AM, Nicholas Cole wrote: [SNIP] > Even so, things like that are harder to create than they > could be, or less prominently documented than one might have expected. > > Case in point: I have an application a friend/colleague of mine would like > to look at. I've no i

Re: Is it possible to get string from function?

2014-01-16 Thread Albert-Jan Roskam
On Thu, 1/16/14, Peter Otten <__pete...@web.de> wrote: Subject: Re: Is it possible to get string from function? To: python-list@python.org Date: Thursday, January 16, 2014, 9:52 AM Roy Smith wrote: > I realize the subject line is kind of mean

Re: 'Straße' ('Strasse') and Python 2

2014-01-16 Thread Chris Angelico
On Thu, Jan 16, 2014 at 9:51 PM, Robin Becker wrote: > On 16/01/2014 00:32, Steven D'Aprano wrote: >>> >>> >Or are you saying thatwww.unicode.org is wrong about the definitions of >>> >Unicode terms? >> >> No, I think he is saying that he doesn't know Unicode anywhere near as >> well as he thinks

Re: 'Straße' ('Strasse') and Python 2

2014-01-16 Thread Robin Becker
On 16/01/2014 00:32, Steven D'Aprano wrote: >Or are you saying thatwww.unicode.org is wrong about the definitions of >Unicode terms? No, I think he is saying that he doesn't know Unicode anywhere near as well as he thinks he does. The question is, will he cherish his ignorance, or learn from th

Re: Building and accessing an array of dictionaries

2014-01-16 Thread Jean-Michel Pichavant
- Original Message - > I would like to build an array of dictionaries. Most of the > dictionary example on the net are for single dictionary. > > dict = {'a':'a','b':'b','c':'c'} > dict2 = {'a':'a','b':'b','c':'c'} > dict3 = {'a':'a','b':'b','c':'c'} > > arr = (dict,dict2,dict3) > > What

Re: Building and accessing an array of dictionaries

2014-01-16 Thread Jussi Piitulainen
Sam writes: > I would like to build an array of dictionaries. Most of the > dictionary example on the net are for single dictionary. > > dict = {'a':'a','b':'b','c':'c'} > dict2 = {'a':'a','b':'b','c':'c'} > dict3 = {'a':'a','b':'b','c':'c'} > > arr = (dict,dict2,dict3) > > What is the syntax t

Re: Building and accessing an array of dictionaries

2014-01-16 Thread Chris Angelico
On Thu, Jan 16, 2014 at 8:41 PM, Sam wrote: > I would like to build an array of dictionaries. Most of the dictionary > example on the net are for single dictionary. > > dict = {'a':'a','b':'b','c':'c'} > dict2 = {'a':'a','b':'b','c':'c'} > dict3 = {'a':'a','b':'b','c':'c'} > > arr = (dict,dict2,d

Building and accessing an array of dictionaries

2014-01-16 Thread Sam
I would like to build an array of dictionaries. Most of the dictionary example on the net are for single dictionary. dict = {'a':'a','b':'b','c':'c'} dict2 = {'a':'a','b':'b','c':'c'} dict3 = {'a':'a','b':'b','c':'c'} arr = (dict,dict2,dict3) What is the syntax to access the value of dict3->'a'

Re: Is it possible to get string from function?

2014-01-16 Thread Peter Otten
Roy Smith wrote: > I realize the subject line is kind of meaningless, so let me explain :-) > > I've got some unit tests that look like: > > class Foo(TestCase): > def test_t1(self): > RECEIPT = "some string" > > def test_t2(self): > RECEIPT = "some other string" > > def test_t3(