[issue33084] Computing median, median_high an median_low in statistics library

2018-03-16 Thread Luc

Luc <ouaga...@gmail.com> added the comment:

If we are trying to fix this, the behavior should be like computing the mean or 
harmonic mean with the statistics library when there are missing values in the 
data.  At least that way, it is consistent with how the statistics library 
works when computing with NaNs in the data.  Then again, it should be mentioned 
somewhere in the docs.

import statistics as stats
import numpy as np
import pandas as pd
data = [75, 90,85, 92, 95, 80, np.nan]
stats.mean(data)
nan
stats.harmonic_mean(data)
nan
stats.stdev(data)
nan
As you can see, when there is a missing value, computing the mean, harmonic 
mean and sample standard deviation with the statistics library 
return a nan.
However, with the median, median_high and median_low, it computes those 
statistics incorrectly with the missing values present in the data.
It is better to return a nan, then let the user drop (or resolve) any missing 
values before computing.
## Another example using pandas serie
df = pd.DataFrame(data, columns=['data'])
df.head()
data
0   75.0
1   90.0
2   85.0
3   92.0
4   95.0
5   80.0
6   NaN

### Use the statistics library to compute the median of the serie
stats.median(df1['data'])
90
 
## Pandas returns the correct median by dropping the missing values
## Now use pandas to compute the median of the serie with missing value
df['data'].median()
87.5

I did not test the median_grouped in statistics library, but will let you know 
afterwards if its affected as well.

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33084>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33084] Computing median, median_high an median_low in statistics library

2018-03-16 Thread Luc

Luc <ouaga...@gmail.com> added the comment:

Just to make sure we are focused on the issue, the reported bug is with the 
statistics library (not with numpy). It happens, when there is at least one 
missing value in the data and involves the computation of the median, 
median_low and median_high using the statistics library.
The test was performed on Python 3.6.4.

When there is no missing values (NaNs) in the data, computing the median, 
median_high and median_low from the statistics library work fine.
So, yes, removing the NaNs (or imputing for them) before computing the 
median(s) resolve the issue.
Also, just like statistics.mean(data) when data has missing return a nan, the 
median, median_high and median_low should  behave the same way.

import numpy
import statistics as stats

data = [75, 90,85, 92, 95, 80, np.nan]

Median = stats.median(data) 
Median_high = stats.median_high(data)
Median_low = stats.median_low(data)
print("The incorrect Median is", Median)
The incorrect Median is, 90
print("The incorrect median high is", Median_high)
The incorrect median high is, 90
print("The incorrect median low is", Median_low)
The incorrect median low is, 90

## Mean returns nan
Mean = stats.mean(data)
prin("The mean is", Mean)
The mean is, nan

Now, when we drop the missing values, we have:
data2 = [75, 90,85, 92, 95, 80]
stats.median(data2)
87.5
stats.median_high(data2)
90
stats.median_low(data2)
85

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33084>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33084] Computing median, median_high an median_low in statistics library

2018-03-15 Thread Luc

New submission from Luc <ouaga...@gmail.com>:

When a list or dataframe serie contains NaN(s), the median, median_low and 
median_high are computed in Python 3.6.4 statistics library, however, the 
results are wrong.
Either, it should return a NaN just like when we try to compute a mean or point 
the user to drop the NaNs before computing those statistics.
Example:
import numpy as np
import statistics as stats

data = [75, 90,85, 92, 95, 80, np.nan]
Median  = stats.median(data)
Median_low = stats.median_low(data)
Median_high = stats.median_high(data)
The results from above return ALL 90 which are incorrect.

Correct answers should be:
Median = 87.5
Median_low  = 85
Median_high = 92
Thanks,
Luc

--
components: Library (Lib)
messages: 313933
nosy: dcasmr
priority: normal
severity: normal
status: open
title: Computing median, median_high an median_low in statistics library
type: behavior
versions: Python 3.6

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33084>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30941] Missing line in example program

2017-07-16 Thread Luc Bougé

New submission from Luc Bougé:

On page <https://docs.python.org/3.6/_sources/library/stdtypes.txt>, the 
following program is listed.

It raises a syntactic error.

An empty line is missing after "... n += val" to close the loop body. 

   >>> # iteration
   >>> n = 0
   >>> for val in values:
   ... n += val
   >>> print(n)
   504

--
assignee: docs@python
components: Documentation
messages: 298445
nosy: docs@python, lucbouge
priority: normal
severity: normal
status: open
title: Missing line in example program
type: resource usage
versions: Python 3.6

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30941>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30741] https://www.pypi-mirrors.org/ error 503

2017-06-23 Thread Luc Zimmermann

New submission from Luc Zimmermann:

is that linked with the certificate error on pypi ? 

you redirect http request to https, but you still listen 80 and not 443 ?

--
messages: 296721
nosy: Luc Zimmermann
priority: normal
severity: normal
status: open
title: https://www.pypi-mirrors.org/ error 503
type: security

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30741>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30739] pypi ssl errors [CERTIFICATE_VERIFY_FAILED]

2017-06-23 Thread Luc Zimmermann

New submission from Luc Zimmermann:

Hi Guys, 

I've a strange behavior. 
We use python for configure our new boxes with openWRT and coovaChilli.

But since yesterday, when i ask to pip to dowload PyJWT, json-cfg and 
speedtest-cli, 

some boxes can download these packages, and some can't.

root@OpenWrt:~# cat /root/.pip/pip.log

/usr/bin/pip run on Thu Apr 13 18:46:19 2017
Downloading/unpacking PyJWT
  Getting page https://pypi.python.org/simple/PyJWT/
  Could not fetch URL https://pypi.python.org/simple/PyJWT/: connection error: 
[SSL: CERTIFICATE_VERIFY_FAILED] unknown error (_ssl.c)
  Will skip URL https://pypi.python.org/simple/PyJWT/ when looking for download 
links for PyJWT
  Getting page https://pypi.python.org/simple/
  Could not fetch URL https://pypi.python.org/simple/: connection error: 
HTTPSConnectionPool(host='pypi.python.org', port=443): Max r)
  Will skip URL https://pypi.python.org/simple/ when looking for download links 
for PyJWT
  Cannot fetch index base URL https://pypi.python.org/simple/
  URLs to search for versions for PyJWT:
  * https://pypi.python.org/simple/PyJWT/
  Getting page https://pypi.python.org/simple/PyJWT/
  Could not fetch URL https://pypi.python.org/simple/PyJWT/: connection error: 
[SSL: CERTIFICATE_VERIFY_FAILED] unknown error (_ssl.c)
  Will skip URL https://pypi.python.org/simple/PyJWT/ when looking for download 
links for PyJWT
  Could not find any downloads that satisfy the requirement PyJWT
Cleaning up...
  Removing temporary dir /tmp/pip_build_root...
No distributions at all found for PyJWT
Exception information:
Traceback (most recent call last):
  File 
"/usr/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 
122, in main
status = self.run(options, args)
  File 
"/usr/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", 
line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, 
bundle=self.bundle)
  File "/usr/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 
1177, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "/usr/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/index.py", 
line 277, in find_requirement
raise DistributionNotFound('No distributions at all found for %s' % req)
DistributionNotFound: No distributions at all found for PyJWT

--
messages: 296708
nosy: Luc Zimmermann
priority: normal
severity: normal
status: open
title: pypi ssl errors [CERTIFICATE_VERIFY_FAILED]
type: resource usage
versions: Python 2.7

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30739>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24515] docstring of isinstance

2015-06-26 Thread Luc Saffre

New submission from Luc Saffre:

The docstring of built-in function 'isinstance' should explain that if the 
classinfo is a tuple, the object must be instance of *any* (not *all*) of the 
class objects.

--
assignee: docs@python
components: Documentation
messages: 245841
nosy: Luc Saffre, docs@python
priority: normal
severity: normal
status: open
title: docstring of isinstance
type: enhancement
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24515
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



File read from stdin and printed to temp file are not identicial?

2010-09-16 Thread Jean Luc Truchtersheim
Hello,

I am trying to read from stdin and dump what's read to a temporary
file. My code works for small files but as soon as I have a file that
has, e.g., more than 300 lines, there is always one and only one line
that is truncated compared to the input.

Here is my code:
#-
#! /usr/bin/env python

import sys
from tempfile import *

if __name__ == __main__:
data = []
f_in = NamedTemporaryFile(suffix=.txt, delete=False)
for line in sys.stdin:
f_in.write(line)
data.append(line)
f_in.close
f = open(f_in.name, 'rb')
i=0
for line in f:
if data[i] != line:
print sys.stderr, line 
%d:\nfile(%d):\%s\\narray(%d):\%s\ %
(i+1, len(line), line, len(data[i]), data[i])
i += 1
sys.exit()
#-

I feel that I must be doing something very stupid, but I don't really
know what.

Any idea?

Can anybody reproduce this behavior.

Thanks a bunch for any help.

Jean Luc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: File read from stdin and printed to temp file are not identicial?

2010-09-16 Thread Jean Luc Truchtersheim
Dear Fellow python users,

Many thanks for your help.

Those missing brackets were the cause of my problem.

Now my program works as expected.

Many, many heartfelt thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Absolute beginner

2009-12-30 Thread Luc

Thanks Krister !
Should have read specific 3.1 documentation :-(  .

Regards,  Luc

On Dec 30, 12:56 pm, Krister Svanlund krister.svanl...@gmail.com
wrote:
 In Python 3 the syntax for print has changed to print() so just put
 braces around the string and you'r good to go!

 On Wed, Dec 30, 2009 at 12:48 PM,  lucbo...@hotmail.com wrote:
  Hi there,
  I installed python 3.1 on Windows Vista PC.
  Am an absolute beginner with Python.
  This is my problem :

  In Idle :

  Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
  (Intel)] on win32
  Type copyright, credits or license() for more information.
  print Hello
  SyntaxError: invalid syntax (pyshell#0, line 1)

  At a dos-prompt :

  Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
  (Intel)] on
  win32
  Type help, copyright, credits or license for more information.
  print Hello
   File stdin, line 1
     print Hello
                 ^
  SyntaxError: invalid syntax

  Looks stupid, probably is, but I cannot figure it out.

  Thanks for any help !

  Lucky

  --
 http://mail.python.org/mailman/listinfo/python-list


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Absolute beginner

2009-12-30 Thread Luc
Also thanks Ben and Simon for your help !

On Dec 30, 1:07 pm, Luc lucbo...@hotmail.com wrote:
 Thanks Krister !
 Should have read specific 3.1 documentation :-(  .

 Regards,  Luc

 On Dec 30, 12:56 pm, Krister Svanlund krister.svanl...@gmail.com
 wrote:

  In Python 3 the syntax for print has changed to print() so just put
  braces around the string and you'r good to go!

  On Wed, Dec 30, 2009 at 12:48 PM,  lucbo...@hotmail.com wrote:
   Hi there,
   I installed python 3.1 on Windows Vista PC.
   Am an absolute beginner with Python.
   This is my problem :

   In Idle :

   Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
   (Intel)] on win32
   Type copyright, credits or license() for more information.
   print Hello
   SyntaxError: invalid syntax (pyshell#0, line 1)

   At a dos-prompt :

   Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
   (Intel)] on
   win32
   Type help, copyright, credits or license for more information.
   print Hello
    File stdin, line 1
      print Hello
                  ^
   SyntaxError: invalid syntax

   Looks stupid, probably is, but I cannot figure it out.

   Thanks for any help !

   Lucky

   --
  http://mail.python.org/mailman/listinfo/python-list



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading hex to int from a binary string

2009-10-09 Thread Luc
On Oct 9, 3:12 am, Dennis Lee Bieber wlfr...@ix.netcom.com wrote:
 On Thu, 8 Oct 2009 14:52:33 -0700 (PDT), Luc luc.traonmi...@gmail.com
 declaimed the following in gmane.comp.python.general:



  On Oct 8, 11:13 pm, Diez B. Roggisch de...@nospam.web.de wrote:
   Luc schrieb:

Hi all,

I read data from a binary stream, so I get hex values as characters
(in a string) with escaped x, like \x05\x88, instead of 0x05.

I am looking for a clean way to add these two values and turn them
into an integer, knowing that calling int() with base 16 throws an
invalid literal exception.

Any help appreciated, thanks.

   Consider this (in the python interpreter):

     chr(255)
   '\xff'
     chr(255) == r\xff
   False
     int(rff, 16)
   255

   In other words: no, you *don't* get hex values. You get bytes from the
   stream as is, with python resorting to printing these out (in the
   interpreter!!!) as \xXX. Python does that so that binary data will
   always have a pretty output when being inspected on the REPL.

   But they are bytes, and to convert them to an integer, you call ord on
   them.

   So assuming your string is read bytewise into two variables a  b, this
   is your desired code:

     a = \xff
     b = \xa0
     ord(a) + ord(b)
   415

   HTH, Diez

  Sorry I was not clear enough. When I said add, I meant concatenate
  because I want to read 0x0588 as one value and ord() does not allow
  that.

  However you pointed me in the right direction and I found that int
  (binascii.hexlify(a + b, 16)) does the job.

         Yeesh... This is what   struct  is designed for...

  import struct
  something = \x05\x88and more\r\n
  print something

  ˆand more



  (h1, st, h2) = struct.unpack(H8sh, something)
  h1
 34821
  st
 'and more'
  h2
 2573

  print %4x, %4x % (h1, h2)

 8805,  a0d

         You may need to adjust for expected endian mode...

  (h1, st, h2) = struct.unpack(H8sh, something)
  print %4.4x, %4.4x % (h1, h2)
 0588, 0d0a
  h1
 1416
  h2
 3338

 --
         Wulfraed         Dennis Lee Bieber               KD6MOG
         wlfr...@ix.netcom.com     HTTP://wlfraed.home.netcom.com/

Nice, thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


Reading hex to int from a binary string

2009-10-09 Thread Luc
Hi all,

I read data from a binary stream, so I get hex values as characters
(in a string) with escaped x, like \x05\x88, instead of 0x05.

I am looking for a clean way to add these two values and turn them
into an integer, knowing that calling int() with base 16 throws an
invalid literal exception.

Any help appreciated, thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading hex to int from a binary string

2009-10-09 Thread Luc
On Oct 9, 10:45 am, Diez B. Roggisch de...@nospam.web.de wrote:
 Luc schrieb:



  On Oct 8, 11:13 pm, Diez B. Roggisch de...@nospam.web.de wrote:
  Luc schrieb:

  Hi all,
  I read data from a binary stream, so I get hex values as characters
  (in a string) with escaped x, like \x05\x88, instead of 0x05.
  I am looking for a clean way to add these two values and turn them
  into an integer, knowing that calling int() with base 16 throws an
  invalid literal exception.
  Any help appreciated, thanks.
  Consider this (in the python interpreter):

    chr(255)
  '\xff'
    chr(255) == r\xff
  False
    int(rff, 16)
  255

  In other words: no, you *don't* get hex values. You get bytes from the
  stream as is, with python resorting to printing these out (in the
  interpreter!!!) as \xXX. Python does that so that binary data will
  always have a pretty output when being inspected on the REPL.

  But they are bytes, and to convert them to an integer, you call ord on
  them.

  So assuming your string is read bytewise into two variables a  b, this
  is your desired code:

    a = \xff
    b = \xa0
    ord(a) + ord(b)
  415

  HTH, Diez

  Sorry I was not clear enough. When I said add, I meant concatenate
  because I want to read 0x0588 as one value and ord() does not allow
  that.

 (ord(a)  8) + ord(b)

 Diez

Yes that too. But I have four bytes fields and single bit fields to
deal with as well so I'll stick with struct.

Thanks.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading hex to int from a binary string

2009-10-08 Thread Luc
On Oct 8, 11:13 pm, Diez B. Roggisch de...@nospam.web.de wrote:
 Luc schrieb:

  Hi all,

  I read data from a binary stream, so I get hex values as characters
  (in a string) with escaped x, like \x05\x88, instead of 0x05.

  I am looking for a clean way to add these two values and turn them
  into an integer, knowing that calling int() with base 16 throws an
  invalid literal exception.

  Any help appreciated, thanks.

 Consider this (in the python interpreter):

   chr(255)
 '\xff'
   chr(255) == r\xff
 False
   int(rff, 16)
 255

 In other words: no, you *don't* get hex values. You get bytes from the
 stream as is, with python resorting to printing these out (in the
 interpreter!!!) as \xXX. Python does that so that binary data will
 always have a pretty output when being inspected on the REPL.

 But they are bytes, and to convert them to an integer, you call ord on
 them.

 So assuming your string is read bytewise into two variables a  b, this
 is your desired code:

   a = \xff
   b = \xa0
   ord(a) + ord(b)
 415

 HTH, Diez

Sorry I was not clear enough. When I said add, I meant concatenate
because I want to read 0x0588 as one value and ord() does not allow
that.

However you pointed me in the right direction and I found that int
(binascii.hexlify(a + b, 16)) does the job.

Thanks.

-- 
http://mail.python.org/mailman/listinfo/python-list


marked-up Python code

2007-11-20 Thread Luc Goossens
Hi,

I would like to experiment with marked-up Python source code. A more  
elaborate explanation of the use-case is at the end of this mail. The  
short story is that I would like to do things like assign colors to  
pieces of text in my editor and have this information saved _in my  
source  code_
smth like
red
else :
  print ERROR
  return -1
/red

all the Python parser has to do is skip the mark-up.

Has something like this been done before? Is there a way  to do this  
without changing the Python executable? If not, where in the source  
code should I start looking?

cheers,
Luc

PS1
I know I can put the mark-up after a # and the problem is solved  
trivially, but this will not work for all cases (e.g. mark-up of  
single identifiers) and to be honest I was thinking of recycling some  
mark-up capable editor and an existing mark-up language

PS2
here's the real use case
I have a small application in Python. The code shares a recurring  
feature: within methods 20% of the code lines is about the actual  
handling of the correct case, 40% is about the handling of the  
incorrect cases, 40% is instrumenting (logging and timing).
A case for aspect oriented programming? I would certainly think so,  
but unfortunately  there is no obvious way to map this to the  
prevailing aspect-advice-joint point-point cut model. Moreover, I  
really do not want this code to become fragmented over multiple  
source code files, I just want the aspects to be readily visible in  
my editor, and be able to selectively show/hide some of them (like  
expanding/collapsing code blocks).


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: marked-up Python code

2007-11-20 Thread Luc Goossens
Hi Tim,

thanks for your suggestions

I have two questions.
1. can I color the background of the text keeping the normal syntax  
coloring for actual text? can you give some hints on how to do that  
in vim?
2. will the # mark-up lines show in the editor? is there some visual  
clue that something has been hidden?

I will gladly settle for some pointer into the vim documentation,  
which I found already.

many thanks,
Luc

On Nov 20, 2007, at 1:03 PM, Tim Chase wrote:

 all the Python parser has to do is skip the mark-up.
 [snip]
 I know I can put the mark-up after a # and the problem is
 solved trivially, but this will not work for all cases (e.g.
 mark-up of single identifiers) and to be honest I was thinking
  of recycling some mark-up capable editor and an existing
 mark-up language

 Comments *are* the way in which you tell Python parser to skip
 the mark-up.

 With a good editor, this is fairly easy to do.  And
 folding/coloring is the job of the editor, not of Python.

 I'll use Vim as an example, as it's my preferred tool and I know
 it well enough to offer a solution using it, though surely any
 other good editor can do similarly.

 Vim offers two ways to do what you're describing.  First, you can
 color sections by defining your own highlighting/syntax
 augmentation.  Second, you can use folding to hide away bits of
 your code that you don't want to see.

 This combo can be used to do something like define several
 markers such as

   # begin instrumenting
   # end instrumenting
   # one-line instrumentation

 You can then do something like

   :set foldmethod=marker
   :set foldmarker=#\ begin,#\ end

 This will create folds across all your blocks.  You can
 selectively open/close these blocks with

   zR

 to open all the folds and

   :g/#begin instrumenting/norm zC

 to close just those folds tagged with begin instrumenting.  The
 two can be mapped into a single keypress, so you can do something
 like

   :nnoremap f4 zR:g/# begin instrumenting/norm zCcr

 which will open all the folds and then just close the ones that
 involve instrumenting merely by pressing f4

 As for the single-line ones, you can use Vim's :match
 functionality:

   :match Folded /.*# one-line instrumentation

 The Folded is a highlighting group (it can be an existing one
 such as Folded or Error, or one you create to give you the
 coloring you want).

 Thus, in Vim, the whole thing could be done with a fairly simple
 setup:

   :set foldmethod=marker foldmarker=#\ begin,#\ end
   :nnoremap f4 zR:g/# begin instrumentation/norm zCcr:match
 Folded /.*# one-line instrumentation/cr
   :nnoremap f5 zR:g/# begin debugging/norm zCcr:match Folded
 /.*# one-line debugging/cr

 You would then mark up your code with things like

 import pdb; pdb.set_trace() # one-line debugging
 start = now() # one-line instrumentation
 do_stuff()
 # begin instrumentation
 end = now()
 delta = end - start
 # end instrumentation

 and then use f4 to hide your instrumentation code, and f5 to
 hide your debugging code.  it's a little more complex to invert
 the behavior, but doable.

 This can even be augmented to create these blocks for you:

   :vnoremap s-F4 :'put! ='# begin instrumentation'cr:'put
 ='# end instrumentation'cr
   :nnoremap s-F4 A# one-line instrumentationesc

 which should define two mappings for shift+F4:  the first, in
 visual-mode (with text selected) wraps those lines in the
 begin/end pair.  In normal mode, shift+F4 just appends the
 one-line tag to the end of the line.  Do similarly for shift+F5
 for the debugging.

 Hope this gives you some ideas to work with.  And perhaps
 advocates of other editors can chime in with how it would be done
 there.

 -tkc









-- 
http://mail.python.org/mailman/listinfo/python-list


Re: The Future of Python Threading

2007-08-10 Thread Luc Heinrich
Justin T. [EMAIL PROTECTED] wrote:

 What these seemingly unrelated thoughts come down to is a perfect
 opportunity to become THE next generation language.

Too late: http://www.erlang.org/

:)

-- 
Luc Heinrich
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: loose methods : Smalltalk asPython

2006-12-27 Thread Luc Heinrich
Jan Theodore Galkowski [EMAIL PROTECTED] wrote:

 Comments?  Suggestions?

http://www.ruby-lang.org

-- 
Luc Heinrich
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Good Looking UI for a stand alone application

2006-12-20 Thread Luc Heinrich
Chris Mellon [EMAIL PROTECTED] wrote:

 FYI: OS X ships with wxWidgets installed.

For the sole purpose of providing an easy way to run existing wxPerl and
wxPython code (and possibly pure wxWidgets code as well). As a
*porting* aid if you will, as hinted in the Using Traditional UNIX
Graphical Environments of the Porting UNIX/Linux Applications to Mac
OS X document, here:

http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix
/index.html

 How many applications built into OS X are built using it? 

I quote you: none, zero, zilch :

 Are you sure? How would you know?

What's that ? Homework ? Oh well, here you go:

import os
import subprocess

def findLinkedWithWX(folder):
  for root, dirs, files in os.walk(folder):
for d in list(dirs):
  if d.endswith('.app'):
dirs.remove(d)
exename, _ = os.path.splitext(d)
exe = '%s/%s/Contents/MacOS/%s' % (root, d, exename)
popen = subprocess.Popen(['otool', '-L', exe], 
 stdout=subprocess.PIPE)
libs = popen.communicate()[0]
if 'libwx' in libs:
  print d

findLinkedWithWX('/Applications')
findLinkedWithWX('/Developer')

-- 
Luc Heinrich
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Good Looking UI for a stand alone application

2006-12-18 Thread Luc Heinrich
Peter Decker [EMAIL PROTECTED] wrote:

 You're full of it. I routinely write GUI apps in Dabo for both Windows
 and Linux users, and they look just fine on both platforms.

Oh, I'm sure you do. Now go try to run one of your Dabo apps on a Mac
and see how it looks/feels... :

Here's a hint directly taken from the Dabo homepage: It also suffers
from the same display limitations on some platforms (most notably OS X),
but these should improve as the underlying toolkits improve.

 Using sizers is the key; layouts just 'look right' no matter what the native
 fonts and control sizes are.

No, sizers are a tiny part of a much bigger problem. Sizers might be the
key to solve parts of the look problem, they don't address any of the
feel problem.

But you clearly have a point here, so let me rephrase: Crossplatform
toolkits/frameworks suck. All of them. No exception. UNLESS you only
target the lowest common denominator, aka Windows and its Linux
followers.

Now, the OP *explicitely* said that [his] requirement is that the
application needs to look as good on Windows as on the Apple Mac, so
the rephrasing does not apply in this case. So here's a last try:

Crossplatform toolkits/frameworks suck. All of them. No exception.
ESPECIALLY if one of your target is Mac OS.

-- 
Luc Heinrich
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Good Looking UI for a stand alone application

2006-12-18 Thread Luc Heinrich
Paul McNett [EMAIL PROTECTED] wrote:

 It looks/feels like a native app on OS X.

I'm sorry, but the screenshots I'm seeing on the Dabo website all look
like ugly Windows ports (when they don't look like straight X11 crap). I
can't comment on the feel of course, but I wouldn't hold my breath. I'm
downloading the screencasts as we speak, but I'm not holding my breath
either.

[UPDATE] I have watched three of the Dabo screencasts and the presented
application are *very* far from looking/feeling like native OS X
applications. Sorry.

 Why not use the best crossplatform native toolkit (wxPython) and then if
 you need native features that aren't provided, use ctypes or something
 to get access to the native GUI? Nothing in wxPython or Dabo prevents
 you from doing that.

Eh, funny, I have used wx thingy for quite some time (when it was
actually still called wxWindows and then when they switched to
wxWidgets) and it's probably the worst of all crossplatform toolkits I
have ever used. So I'm not sure you'll be able to convince me here :D

Ok, now here's a question for you: if crossplatform toolkits/frameworks
are so great and automagically allow to produce superlickable and
native-looking/feeling applications on all three major platforms, why is
there so few of those applications on OS X ? 

Because Mac users are elitists assholes is not the good answer by the
way :)

-- 
Luc Heinrich
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Good Looking UI for a stand alone application

2006-12-18 Thread Luc Heinrich
Peter Decker [EMAIL PROTECTED] wrote:

 I don't have a Mac, although I would certainly like one. But one of
 the two authors of Dabo is a Mac user, and says that he does all his
 development on a Mac, and then tests it on the other platforms. Look
 at the screencasts on the Dabo site - most of them are recorded on OS
 X.

Yeah, I have watched three of them and they are glaring examples of what
I'm talking about. The applications presented not only don't look right,
at all, they apparently don't feel right either.

 OK, it's true: you don't have 100% access to the lickable Aqua stuff
 that a Cocoa app might be able to use. But paged controls use native
 Aqua tabs; progress bars are native Aqua bars, buttons are native Aqua
 buttons... Perfect? Of course not. But stating that it sucks is a load
 of crap.

No it's not, because you insist on presenting only one part of the
problem. Using native widgets is *far* from enough.

 Such self-important pronouncements would be better received if you
 brought them down the mountain on stone tablets.

No problem, let me get my chisel, do you prefer Fedex or UPS ? :p

-- 
Luc Heinrich
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Good Looking UI for a stand alone application

2006-12-17 Thread Luc Heinrich
The Night Blogger [EMAIL PROTECTED] wrote:

 Can someone recommend me a good API for writing a sexy looking (Rich UI
like WinForms) shrink wrap application

No, because such a thing doesn't exist.

 My requirement is that the application needs to look as good on Windows as
 on the Apple Mac

Crossplatform GUIs are a myth, you *always* end up with a lowest common
denominator (aka Windows) which makes your application look like crap on
other platforms. And when the toolkit/framework only makes it look like
semi-crap, it makes it *feel* like crap.

Because, you know, user interfaces aren't only about the look but also
(and most importantly) the feel, and the lowest common denominator (aka
Windows) won't bring a Mac feel to your app.

Crossplatform toolkits/frameworks suck. All of them. No exception. If
you want your app to look *AND* feel great on all platform, abstract the
core of your application and embed it in platform native GUI code.

-- 
Luc Heinrich
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Reported] (was Re: A critic of Guido's blog on Python's lambda)

2006-05-06 Thread Luc The Perverse
John Bokma [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Reported for excessive crossposting.

Did u report yourself?

--
LTP

:) 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: DO NOT USE JAVA BECAUSE IT IS NOT OPEN SOURCE

2006-04-01 Thread Luc The Perverse
steve [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Sat, 1 Apr 2006 13:06:52 +0800, Luc The Perverse wrote
 (in article [EMAIL PROTECTED]):

 [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 Programing Languiges Are Ment to be free. That is why i am starting The
 iCoo De Tar/i thats french for Blow of state it is a flash/java
 alternative and if you are going to use a server side languige use
 Perl,Python or better yet Ruby. What is the point of a languige without
 a standerd and without a open source distrabution. Coo De Tar will be
 released as a api for perl,python and ruby. Java sucks because it IS
 NOT FREE. I AM A GNU GUY I BELEVE THAT SOFTWARE MUST AND SHALL BE
 FREE!! do not use java because it is an oxymoron


 Dear Mr Troll,

 There are GNU implementations of JVM and compiler.

 And just because Sun's Java is not GNU does not mean it is not free.

 Now go get a life.

 --
 LTP





 it's April 1st remember

Ah!  Thank you

--
LTP

:) 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: DO NOT USE JAVA BECAUSE IT IS NOT OPEN SOURCE

2006-03-31 Thread Luc The Perverse
[EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Programing Languiges Are Ment to be free. That is why i am starting The
 iCoo De Tar/i thats french for Blow of state it is a flash/java
 alternative and if you are going to use a server side languige use
 Perl,Python or better yet Ruby. What is the point of a languige without
 a standerd and without a open source distrabution. Coo De Tar will be
 released as a api for perl,python and ruby. Java sucks because it IS
 NOT FREE. I AM A GNU GUY I BELEVE THAT SOFTWARE MUST AND SHALL BE
 FREE!! do not use java because it is an oxymoron


Dear Mr Troll,

There are GNU implementations of JVM and compiler.

And just because Sun's Java is not GNU does not mean it is not free.

Now go get a life.

--
LTP

:) 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: String comparison question

2006-03-20 Thread luc . saffre
Michael Spencer wrote:
 Olivier Langlois wrote:

  I would like to make a string comparison that would return true without
  regards of the number of spaces and new lines chars between the words
 
  like 'A   B\nC' = 'A\nBC'

Here is how I do such comparisons:

  if a.strip().split() == b.strip().split()

Luc

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Xah's Edu Corner: What is Expressiveness in a Computer Language

2006-03-19 Thread Luc The Perverse
John Bokma [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Dag Sunde [EMAIL PROTECTED] wrote:

 Xah Lee [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 What is Expressiveness in a Computer Language
 snipped_inane_chatter /
 PLONK.

 Don't post PLONK messages you idiot. PLONK in silence instead of adding to
 a lot of garbage in serveral groups.

Sometimes you need to make a statement about a local troll.

Though I agree - a massively cross posted thread with no one familiar 
probably doesn't qualify

--
LTP

:) 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: excellent book on information theory

2006-01-16 Thread Luc The Perverse
Paul Rubin http://[EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Grant Edwards [EMAIL PROTECTED] writes:
 That made me smile on a Monday morning (not an insignificant
 accomplishment).  I noticed in the one footnote that the H.P.
 book had been translated into American.  I've always wondered
 about that.  I noticed several spots in the H.P. books where
 the dialog seemed wrong: the kids were using American rather
 than British English.  I thought it rather jarring.

 The US edition even changed the title from Philosopher's Stone to
 Sorcerer's Stone.  American schoolkids weren't expected to know what
 a philosopher was (or anyway what the Philosopher's Stone was).

Which is downright annoying.

Children are capable of learning a word - and causing discongruence in 
semantics causes a serious problem when making a movie

--
LTP

:) 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Xah's Edu Corner: Examples of Quality Technical Writing

2005-12-14 Thread Luc The Perverse
javuchi [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Why do you have such a need of being hating everything and everybody
 and expressing it so offen?
 Can you live without hate?
 Can you let others live without your hates?

A person can live without hate, living love and working towards bettering 
humanity.

But as for people in general - I'm not so sure.  I'm not sure my opinion on 
hate - since I value people's opinions and diversity, hate seems unbecoming, 
but then so does computer gaming ;)

Westernization sweeps accross all countries though, and it is no longer 
vogue to be so self centered.   This will help with the most overt types of 
hatred.

--
LTP

:)



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-10-25 Thread Luc The Perverse
Steven D'Aprano [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Tue, 25 Oct 2005 11:51:02 -0700, David Schwartz wrote:


 Steven D'Aprano [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]

 The first two points are factually wrong, and the third is an opinion
 based on the concept, as far as I can see, that Microsoft should be
 allowed to do anything they like, even if those actions harm others.

 Of course this alleged harm is simply a lack of a benefit.

 Why is Burger King allowed to close at 10PM? That harms me when I'm
 hungry after 10.

 Burger King doesn't take actions to prevent you from going to another
 vendor who will stay open after 10PM, as you very well know.

 Nor is Burger King a monopoly -- if they refuse to open after 10 in the
 face of great demand, they only harm themselves. As I said a few days ago,
 it is not the place for either us or the government to care about the
 success or failure of any specific vendor, but only about the health of
 the entire market. As there is no shortage of competition in the fast food
 market, the harm done to you by Burger King's refusal to open after 10PM
 is not sufficient for anyone to care. If there is significant demand, then
 Burger King will merely harm themselves by refusing to open because they
 will lose customers to those vendors who do open, and if there is
 insignificant demand, then why should anyone care?

NO!  There ~is~ a conspiracy by Egg farmers to not make burgers available 
before 10 am.

Burger King used to be one of the last great vestiges of the 24 hour burger, 
and now it's gone.

They know no one would buy the shitty egg McMuffins/equivalent if they had 
delicious burgers available, so there is something underhanded going on 
behind the scenes.

Same thing with pizza.  Don't try to tell me that there are not hungry 
partiers at 3 am - but are any of the delivery places open?  NO!

Why is it this way?  Who knows!  But when in doubt, blame the right wing 
extremist politicians.

--
LTP 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: problem installing wxPython 2.5.3, wxWidgets installed ok

2005-02-27 Thread Luc
[EMAIL PROTECTED] a écrit:

 I'm trying to install wxPython 2.5.3.1 using Python 2.3.2 on a Fedora 2
 machine.
 
 I have python in a non-standard place, but I'm using --prefix with the
 configure script to point to where I have everything. The make install
 in $WXDIR seemed to go fine. I have the libxw* libraries in my lib/
 directory
 
 libwx_base-2.5.so@libwx_gtk_adv-2.5.so.3.0.0*
 libwx_base-2.5.so.3@  libwx_gtk_core-2.5.so@
 libwx_base-2.5.so.3.0.0*  libwx_gtk_core-2.5.so.3@
 libwx_base_net-2.5.so@libwx_gtk_core-2.5.so.3.0.0*
 libwx_base_net-2.5.so.3@  libwx_gtk_gl-2.4.so@
 libwx_base_net-2.5.so.3.0.0*  libwx_gtk_gl-2.4.so.0@
 libwx_base_xml-2.5.so@libwx_gtk_gl-2.4.so.0.1.1*
 libwx_base_xml-2.5.so.3@  libwx_gtk_html-2.5.so@
 libwx_base_xml-2.5.so.3.0.0*  libwx_gtk_html-2.5.so.3@
 libwx_gtk-2.4.so@ libwx_gtk_html-2.5.so.3.0.0*
 libwx_gtk-2.4.so.0@   libwx_gtk_xrc-2.5.so@
 libwx_gtk-2.4.so.0.1.1*   libwx_gtk_xrc-2.5.so.3@
 libwx_gtk_adv-2.5.so@ libwx_gtk_xrc-2.5.so.3.0.0*
 libwx_gtk_adv-2.5.so.3@
 
 I also have a wx/ directory under my lib. directory.
 
 The problem is when I try to do a 'python setup.py install' in the
 ./wxPython directory.  I get a message about not finding a config file
 for wx-config and then several errors during gcc compiles.
 
 python setup.py build
 Found wx-config: /project/c4i/Users_Share/williams/Linux/bin/wx-config
 Using flags:  --toolkit=gtk2 --unicode=no --version=2.5
 
   Warning: No config found to match:
 /project/c4i/Users_Share/williams/Linux/bin/wx-config --toolkit=gtk2
 --unicode=no --version=2.5 --cxxflags
in /project/c4i/Users_Share/williams/Linux/lib/wx/config
   If you require this configuration, please install the desired
   library build.  If this is part of an automated configuration
   test and no other errors occur, you may safely ignore it.
   You may use wx-config --list to see all configs available in
   the default prefix.
 
 ...
 
 Preparing OGL...
 Preparing STC...
 Preparing GIZMOS...
 running build
 running build_py
 copying wx/__version__.py - build-gtk2/lib.linux-i686-2.3/wx
 running build_ext
 building '_core_' extension
 creating build-gtk2/temp.linux-i686-2.3
 creating build-gtk2/temp.linux-i686-2.3/src
 creating build-gtk2/temp.linux-i686-2.3/src/gtk
 gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall
 -Wstrict-prototypes -fPIC -DSWIG_GLOBAL -DHAVE_CONFIG_H
 -DWXP_USE_THREAD=1 -UNDEBUG -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API
 -Iinclude -Isrc -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include
 -I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0
 -I/usr/include/freetype2 -I/usr/include/freetype2/config
 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
 -I/project/c4i/Users_Share/williams/Linux/include/python2.3 -c
 src/libpy.c -o build-gtk2/temp.linux-i686-2.3/src/libpy.o -O3
 gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall
 -Wstrict-prototypes -fPIC -DSWIG_GLOBAL -DHAVE_CONFIG_H
 -DWXP_USE_THREAD=1 -UNDEBUG -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API
 -Iinclude -Isrc -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include
 -I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0
 -I/usr/include/freetype2 -I/usr/include/freetype2/config
 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
 -I/project/c4i/Users_Share/williams/Linux/include/python2.3 -c
 src/gtk/_core_wrap.cpp -o
 build-gtk2/temp.linux-i686-2.3/src/gtk/_core_wrap.o -O3
 cc1plus: warning: command line option -Wstrict-prototypes is valid
 for Ada/C/ObjC but not for C++
 In file included from src/gtk/_core_wrap.cpp:400:
 include/wx/wxPython/wxPython_int.h:19:19: wx/wx.h: No such file or
 directory
 include/wx/wxPython/wxPython_int.h:21:25: wx/busyinfo.h: No such file
 or directory
 include/wx/wxPython/wxPython_int.h:22:22: wx/caret.h: No such file or
 directory
 include/wx/wxPython/wxPython_int.h:23:25: wx/choicebk.h: No such file
 or directory
 include/wx/wxPython/wxPython_int.h:24:24: wx/clipbrd.h: No such file or
 directory
 include/wx/wxPython/wxPython_int.h:25:25: wx/colordlg.h: No such file
 or directory
 include/wx/wxPython/wxPython_int.h:26:23: wx/config.h: No such file or
 directory
 include/wx/wxPython/wxPython_int.h:27:23: wx/cshelp.h: No such file or
 directory
 include/wx/wxPython/wxPython_int.h:28:25: wx/dcmirror.h: No such file
 or directory
 include/wx/wxPython/wxPython_int.h:29:21: wx/dcps.h: No such file or
 directory
 include/wx/wxPython/wxPython_int.h:30:24: wx/dirctrl.h: No such file or
 directory
 include/wx/wxPython/wxPython_int.h:31:23: wx/dirdlg.h: No such file or
 directory
 include/wx/wxPython/wxPython_int.h:32:20: wx/dnd.h: No such file or
 directory
 include/wx/wxPython/wxPython_int.h:33:24: wx/docview.h: No such file or
 directory
 include/wx/wxPython/wxPython_int.h:34:24: wx/encconv.h: No such file or
 directory
 include/wx/wxPython/wxPython_int.h:35:25: wx/fdrepdlg.h: No such file
 or direct
 
 ...
 
 Why isn't there a 

Web interface GUI??

2005-02-12 Thread Luc
I am a newbye. I am looking for a multi-platform user interface solution
(windows, linux).
Untill now, I used wxPython which worked fine at the beginning (MDK9,
Windows NT4). Nevertheless, I was very disapointed when I noticed that my
applications did not work with recent linux distributions (MDK10.1, FC3).
This was because of the wxPython version...and it seemed to be very
difficult to come back to an older wxPython version with these new
distributions, because of dependencies problems.
So I am looking for another solution with a web interface that should work
with linux and windows XP.
I had a look to zope but was afraid with the complexity and debug
difficulties.
Are there some other solutions?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Web interface GUI??

2005-02-12 Thread Luc
Irmen de Jong a écrit:

 Luc wrote:
 
 So I am looking for another solution with a web interface that should
 work with linux and windows XP.
 I had a look to zope but was afraid with the complexity and debug
 difficulties.
 Are there some other solutions?
 
 Yes. A lot: http://www.python.org/moin/WebProgramming
 I know someone who successfully created a web application
 that runs from CD-ROM, using Snakelets. So you may want
 to have a look at that one first, because this is quite
 similar to what you want to do, right?
 Then again I'm biased ofcourse.
 Just have a quick look at the available libraries and
 decide which one fits your needs most.
 
 --Irmen
Thanks. It seems to be a good starting point
-- 
http://mail.python.org/mailman/listinfo/python-list