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
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
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
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
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
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
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
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
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/
>
> 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
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
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
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
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 .
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,
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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
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
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
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.
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
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
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
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
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
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
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, '*
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
> --
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
>
> --
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
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')):
>
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
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 _
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':'
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
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:
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
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:
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
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:
>
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
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
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
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
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
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
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
"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
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
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
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
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
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
- 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
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
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
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'
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(
77 matches
Mail list logo