Babel - Python library for I18N and L10N

2007-06-20 Thread Jonas
Quoting Christopher Lenz:
-
Babel 0.8 - Jun 20, 2007


We're proud to present the latest release of the Babel: 0.8.

Babel is a Python library that provides an integrated collection of
utilities that assist with internationalizing and localizing Python
applications (in particular web-based applications.)

This is the first release of the library. It has a number of known
bugs and limitations that we plan to address in upcoming releases.
Feedback from early adopters and people interested in contributing
to the project is very welcome!

You can download the new release here:

 

Please don't hesitate to report any issues you may find with this
release:

 

For questions, comments and user discussions, please use the Babel
mailing list:

 

Acknowledgments

A big thank you to everyone who tried Babel before this release
and provided feedback, reported bugs, and/or contributed patches!

Cheers,
Chris
-

http://www.cmlenz.net/blog/2007/06/announcing_babe.html
http://groups.google.com/group/python-babel

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


GC performance with lists

2007-09-04 Thread jonas
While working on some python wrapping, I've run into some problems
where the GC seems to take an unreasonable amount of time to run. The
code below is a demonstration:

import gc
#gc.disable()

data = []
for i in xrange(10):

shortdata = []
for j in range(57):
mytuple = (j, i+1, i+2, i+3, i+4, i+5, i+6)
shortdata.append(mytuple)
data.extend(shortdata)

print len(data)

with gc disabled (the second line) the code runs in 15 seconds, with
it enabled it runs in 2:15, or ~9x slower. I expected some gc
overhead, but not an order of magnitude! Am I doing something
obviously wrong in the above code?

Thanks,
 ...Eric

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


pleac

2006-05-04 Thread jonas
Hi,

I'm new to python.
After a search on
http://pleac.sourceforge.net/pleac_python/index.html
why python have a low %?

Thanks in advance

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


Re: pleac

2006-05-04 Thread jonas
Thanks Fredrik,

i'm going to buy the book.

After all, there's nothing about the Python language power!

thank you.

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


Re: Split a list into two parts based on a filter?

2013-06-10 Thread Jonas Geiregat

On 11 Jun 2013, at 01:08, Fábio Santos wrote:

> 
> On 10 Jun 2013 23:54, "Roel Schroeven"  wrote:
> >
> > You could do something like:
> >
> > new_songs, old_songs = [], []
> > [(new_songs if s.is_new() else old_songs).append(s) for s in songs]
> >
> > But I'm not sure that that's any better than the long version.
> 
> This is so beautiful!
> 
> 

I must disagree , this is unreadable and in my honor opinion not Pythonic at 
all.
I've learned it's always better to be explicit then implicit, and this snippet 
of code does a lot in an implicit way.

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


Re: Python Magazine

2013-06-12 Thread Jonas Geiregat

On 31 May 2013, at 13:11, DRJ Reddy wrote:

> Hello all,
>Was busy with work. Finally finished the job of registering the domain 
> name.
> Will be live soon. The url is http://pythonmagazine.org. Hope we will be live 
> soon.


I was surprised when I saw it  is running on ASP.NET, can this be ?

Server: Microsoft-IIS/7.0
Vary: Accept-Encoding
X-Pingback: http://pythonmagazine.org/xmlrpc.php
X-Powered-By: ASP.NET

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


[Ann] pyBug - Python Belgian User Group

2012-09-18 Thread Jonas Geiregat
Hello everyone and,
especially all python user from Belgium.

I'm proud to announce the creation of a User Group around Python for the 
Belgium community.

It has been baptized pyBug which stands for Python Belgian User Group. 

We're just starting out and will need all the help we can get , even if it's 
just becoming a member.

Our main focus is enjoying ourself by organizing events where we can talk, 
collaborate around everything that is related to Python.

If you care to join or just listen what's going on, we've registered a mailing 
list at google groups.

It's located at: 
https://groups.google.com/forum/?fromgroups#!forum/python-belgian-user-group

You can also subscribe by sending an email to 
[email protected]

Hope to see you there.

Yours sincerely,

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


[ANN] aioxmpp 0.7.1 (sic!) released

2016-10-08 Thread Jonas Wielicki
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Dear subscribers,

I am pleased to announce the release of aioxmpp 0.7.1 (footnote 1). The 
current release can be obtained from GitHub [1] (check out the v0.6.0 tag or 
the master branch) or PyPI [2]. The HTML documentation can be found at [3]. 
Examples can be found in the GitHub repository, in the examples subdirectory.


aioxmpp is a Python library based on asyncio. It implements the client side of 
the XMPP protocol (RFC 6120 and others). For a more detailed description of 
the package, please review the README of the package on GitHub [1] or on PyPI 
[2]. For more information on XMPP, please see [9]. It is licensed under the 
terms of the GNU Lesser General Public License Version 3.0 or later.


The most important change in this release is the change of the license from 
GPLv3+ to LGPLv3+! (the same holds for aiosasl, which just had its v0.2.1 
release)


The functional highlights of this release are base support for Data Forms 
[XEP-0004] and a first application of those in the Multi User Chats [XEP-0045] 
implementation. Aside from that, the examples have been refactored and 
rewritten. A Quickstart section was added to the documentation [4], hopefully 
helping people to get started with aioxmpp easier.


Bugs, feature requests, patches and questions can be directed to either the
aioxmpp mailing list [5], the GitHub issue tracker [6] or the XMPP Multi-User
chat [7], whatever floats your boat. Please direct security-relevant issue
reports directly to me ([email protected]), preferrably encrypted using my
GPG public key [8].

best regards and happy-asyncio-ing,
Jonas Wielicki


footnote 1: 0.7.0 and 0.7.1 are functionally identical. I messed up the 0.7.0 
release by forgetting to change the license in the setup.py to LGPLv3+, which 
made PyPI show the incorrect GPLv3 license.


   [1]: https://github.com/horazont/aioxmpp
   [2]: https://pypi.python.org/pypi/aioxmpp
   [3]: https://docs.zombofant.net/aioxmpp/0.7/
   [4]: https://docs.zombofant.net/aioxmpp/0.7/user-guide/quickstart.html
   [5]: https://lists.zombofant.net/mailman/listinfo/aioxmpp-devel
   [6]: https://github.com/horazont/aioxmpp/issues
   [7]: [email protected]
   [8]: https://sks-keyservers.net/pks/lookup?op=get&search=0xE5EDE5AC679E300F
AA5A 78FF 508D 8CF4 F355  F682 E5ED E5AC 679E 300F
   [9]: https://xmpp.org/
   [XEP-0004]: https://xmpp.org/extensions/xep-0004.html
   [XEP-0045]: https://xmpp.org/extensions/xep-0045.html

-BEGIN PGP SIGNATURE-

iQIcBAEBCgAGBQJX+QpbAAoJEMBiAyWXYliKcscQALcWdCreg8kz5xxwAPq3JiiD
4K8kVL605h2JVvSFDJ83XqrR23A56gYattyg+D3jJ5/ek5ckTJwvmc39gnJOlQj+
N0KN4QqkikC5ivqSSvJItOKvBowRvCJ3qs5hdKJ93COTVPX+jbRo4swgGhLf8txj
zIQApIeKU09YiFqWZjI4WT84ovG/jmVuqAE5QWhl8Hxc6+taKNpgAgwwT/2uSF0q
wJkcbHekEeygET4xk6W858k0zNW88ybhBLS31boxsRRqcvHWyyb2DWprb4mWtI9K
aJVUJGaq+kPdyWwCctdzpEc8Pvm3yb+s34SWx0eYhNVEOmFEPc5y+D++pzIyiue1
njDl7KURTHRHyCuKxd75ekWjzB7bkdXyr1mAAn6NlUMuIYOU0Nmf6Df8BWrCO/st
vP4rPzWOOnCN30E6Q+hl1CZql68rDqoon2Le2zJe+2osljc4lm98hBwsxEXXm9ay
u4SkvTuh3GYQmjtcW4AIU5aA8s9PpusJYKLkBZOZV1vx5hSwe8ZoSEHXPOdbhdkm
25b4Vk7yLM6M4JtVn7Iq0KK9wb1pisvEFlkhpVmAMqPNhYEpjvT4nGkV98NfKKla
PpCqXiLh7Q+vD7yE7tW3Ss190QlqklMwIg2wZ/OlsJFcsTOlp0WHCgRyzKdhLcAW
1LbrAlB27J4X5NBZTK3a
=srny
-END PGP SIGNATURE-

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


[ANN] aioxmpp 0.7.2 released

2017-01-05 Thread Jonas Wielicki
Dear subscribers,

I am pleased to announce the release of aioxmpp 0.7.1 (footnote 1). The
current release can be obtained from GitHub [1] (check out the v0.6.0 tag or
the master branch) or PyPI [2]. The HTML documentation can be found at [3].
Examples can be found in the GitHub repository, in the examples subdirectory.


aioxmpp is a Python library based on asyncio. It implements the client side of
the XMPP protocol (RFC 6120 and others). For a more detailed description of
the package, please review the README of the package on GitHub [1] or on PyPI
[2]. For more information on XMPP, please see [8]. It is licensed under the
terms of the GNU Lesser General Public License Version 3.0 or later.


Version 0.7.2 is a bugfix release. The most severe issue which has been fixed 
is that message stanzas without from attribute caused the stream to crash. 
Other bugfixes included are listed in the changelog [9].


Bugs, feature requests, patches and questions can be directed to either the
aioxmpp mailing list [4], the GitHub issue tracker [5] or the XMPP Multi-User
chat [6], whatever floats your boat. Please direct security-relevant issue
reports directly to me ([email protected]), preferrably encrypted using my
GPG public key [7].

best regards and happy-asyncio-ing,
Jonas Wielicki


footnote 1: 0.7.0 and 0.7.1 are functionally identical. I messed up the 0.7.0
release by forgetting to change the license in the setup.py to LGPLv3+, which
made PyPI show the incorrect GPLv3 license.


   [1]: https://github.com/horazont/aioxmpp
   [2]: https://pypi.python.org/pypi/aioxmpp
   [3]: https://docs.zombofant.net/aioxmpp/0.7/
   [4]: https://lists.zombofant.net/mailman/listinfo/aioxmpp-devel
   [5]: https://github.com/horazont/aioxmpp/issues
   [6]: [email protected]
   [7]: https://sks-keyservers.net/pks/lookup?op=get&search=0xE5EDE5AC679E300F
AA5A 78FF 508D 8CF4 F355  F682 E5ED E5AC 679E 300F
   [8]: https://xmpp.org/
   [9]: https://docs.zombofant.net/aioxmpp/0.7/api/
changelog.html#version-0-7-2
-- 
https://mail.python.org/mailman/listinfo/python-list


Output not defined

2018-06-01 Thread jonas . thornvall
Can any web programmer tell me why output is not defined?
I know this is python group but my code is so rudimentary that probably any 
sufficient good webprogrammer can figure it out, but i am lost."I've tried 
comp.lang.javascript"

Problem is I've looked upon this for a week or two, and i just can't figure out 
why output is not defined. 

My hangup is probably because it works without problem when i run it in under 
windows XP browser, and that make me confused."I started program it in XP but 
now i want to transition into more modern browsers, Linux and windows 10" 

https://3d16zci4vuzyxt8hxvovrg-on.drv.tw/Website/midi.html 

Any help or even suggestion would be greatly appreciated. 

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


[ANN] aioxmpp 0.10 released

2018-07-26 Thread Jonas Wielicki
Dear subscribers,

We are pleased to announce the release of aioxmpp 0.10. The current release 
can be obtained from GitHub [1] (check out the v0.10.0 tag) or PyPI [2]. The  
HTML documentation can be found at [3]. Examples can be found in the GitHub  
repository, in the examples sub directory.


aioxmpp is a Python library based on asyncio. It implements the client side of  
the XMPP protocol (RFC 6120 and others). For a more detailed description of  
the package, please review the README of the package on GitHub [1] or on PyPI 
[2]. For more information on XMPP, please see [8]. aioxmpp is licensed under  
the terms of the GNU Lesser General Public License Version 3.0 or later.


Version 0.10 is a feature release. 

* Support for XEP-0077 (In-Band Registration) was contributed by Sergio 
Alemany [@gersiete].

* Support for requesting an HTTP upload slot via XEP-0363 (HTTP Upload) and 
support for requesting and replying to XEP-0092 (Software Version) requests.

Aside from these newly supported XEPs, much of the work has been on plumbing. 
Some of the highlights include:

* New timeout logic which should help on links with high latency

* Enumification of Stanza and Stream Error Conditions

* Streamlinging of the aioxmpp.im interfaces and support for MUC invitations.

The full list of new features is, as always, included in the changelog [9]  
included in the official documentation.


Bugs, feature requests, patches and questions can be directed to either the 
aioxmpp mailing list [4], the GitHub issue tracker [5] or the XMPP Multi-User 
chat [6], whatever floats your boat. Please direct security-relevant issue 
reports directly to me ([email protected]), preferably encrypted using my 
GPG public key [7].

best regards and happy-asyncio-ing,
The aioxmpp team

   [1]: https://github.com/horazont/aioxmpp
   [2]: https://pypi.python.org/pypi/aioxmpp
   [3]: https://docs.zombofant.net/aioxmpp/0.10/
   [4]: https://lists.zombofant.net/mailman/listinfo/aioxmpp-devel
   [5]: https://github.com/horazont/aioxmpp/issues
   [6]: [email protected]
   [7]: https://sks-keyservers.net/pks/lookup?op=get&search=0xE5EDE5AC679E300F
AA5A 78FF 508D 8CF4 F355  F682 E5ED E5AC 679E 300F
   [8]: https://xmpp.org/
   [9]: https://docs.zombofant.net/aioxmpp/0.10/api/
changelog.html#version-0-10
   @gersiete: https://github.com/Gersiete


signature.asc
Description: This is a digitally signed message part.
-- 
https://mail.python.org/mailman/listinfo/python-list


[ANN] aioxmpp 0.10.1 released

2018-08-11 Thread Jonas Wielicki
Dear subscribers,

We are pleased to announce the release of aioxmpp 0.10.1. The current release 
can be obtained from GitHub [1] (check out the v0.10.1 tag) or PyPI [2]. The  
HTML documentation can be found at [3]. Examples can be found in the GitHub  
repository, in the examples sub directory.

aioxmpp is a Python library based on asyncio. It implements the client side of  
the XMPP protocol (RFC 6120 and others). For a more detailed description of  
the package, please review the README of the package on GitHub [1] or on PyPI 
[2]. For more information on XMPP, please see [8]. aioxmpp is licensed under  
the terms of the GNU Lesser General Public License Version 3.0 or later.


Version 0.10.1 is a bugfix release with possible security implications. 

It was discovered that two types of specifically crafted (invalid) IQ stanzas 
could make aioxmpp 0.10.0 disconnect, leading to a Denial-of-Service type 
effect. We decided to push a release quickly to fix this issue. Thanks to 
Martin for discovering and reporting the issue.


Bugs, feature requests, patches and questions can be directed to either the 
aioxmpp mailing list [4], the GitHub issue tracker [5] or the XMPP Multi-User 
chat [6], whatever floats your boat. Please direct security-relevant issue 
reports directly to me ([email protected]), preferably encrypted using my 
GPG public key [7].

kind regards,
Jonas

   [1]: https://github.com/horazont/aioxmpp
   [2]: https://pypi.python.org/pypi/aioxmpp
   [3]: https://docs.zombofant.net/aioxmpp/0.10/
   [4]: https://lists.zombofant.net/mailman/listinfo/aioxmpp-devel
   [5]: https://github.com/horazont/aioxmpp/issues
   [6]: [email protected]
   [7]: https://sks-keyservers.net/pks/lookup?op=get&search=0xE5EDE5AC679E300F
AA5A 78FF 508D 8CF4 F355  F682 E5ED E5AC 679E 300F
   [8]: https://xmpp.org/



signature.asc
Description: This is a digitally signed message part.
-- 
https://mail.python.org/mailman/listinfo/python-list


[ANN] aioxmpp 0.6 released

2016-07-02 Thread Jonas Wielicki
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Dear subscribers,

I am pleased to announce the release of aioxmpp 0.6. The current release can 
be obtained from GitHub [1] (check out the v0.6.0 tag or the master branch) or 
PyPI [2]. The HTML documentation can be found at [3]. Examples can be found in 
the GitHub repository, in the examples subdirectory.


aioxmpp is a Python library based on asyncio. It implements the client side of 
the XMPP protocol (RFC 6120 and others). For a more detailed description of 
the package, please review the README of the package on GitHub [1] or on PyPI 
[2]. For more information on XMPP, please see [10]. It is licensed under the 
terms of the General Public License Version 3.0.


Highlights of this release include partial Publish/Subscribe support 
[XEP-0060], several bugfixes in the existing Multi-User-Chat implementation 
[XEP-0045], increased robustness against broken servers and clients, as well 
as support for XMPP-over-TLS (in addition to the existing STARTTLS support) 
[XEP-0368].

Also to mention are the two new dependencies, multidict [4] and optionally 
aioopenssl [5]. The latter has been extracted from aioxmpp by request of a 
user. aioxmpp however ships with its own version of aioopenssl which it uses 
when aioopenssl is not installed.

Bugs, feature requests, patches and questions can be directed to either the 
aioxmpp mailing list [6], the GitHub issue tracker [7] or the XMPP Multi-User 
chat [8], whatever floats your boat. Please direct security-relevant issue 
reports directly to me ([email protected]), preferrably encrypted using my 
GPG public key [9].

best regards and happy-asyncio-ing,
Jonas Wielicki


   [1]: https://github.com/horazont/aioxmpp
   [2]: https://pypi.python.org/pypi/aioxmpp
   [3]: https://docs.zombofant.net/aioxmpp/0.6/
   [4]: https://github.com/aio-libs/multidict/
   [5]: https://github.com/horazont/aioopenssl
   [6]: https://lists.zombofant.net/mailman/listinfo/aioxmpp-devel
   [7]: https://github.com/horazont/aioxmpp/issues
   [8]: [email protected]
   [9]: https://sks-keyservers.net/pks/lookup?op=get&search=0xE5EDE5AC679E300F
AA5A 78FF 508D 8CF4 F355  F682 E5ED E5AC 679E 300F
   [10]: https://xmpp.org/
   [XEP-0045]: https://xmpp.org/extensions/xep-0045.html
   [XEP-0060]: https://xmpp.org/extensions/xep-0060.html
   [XEP-0368]: https://xmpp.org/extensions/xep-0368.html
-BEGIN PGP SIGNATURE-
Version: GnuPG v2

iQIcBAEBCgAGBQJXd8TbAAoJEMBiAyWXYliKUnoP/0mEvfNrk+kL9scljIKyjSHF
47gkQBgvNMPAEUMSi5UVMkXworeVDKEpCB+P3kE4Z7XsRLxFgFSUGywYN7WL0w/s
rpiUnJrOzPrsKiqmPTu2eOGDeuKNCz/ZSZqyl1Ic8Mj42cS9DjGh+PUwEpWBnskS
Dg4onj4clWpDsZGizR8YXkFkc8rmsUhHwvqQt29tOZ89qQnmOY4pCKyoTbxYLQKv
UerfiNG4AWFFuyetZJFUORdVhWEgFvivqJuES5g7NijgRmEOZV8tcYj0YAtggEP0
GQX5mE/KqHzHErR1/AAVnv2hXlqBBxc3diSXT6k+95wLkXz0n2YmPFCFPSl235Ru
uiUiW0xbQqJgjJ+B20NsuIMd+t1M/lnDw4cZgLkMUCsl6gsZEhL0mUf5iK9UDCH9
HbXsoMuz71t+Z8XN8GnibxDFPvCBERNqvIU+onjt63rT/yB/i/7XTbS4zQExCGhF
z4qVF8dY2q+d4EsIvd1dxLkP7dRFW7VK1FxiuutS5OTNEBsocROaXPDOjRyzdXGx
mSH3P/IuXxEil9kKHkXNZRQwSgl6J4PvAeySn58d3bpmHi8hu2J83ZoeFLdxHMoe
qOhkBB/v4QRbEgjXIqF8OmtGtNO9hXlM7EN6ouc9pvCJ1XGnBU9Z9FX4AkQMQUu/
AfDKZ8VFptxvQh1dtCD1
=ir6C
-END PGP SIGNATURE-

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


Compression of random binary data

2016-07-11 Thread jonas . thornvall
What kind of statistic law or mathematical conjecture  or is it even a physical 
law is violated by compression of random binary data? 

I only know that Shanon theorised it could not be done, but were there any 
proof? 

What is to say that you can not do it if the symbolic representation is richer 
than the symbolic represenatation of the dataset. 

Isn't it a fact that the set of squareroots actually depict numbers in a 
shorter way than their actual representation. 

Now the inpretator or program must know the rules. And i have very good rules 
to make it happen. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compression of random binary data

2016-07-11 Thread jonas . thornvall
Den måndag 11 juli 2016 kl. 20:09:39 UTC+2 skrev Waffle:
> On 11 July 2016 at 20:52,   wrote:
> > What kind of statistic law or mathematical conjecture  or is it even a 
> > physical law is violated by compression of random binary data?
> >
> > I only know that Shanon theorised it could not be done, but were there any 
> > proof?
> 
> Compression relies on some items in the dataset being more frequent
> than others, if you have some dataset that is completely random it
> would be hard to compress as most items have very similar number of
> occurrances.
> 
> > What is to say that you can not do it if the symbolic representation is 
> > richer than the symbolic represenatation of the dataset.
> >
> > Isn't it a fact that the set of squareroots actually depict numbers in a 
> > shorter way than their actual representation.
> 
> A square root may be smaller numerically than a number but it
> definitely is not smaller in terms of entropy.
> 
> lets try to compress the number 2 for instance using square roots.
> sqrt(2) = 1.4142
> the square root actually takes more space in this case even tho it is
> a smaller number. so having the square root would have negative
> compression in this case.
> with some rounding back and forth we can probably get around the fact
> that sqrt(2) would take an infinite amout of memory to accurately
> represent but that neccesarily means restricting the values we are
> possible of encoding.
> 
> for sqrt(2) to not have worse space consumprion than the number 2
> itself we basically have to trow away precision so sqrt(2) ~= 1
> now i challenge you to get that 2 back out of that 1..

Well who it to say different kind of numbers isn't treated differently, i mean 
all numbers isn't squares. All numbers isn't naturals.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compression of random binary data

2016-07-11 Thread jonas . thornvall
Den måndag 11 juli 2016 kl. 20:24:37 UTC+2 skrev [email protected]:
> Den måndag 11 juli 2016 kl. 20:09:39 UTC+2 skrev Waffle:
> > On 11 July 2016 at 20:52,   wrote:
> > > What kind of statistic law or mathematical conjecture  or is it even a 
> > > physical law is violated by compression of random binary data?
> > >
> > > I only know that Shanon theorised it could not be done, but were there 
> > > any proof?
> > 
> > Compression relies on some items in the dataset being more frequent
> > than others, if you have some dataset that is completely random it
> > would be hard to compress as most items have very similar number of
> > occurrances.
> > 
> > > What is to say that you can not do it if the symbolic representation is 
> > > richer than the symbolic represenatation of the dataset.
> > >
> > > Isn't it a fact that the set of squareroots actually depict numbers in a 
> > > shorter way than their actual representation.
> > 
> > A square root may be smaller numerically than a number but it
> > definitely is not smaller in terms of entropy.
> > 
> > lets try to compress the number 2 for instance using square roots.
> > sqrt(2) = 1.4142
> > the square root actually takes more space in this case even tho it is
> > a smaller number. so having the square root would have negative
> > compression in this case.
> > with some rounding back and forth we can probably get around the fact
> > that sqrt(2) would take an infinite amout of memory to accurately
> > represent but that neccesarily means restricting the values we are
> > possible of encoding.
> > 
> > for sqrt(2) to not have worse space consumprion than the number 2
> > itself we basically have to trow away precision so sqrt(2) ~= 1
> > now i challenge you to get that 2 back out of that 1..
> 
> Well who it to say different kind of numbers isn't treated differently, i 
> mean all numbers isn't squares. All numbers isn't naturals.

But it could be all numbers are foldable. Both the integer parts and the real 
parts.And be expressed by the folding differences.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compression of random binary data

2016-07-12 Thread jonas . thornvall
Den måndag 11 juli 2016 kl. 20:38:51 UTC+2 skrev Steven D'Aprano:
> On Tue, 12 Jul 2016 03:52 am, [email protected] wrote:
> 
> > What kind of statistic law or mathematical conjecture  or is it even a
> > physical law is violated by compression of random binary data?
> 
> The pigeon hole principle. If you have 100 pigeon holes, and 101 pigeons,
> then clearly at least one pigeon hole must have two pigeons in it.
> 
> To keep the numbers small and manageable, let's say we are going to compress
> one byte at a time. Now a byte has eight bits, so there are exactly 256
> possible bytes:
> 
>  
>  0001
>  0010
> ...
>  1110
>  
> 
> Now, suppose I claim that I can LOSSLESSLY (that is, reversibly) compress
> any random byte to just two bits. The lossless part is important: its not
> hard to compress random data by irreversibly throwing some of it away, and
> there's no violation there.
> 
> So I claim that you can give me any random byte, I will compress it to just
> two bits:
> 
> 00
> 01
> 10
> 11
> 
> and then be able to decompress it back again to give you the original byte
> once more.
> 
> Obviously I'm trying to pull a fast one! There's no way I can do this. I can
> squeeze 256 pigeons into just four pigeon holes, but only by doubling them
> up. Suppose I compress these three bytes to 00:
> 
>  
> 0110 1001
> 1100 0110
> 
> Now when I go to uncompress 00, what should I return? There is no way for me
> to know which of the three was the original value.
> 
> (If I'm cunning, I'll have sneakily stored some data *elsewhere*, say, in
> the file name, or in a database, so that you need this extra hidden data to
> uncompress the 00 back to a full byte. But then I'm not compressing eight
> bits down to two. I'm compressing eight bits down to two bits plus
> who-knows-how-many-bits of hidden data.)
> 
> So the pigeon hole principle tells us one of two things:
> 
> (1) If you compress random data, then it must be lossy; I can compress eight
> bits to two, but then I can't uncompress it back again, at least not
> without throwing away some data.
> 
> (2) Or, if the compression is lossless, then some data must be expanded
> rather than compressed. If you pick data at random, some of it will be
> expanded.
> 
> Suppose I have a compression algorithm that infallibly and reversibly
> compresses as follows:
> 
>   <--> 00
>  0001 <--> 01
>  0010 <--> 10
>  0011 <--> 11
> 
> That part is fine. But what will my algorithm do with the other 252 bytes?
> At *best* it will leave them untouched:
> 
>  0100 <-->  0100
> ...
>   <-->  
> 
> which is no compression at all, but at worst it will actually expand them
> and make them bigger. (After all, it's likely that my compression format
> has at least a bit of overhead.)
> 
> In practice, compression algorithms are designed to look for particular
> kinds of order or structure in the data, and compress that. That's fine for
> the sorts of non-random data we care about: pictures are rarely pictures of
> static, text files are rarely random collections of bits. But if you do
> throw a random set of bits at a lossless compression algorithm, it will at
> best not compress it at all, and at worst actually make the file bigger.
> 
> 
> > What is to say that you can not do it if the symbolic representation is
> > richer than the symbolic represenatation of the dataset.
> > 
> > Isn't it a fact that the set of squareroots actually depict numbers in a
> > shorter way than their actual representation.
> 
> Sure. But you need to know what √2 means. It *represents* the number
> 1.41421356237... but doesn't compress it. There's nothing you can do to the
> symbol √2 that will uncompress back to the infinite series of digits. All
> you can do is look it up somewhere to see what the digits are.
> 
> > Now the inpretator or program must know the rules. And i have very good
> > rules to make it happen.
> 
> Right. How much information is in the rules? More than you save with
> the "compression". Consider:
> 
> 1.41421356237 compressed down to √2, that's 13 characters down to 2. Great!
> But to *uncompress*, you need to store a rule:
> 
> √2=1.41421356237 
> 
> and that's *sixteen* characters. So your "compression" is:
> 
> original: 13
> compressed to: 2
> plus rule: 16
> 
> means you have "compressed" 13 characters to 18.
> 
> Now, this is still worth doing if you need to repeat the √2 many times, so
> long as you don't have to repeat the rule. That's useful. But it's not
> compression. It's more like keeping an index to a database, or a scrap of
> paper with the title of a book written on it:
> 
> "See Lord Of The Rings, by J.R.R. Tolkien"
> 
> That's a lot smaller than the actual book: eight words, instead of who knows
> how many tens of thousands. But you can't call it compression: you can't
> sit down with the scrap of paper *and nothing else* and uncompress it back
> to the entire LOTR trilogy.
> 
> 
> 
> 

Re: Compression of random binary data

2016-07-12 Thread jonas . thornvall
Den tisdag 12 juli 2016 kl. 05:01:20 UTC+2 skrev Lawrence D’Oliveiro:
> On Tuesday, July 12, 2016 at 5:52:27 AM UTC+12, [email protected] wrote:
> 
> > What kind of statistic law or mathematical conjecture  or is it even a
> > physical law is violated by compression of random binary data? 
> 
> Try compressing already-compressed data.
> 
> Does that answer your question?

Yes that is my question, and also a claim i can do it.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compression of random binary data

2016-07-12 Thread jonas . thornvall
Den tisdag 12 juli 2016 kl. 17:12:01 UTC+2 skrev Steven D'Aprano:
> On Wed, 13 Jul 2016 12:24 am, [email protected] wrote:
> 
> > Den måndag 11 juli 2016 kl. 20:38:51 UTC+2 skrev Steven D'Aprano:
> >> On Tue, 12 Jul 2016 03:52 am, [email protected] wrote:
> >> 
> >> > What kind of statistic law or mathematical conjecture  or is it even a
> >> > physical law is violated by compression of random binary data?
> >> 
> >> The pigeon hole principle. If you have 100 pigeon holes, and 101 pigeons,
> >> then clearly at least one pigeon hole must have two pigeons in it.
> [...]
> > But it seem your reasoning is based upon interpretation of the actual
> > digits, bits and bytes value.
> 
> Not at all. If you think that, you've misread my example. There's no
> interpretation of the bytes: they are just 8-bit numbers from 0 to 255. You
> cannot losslessly compress all 256 of them to just four 2-bit numbers.
> 
> 
> > There could be different interpretation 
> > worlds of course you would have to chose one using digits, An 
> > interpretationworld here could be reading out different word lengths of
> > the dataset and maybe a lookup table.
> 
> Any lookup table you have counts as part of the compressed data.
> 
> 
> > But it could also be arithmetic rules that magically recreate a number
> > from a number of folds or difference of folds.
> 
> Oh, sure, if you believe in magic, anything is possible. Just close your
> eyes, click your heels together, and wish really, really hard.
> 
> Suppose I could compress ANY random data, no matter what, down to 10% of the
> original size. Okay, let's start with a million bits of data. Compress it
> down to 100,000 bits.
> 
> But I believe that I can compress *anything*, any random collection of data.
> Okay, let me compress it again. Now I have 10,000 bits.
> 
> Compress it again. Now I have 1,000 bits.
> 
> Compress it again. Now I have 100 bits.
> 
> Compress it again. Now I have 10 bits.
> 
> Compress it again. Now I have 1 bit, either a 0 or a 1.
> 
> 
> Can you not see how absurd this is? I have claimed that I can take *any*
> random set of data, and by compressing it again and again and again,
> compress it down to ONE BIT, either a 0 or a 1, WITHOUT LOSS. Somehow I
> have to take that 0 bit and uncompress it back to the Complete Works Of
> William Shakespeare, and *also* uncompress it back to the recent Deadpool
> movie, AND uncompress it back to last year's Ant Man movie, AND uncompress
> it back to some funny picture of a cat.
> 
> How can I possibly know which of the billions and billions of different
> files this 0 bit represents?
> 
> If you pass me a 0 bit, and say "uncompress this", and I get The Lord Of The
> Rings novels, and then you pass me another 0 bit, and I uncompress it and
> get The Hobbit, well, how did I tell the two bits apart? They're both zero.
> 
> 
> 
> The alternative is to say, it doesn't matter how clever you are, you can't
> compress *everything*. There are some things that simply won't compress.
> Eventually you get something no longer compresses. If you could compress
> EVERYTHING, then you could compress the compressed data, and compress the
> compressed-compressed data, and so on, until you've got only a single bit.
> And that is ridiculous.
> 
> 
> 
> -- 
> Steven
> “Cheer up,” they said, “things could be worse.” So I cheered up, and sure
> enough, things got worse.

No it is only compressible down to a limit given by the algorithm.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compression of random binary data

2016-07-12 Thread jonas . thornvall
Den tisdag 12 juli 2016 kl. 17:19:54 UTC+2 skrev Steven D'Aprano:
> On Wed, 13 Jul 2016 12:29 am, [email protected] wrote:
> 
> > Den tisdag 12 juli 2016 kl. 05:01:20 UTC+2 skrev Lawrence D’Oliveiro:
> >> On Tuesday, July 12, 2016 at 5:52:27 AM UTC+12, [email protected]
> >> wrote:
> >> 
> >> > What kind of statistic law or mathematical conjecture  or is it even a
> >> > physical law is violated by compression of random binary data?
> >> 
> >> Try compressing already-compressed data.
> >> 
> >> Does that answer your question?
> > 
> > Yes that is my question, and also a claim i can do it.
> 
> Can you also make a perpetual motion machine, square the circle, and find an
> exact rational fraction equal to pi?
> 
> 
> What gets me is the people who *say* that they can compress already
> compressed data. We know they can't, because if they could, they could
> compress it again and again and again and again until there was only a
> single bit, AND STILL REVERSE IT, using no external storage. Your lookup
> tables are part of the compressed data. If the "compressed file" plus the
> lookup table is bigger than the original file, then you haven't really
> compressed anything. You've just moved some of it from the file into a
> lookup table.
> 
> So why do people claim that they can compress already compressed data? Who
> are they fooling? Themselves?
> 
> 
> 
> -- 
> Steve

Well the algorithm start with looking up a suitable folding structure "close 
enough to the number", then it works down the folding structure finding the 
fold where the difference or sum between the folds closest to zero.

You do the same prinicple with the remainder until zero is achieved.

So our first fold can either be bigger or smaller, and it seek a configuration 
for the fold that close in max on the actual random number. The second fold 
could be a fold that depending upon our first fold was bigger or smaller than 
number either will add or subtract lower layers of the fold. 

There will come out a difference that need to be folded, the process is 
repeated until there is nothing to fold.

It is basicly a search algorithm looking for suitable folding structures.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compression of random binary data

2016-07-12 Thread jonas . thornvall
Den tisdag 12 juli 2016 kl. 20:20:52 UTC+2 skrev Michael Torrie:
> On 07/12/2016 11:46 AM, [email protected] wrote:
> > Well the algorithm start with looking up a suitable folding structure
> > "close enough to the number", then it works down the folding
> > structure finding the fold where the difference or sum between the
> > folds closest to zero.
> > 
> > You do the same prinicple with the remainder until zero is achieved.
> > 
> > So our first fold can either be bigger or smaller, and it seek a
> > configuration for the fold that close in max on the actual random
> > number. The second fold could be a fold that depending upon our first
> > fold was bigger or smaller than number either will add or subtract
> > lower layers of the fold.
> > 
> > There will come out a difference that need to be folded, the process
> > is repeated until there is nothing to fold.
> > 
> > It is basicly a search algorithm looking for suitable folding
> > structures.
> 
> Better patent it quickly then.  And you will win a noble prize for math
> if you could do what you say you could.

I doubt it i never got anyone before for my ideas.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compression of random binary data

2016-07-12 Thread jonas . thornvall
Den tisdag 12 juli 2016 kl. 20:20:52 UTC+2 skrev Michael Torrie:
> On 07/12/2016 11:46 AM, [email protected] wrote:
> > Well the algorithm start with looking up a suitable folding structure
> > "close enough to the number", then it works down the folding
> > structure finding the fold where the difference or sum between the
> > folds closest to zero.
> > 
> > You do the same prinicple with the remainder until zero is achieved.
> > 
> > So our first fold can either be bigger or smaller, and it seek a
> > configuration for the fold that close in max on the actual random
> > number. The second fold could be a fold that depending upon our first
> > fold was bigger or smaller than number either will add or subtract
> > lower layers of the fold.
> > 
> > There will come out a difference that need to be folded, the process
> > is repeated until there is nothing to fold.
> > 
> > It is basicly a search algorithm looking for suitable folding
> > structures.
> 
> Better patent it quickly then.  And you will win a noble prize for math
> if you could do what you say you could.

I must stress when i say number here i really mean +10 decimal digit. So i 
basicly search in on big numbers that i compress. So i divide the dataset into 
suitable sizes for compression.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compression of random binary data

2016-07-12 Thread jonas . thornvall
Den tisdag 12 juli 2016 kl. 21:40:36 UTC+2 skrev [email protected]:
> Den tisdag 12 juli 2016 kl. 20:20:52 UTC+2 skrev Michael Torrie:
> > On 07/12/2016 11:46 AM, [email protected] wrote:
> > > Well the algorithm start with looking up a suitable folding structure
> > > "close enough to the number", then it works down the folding
> > > structure finding the fold where the difference or sum between the
> > > folds closest to zero.
> > > 
> > > You do the same prinicple with the remainder until zero is achieved.
> > > 
> > > So our first fold can either be bigger or smaller, and it seek a
> > > configuration for the fold that close in max on the actual random
> > > number. The second fold could be a fold that depending upon our first
> > > fold was bigger or smaller than number either will add or subtract
> > > lower layers of the fold.
> > > 
> > > There will come out a difference that need to be folded, the process
> > > is repeated until there is nothing to fold.
> > > 
> > > It is basicly a search algorithm looking for suitable folding
> > > structures.
> > 
> > Better patent it quickly then.  And you will win a noble prize for math
> > if you could do what you say you could.
> 
> I must stress when i say number here i really mean +10 decimal digit. So 
> i basicly search in on big numbers that i compress. So i divide the dataset 
> into suitable sizes for compression.

And the dataset chunks that comes out from the process can also be treated like 
a new datafile, so the compression is iterative down to a limit. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compression of random binary data

2016-07-12 Thread jonas . thornvall
Den onsdag 13 juli 2016 kl. 00:24:23 UTC+2 skrev Ian:
> On Tue, Jul 12, 2016 at 11:35 AM,   wrote:
> >
> > No it is only compressible down to a limit given by the algorithm.
> 
> Then your algorithm does not compress random data as you claimed.
> 
> For some input, determine the limiting output that it ultimately
> compresses down to. Take that output and feed it through your
> algorithm as if it were the original input. If the data are to be
> considered random, then this input is just as probable as the
> original. What output does the algorithm now create? If it just
> returns the input unchanged, then how do you discern the original
> input from this input when decompressing? If it returns a different
> output of the same size, then repeat the process with the new output.
> Now there are *two* outputs of that size that can't be repeated. There
> are only finitely many possible outputs of that size, so eventually
> you're going to have to get to one that either repeats an output -- in
> which case your algorithm produces the same output for two different
> inputs and is therefore incorrect -- or you will get to an input that
> produces an output *larger* in size than the original.

The dataset must have a certain size that is the only requirment, of course you 
can not compress something into nothing, at least the arithmetic ruleset need 
to be encoded but what would be the point to just compress something less than 
a couple of bytes. And of course the number of rounds you applied the algorithm 
must be stored. But that is no problem for small datasets.

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


Re: Compression of random binary data

2016-07-12 Thread jonas . thornvall
Den onsdag 13 juli 2016 kl. 00:24:23 UTC+2 skrev Ian:
> On Tue, Jul 12, 2016 at 11:35 AM,   wrote:
> >
> > No it is only compressible down to a limit given by the algorithm.
> 
> Then your algorithm does not compress random data as you claimed.
> 
> For some input, determine the limiting output that it ultimately
> compresses down to. Take that output and feed it through your
> algorithm as if it were the original input. If the data are to be
> considered random, then this input is just as probable as the
> original. What output does the algorithm now create? If it just
> returns the input unchanged, then how do you discern the original
> input from this input when decompressing? If it returns a different
> output of the same size, then repeat the process with the new output.
> Now there are *two* outputs of that size that can't be repeated. There
> are only finitely many possible outputs of that size, so eventually
> you're going to have to get to one that either repeats an output -- in
> which case your algorithm produces the same output for two different
> inputs and is therefore incorrect -- or you will get to an input that
> produces an output *larger* in size than the original.

The later sounds reasonable that is start toggle between states.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compression of random binary data

2016-07-13 Thread jonas . thornvall
Den onsdag 13 juli 2016 kl. 04:29:48 UTC+2 skrev Steven D'Aprano:
> On Wed, 13 Jul 2016 03:35 am, [email protected] wrote:
> 
> > No it is only compressible down to a limit given by the algorithm.
> 
> Right! Then there is data that you can't compress.
> 
> Suppose you have some data:
> 
> data = "ABABABABABAB...ABAB"
> 
> And you compress it "down to a limit":
> 
> x = compress(compress(compress(data)))
> print(x)
> => prints "@nx7%k!b"
> 
> Now let's try again with something else:
> 
> data = "AABBB..."
> 
> And you compress it "down to a limit":
> 
> x = compress(compress(compress(compress(data
> print(x)
> => prints "wu*$cS#k-pv32zx[&+r"
> 
> 
> One more time:
> 
> data = "AABBAABBAABBAABBAABB"
> x = compress(data)
> print(x)
> => prints "g^x3@"
> 
> 
> We agree on this. Now you say, "Give me some random data, anything at all,
> and I'll compress it!", and I run a random number generator and out pops:
> 
> data = "@nx7%k!b"
> 
> or possibly:
> 
> data = "wu*$cS#k-pv32zx[&+r"
> 
> or:
> 
> data = "g^x3@"
> 
> 
> and I say "Compress that!"
> 
> But we've already agreed that this is as compressed as you can possibly make
> it. You can't compress it any more.
> 
> So there's *at least some* random data that you can't compress. Surely you
> have to accept that. You don't get to say "Oh, I don't mean *that* data, I
> mean only data that I can compress". Random data means its random, you
> don't get to pick and choose between data you can compress and data that
> you can't.
> 
> Now the tricky part is to realise that its not just short sequences of
> random data that can't be compressed. The same applies for LONG sequences
> to. If I give you a gigabyte of raw video, you can probably compress that a
> fair bit. That's what things like x264 encoders do. The x265 encoder is
> even better. But they're lossy, so you can't reverse them.
> 
> But if I give you a gigabyte of random data, you'll be lucky to find *any*
> patterns or redundancies that allow compression. You might be able to
> shrink the file by a few KB. And if you take that already compressed file,
> and try to compress it again, well, you've already hit the limit of
> compression. There no more redundancy left to remove.
> 
> It doesn't matter how clever you are, or what a "folding structure" is, or
> how many times you iterate over the data. It's a matter of absolute
> simplicity: the pigeonhole principle. You can't argue with the numbers.
> 
> If you start with a 100 digit decimal number, there are 10**100 different
> pigeons. If you can compress down to a 6 digit decimal number, there are
> 10**6 pigeon holes. You cannot put 10*100 pigeons into 10**6 pigeon holes
> without doubling up (which makes your compression lossly).
> 
> So either some numbers cannot be compressed, or some numbers are compressed
> to the same result, and you can't tell which was the original. That's your
> choice: a lossless encoder means some numbers can't be compressed, a lossy
> encoder means you can't reverse the process exactly.
> 
> 
> 
> 
> 
> -- 
> Steven
> “Cheer up,” they said, “things could be worse.” So I cheered up, and sure
> enough, things got worse.

It is not that the data is not compressible i just need more chunks or random 
data, it is the footprint of the algorithm that has a certain it is a structure 
afterall albeit richer in interpretation than the numerical field.

You exchange size for computational complexity, but that may be true for any 
compression algorithm.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compression of random binary data

2016-07-13 Thread jonas . thornvall
Den onsdag 13 juli 2016 kl. 04:29:48 UTC+2 skrev Steven D'Aprano:
> On Wed, 13 Jul 2016 03:35 am, [email protected] wrote:
> 
> > No it is only compressible down to a limit given by the algorithm.
> 
> Right! Then there is data that you can't compress.
> 
> Suppose you have some data:
> 
> data = "ABABABABABAB...ABAB"
> 
> And you compress it "down to a limit":
> 
> x = compress(compress(compress(data)))
> print(x)
> => prints "@nx7%k!b"
> 
> Now let's try again with something else:
> 
> data = "AABBB..."
> 
> And you compress it "down to a limit":
> 
> x = compress(compress(compress(compress(data
> print(x)
> => prints "wu*$cS#k-pv32zx[&+r"
> 
> 
> One more time:
> 
> data = "AABBAABBAABBAABBAABB"
> x = compress(data)
> print(x)
> => prints "g^x3@"
> 
> 
> We agree on this. Now you say, "Give me some random data, anything at all,
> and I'll compress it!", and I run a random number generator and out pops:
> 
> data = "@nx7%k!b"
> 
> or possibly:
> 
> data = "wu*$cS#k-pv32zx[&+r"
> 
> or:
> 
> data = "g^x3@"
> 
> 
> and I say "Compress that!"
> 
> But we've already agreed that this is as compressed as you can possibly make
> it. You can't compress it any more.
> 
> So there's *at least some* random data that you can't compress. Surely you
> have to accept that. You don't get to say "Oh, I don't mean *that* data, I
> mean only data that I can compress". Random data means its random, you
> don't get to pick and choose between data you can compress and data that
> you can't.
> 
> Now the tricky part is to realise that its not just short sequences of
> random data that can't be compressed. The same applies for LONG sequences
> to. If I give you a gigabyte of raw video, you can probably compress that a
> fair bit. That's what things like x264 encoders do. The x265 encoder is
> even better. But they're lossy, so you can't reverse them.
> 
> But if I give you a gigabyte of random data, you'll be lucky to find *any*
> patterns or redundancies that allow compression. You might be able to
> shrink the file by a few KB. And if you take that already compressed file,
> and try to compress it again, well, you've already hit the limit of
> compression. There no more redundancy left to remove.
> 
> It doesn't matter how clever you are, or what a "folding structure" is, or
> how many times you iterate over the data. It's a matter of absolute
> simplicity: the pigeonhole principle. You can't argue with the numbers.
> 
> If you start with a 100 digit decimal number, there are 10**100 different
> pigeons. If you can compress down to a 6 digit decimal number, there are
> 10**6 pigeon holes. You cannot put 10*100 pigeons into 10**6 pigeon holes
> without doubling up (which makes your compression lossly).
> 
> So either some numbers cannot be compressed, or some numbers are compressed
> to the same result, and you can't tell which was the original. That's your
> choice: a lossless encoder means some numbers can't be compressed, a lossy
> encoder means you can't reverse the process exactly.
> 
> 
> 
> 
> 
> -- 
> Steven
> “Cheer up,” they said, “things could be worse.” So I cheered up, and sure
> enough, things got worse.

Ok, try to see it this way very big numbers can be described as the sum 
or difference between a sequense of a few polynomials. Unfortunately we lack 
the computational skill/computing power to find them.

That is not the case using foldings/geometric series.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compression of random binary data

2016-07-13 Thread jonas . thornvall
Den onsdag 13 juli 2016 kl. 12:05:03 UTC+2 skrev [email protected]:
> Den onsdag 13 juli 2016 kl. 04:29:48 UTC+2 skrev Steven D'Aprano:
> > On Wed, 13 Jul 2016 03:35 am, [email protected] wrote:
> > 
> > > No it is only compressible down to a limit given by the algorithm.
> > 
> > Right! Then there is data that you can't compress.
> > 
> > Suppose you have some data:
> > 
> > data = "ABABABABABAB...ABAB"
> > 
> > And you compress it "down to a limit":
> > 
> > x = compress(compress(compress(data)))
> > print(x)
> > => prints "@nx7%k!b"
> > 
> > Now let's try again with something else:
> > 
> > data = "AABBB..."
> > 
> > And you compress it "down to a limit":
> > 
> > x = compress(compress(compress(compress(data
> > print(x)
> > => prints "wu*$cS#k-pv32zx[&+r"
> > 
> > 
> > One more time:
> > 
> > data = "AABBAABBAABBAABBAABB"
> > x = compress(data)
> > print(x)
> > => prints "g^x3@"
> > 
> > 
> > We agree on this. Now you say, "Give me some random data, anything at all,
> > and I'll compress it!", and I run a random number generator and out pops:
> > 
> > data = "@nx7%k!b"
> > 
> > or possibly:
> > 
> > data = "wu*$cS#k-pv32zx[&+r"
> > 
> > or:
> > 
> > data = "g^x3@"
> > 
> > 
> > and I say "Compress that!"
> > 
> > But we've already agreed that this is as compressed as you can possibly make
> > it. You can't compress it any more.
> > 
> > So there's *at least some* random data that you can't compress. Surely you
> > have to accept that. You don't get to say "Oh, I don't mean *that* data, I
> > mean only data that I can compress". Random data means its random, you
> > don't get to pick and choose between data you can compress and data that
> > you can't.
> > 
> > Now the tricky part is to realise that its not just short sequences of
> > random data that can't be compressed. The same applies for LONG sequences
> > to. If I give you a gigabyte of raw video, you can probably compress that a
> > fair bit. That's what things like x264 encoders do. The x265 encoder is
> > even better. But they're lossy, so you can't reverse them.
> > 
> > But if I give you a gigabyte of random data, you'll be lucky to find *any*
> > patterns or redundancies that allow compression. You might be able to
> > shrink the file by a few KB. And if you take that already compressed file,
> > and try to compress it again, well, you've already hit the limit of
> > compression. There no more redundancy left to remove.
> > 
> > It doesn't matter how clever you are, or what a "folding structure" is, or
> > how many times you iterate over the data. It's a matter of absolute
> > simplicity: the pigeonhole principle. You can't argue with the numbers.
> > 
> > If you start with a 100 digit decimal number, there are 10**100 different
> > pigeons. If you can compress down to a 6 digit decimal number, there are
> > 10**6 pigeon holes. You cannot put 10*100 pigeons into 10**6 pigeon holes
> > without doubling up (which makes your compression lossly).
> > 
> > So either some numbers cannot be compressed, or some numbers are compressed
> > to the same result, and you can't tell which was the original. That's your
> > choice: a lossless encoder means some numbers can't be compressed, a lossy
> > encoder means you can't reverse the process exactly.
> > 
> > 
> > 
> > 
> > 
> > -- 
> > Steven
> > “Cheer up,” they said, “things could be worse.” So I cheered up, and sure
> > enough, things got worse.
> 
> Ok, try to see it this way very big numbers can be described as the 
> sum or difference between a sequense of a few polynomials. Unfortunately we 
> lack the computational skill/computing power to find them.
> 
> That is not the case using foldings/geometric series.

The sum or difference of a few small polynomials would still of course be a 
polynomial. But as i say it is a case of enrich the interpretation of the 
symbolic set that you look at you replace digits bits/integers with arithmetic 
describing them.
-- 
https://mail.python.org/mailman/listinfo/python-list


Not a python question, just programming logic trap?

2019-03-13 Thread jonas . thornvall
Anyone who is good at see logic traps in programming? comp.lang.javascript is 
defunct so i try here.

Using the metronome. 

https://midisequenser.000webhostapp.com 

I've tried to understand how following code can lead to that after the 
keyreleased the front of the keyed scrollbar raise/extend faster while the 
backend stay correct "in sync". One could think/imagine 
xFrontStart=scrollBarPos-FRONTOFFSET; somehow executed  more then once after 
release, but how could it, the keyrelease is true only in that part of code and 
only done once??? 

var FRONTOFFSET=0; 
var xKeylength=0; 
var xFrontStart=0; 
var xBackEnd=0; 
var keyreleased=false; 
function pianoSCROLL(){ 

 if(mess.data[0]==NOTE_ON && keyreleased==false){ 
xBackEnd=keylength; 
ctm.fillStyle = "magenta"; 

ctm.fillRect(xBackEnd,(PistartX+keyHeight*88)-(keyHeight*(mess.data[1]-8)), 
xFrontStart, keyHeight); 
if(FRONTOFFSET==0) {FRONTOFFSET=scrollBarPos;} 
xFrontStart=scrollBarPos-FRONTOFFSET; 
 } else if(mess.data[0]==NOTE_OFF && keyreleased==false){ 
   console.log("keyreleased!"); 
   keyreleased=true; 
   xBarLength=Math.round(xFrontStart-xBackEnd); 
   ctm.fillStyle = "black"; 
   ctm.fillRect(keylength, 
(PistartX+keyHeight*88)-(keyHeight*(mess.data[1]-8)), Mwidth, keyHeight+2); 
} 
if (keyreleased) { 
//console.log("timebar backend moving"); 
ctm.fillStyle = "black"; 
ctm.fillRect(keylength, 
(PistartX+keyHeight*88)-(keyHeight*(mess.data[1]-8)), Mwidth, keyHeight+2); 
ctm.fillStyle = "orange"; 

ctm.fillRect(xBackEnd,(PistartX+keyHeight*88)-(keyHeight*(mess.data[1]-8)),xFrontStart,
 keyHeight); 
xFrontStart=scrollBarPos-FRONTOFFSET; 
xBackEnd=Math.round(xFrontStart-xBarLength); 
console.log("xBackEnd="+xBackEnd+" xBarLength="+xBarLength+" 
xFrontStart="+xFrontStart); 
} 
} 

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


Re: Not a python question, just programming logic trap?

2019-03-14 Thread jonas . thornvall
Den torsdag 14 mars 2019 kl. 06:09:02 UTC+1 skrev Rick Johnson:
> [email protected] wrote:
> > Nah i can't see the error is due to the "If clause" branching possibly it 
> > should been an elseif at instead of separate if. No there is something 
> > going wrong with the variables.
> 
> Well, then you'd be wise to unpack those variables and inspect them.

I've done that there is nothing wrong with them the error comes when writing 
out to the canvas, and i rounded them so it is integer pixels. To be honest i 
think there maybe something with the canvas that goes wrong. A block of fixed 
length can't expand. I run console.logg()  barLength=xFrontStart-xBackEnd and 
it is constant at every call within if clause.  It is just that when canvas 
write out the values apparently the draw rectangle function somehow hold other 
values.

Well i restart the whole render programming, doing it right from start this 
time reading values from the record buffer and see if the animation problem 
magically dissapear. It could be something undefined affect the the variables.
-- 
https://mail.python.org/mailman/listinfo/python-list


[ANN] aioxmpp 0.11.0 released

2020-04-10 Thread Jonas Schäfer
Dear subscribers,

We are pleased to announce the release of aioxmpp 0.11.0. The current release 
can be obtained from GitHub [1] (check out the v0.11.0 tag) or PyPI [2]. The  
HTML documentation can be found at [3]. Examples can be found in the GitHub  
repository, in the examples sub directory.

aioxmpp is a Python library based on asyncio. It implements the client side of  
the XMPP protocol (RFC 6120 and others). For a more detailed description of  
the package, please review the README of the package on GitHub [1] or on PyPI 
[2]. For more information on XMPP, please see [8]. aioxmpp is licensed under  
the terms of the GNU Lesser General Public License Version 3.0 or later.


Version 0.11.0 is a feature release. It introduces support for XEP-0410 as 
well as several XSO schema for other XEPs. In addition, PubSub support for 
publish-options and node configuration was added. Aside from these highlights, 
there were many minor improvements and bug fixes. As always, there were also a 
few breaking changes, though most should not affect any user code. Finally, 
compatibility with Python 3.8 (requires aioopenssl v0.5.1, also released 
today) was introduced.


Bugs, feature requests, patches and questions can be directed to either the 
aioxmpp mailing list [4], the GitHub issue tracker [5] or the XMPP Multi-User 
chat [6], whatever floats your boat. Please direct security-relevant issue 
reports directly to me ([email protected]), preferably encrypted using my 
GPG public key [7].

kind regards,
Jonas

   [1]: https://github.com/horazont/aioxmpp
   [2]: https://pypi.python.org/pypi/aioxmpp
   [3]: https://docs.zombofant.net/aioxmpp/0.11/
   [4]: https://lists.zombofant.net/mailman/listinfo/aioxmpp-devel
   [5]: https://github.com/horazont/aioxmpp/issues
   [6]: [email protected]
   [7]: https://sotecware.net/pubkey.gpg
AA5A 78FF 508D 8CF4 F355  F682 E5ED E5AC 679E 300F
   [8]: https://xmpp.org/


signature.asc
Description: This is a digitally signed message part.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: HTTP GET request with basic authorization?

2005-01-02 Thread Jonas Galvez
Christopher J.  wrote:
> I tried this, but it didn't work:
> conn.request("GET", "/somepage.html", None,
> {"AUTHORIZATION": "Basic username:password"})

Hmm, try this:

import re, base64
userpass = base64.encodestring('user:pass').replace('\n', '')
authd = {'Authorization':'Basic %s' % userpass}
conn.request('GET', '/uri', None, authd)

Or this:

import re, base64, urllib2
 
userpass = ('user', 'pass')
url = 'http://somewhere'

request = urllib2.Request(url)
authstring = base64.encodestring('%s:%s' % userpass)
authstring = authstring.replace('\n', '')
request.add_header("Authorization", "Basic %s" % authstring)
 
content = urllib2.urlopen(request).read()
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python3: 'where' keyword

2005-01-10 Thread Jonas Galvez
Andrey Tatarinov wrote:
> It would be great to be able to reverse usage/definition parts 
> in haskell-way with "where" keyword.

Hi folks, I really like this idea. But I couldn't help but think 
of a few alternative ways. I'm no language design expert by any 
means, but I'm a little concerned with the idea of an 'expression' 
preceding a 'block'. Maybe I'm naive (actually, I'm pretty sure I 
am), but I think a decorator-like syntax would be a little more 
Pythonic. Here's a small example:

def where(closure=None, *v):
if not False in v:
closure(*v)

def foo(a, b):
@where(a: int, b: int):
return str(a) + str(b)
raise TypeMismatch

The (variable : type) could be turned into a syntact sugar for 
(type(variable) is type). Basically, this would be a simple 
implementation of the so called "closures", where a decorator is 
able to 'receive' a code block, which would be passed as a 
function as the first argument of the decorator. (Is this clear?)

As I said, I'm no language design expert and I'm sure I'm breaking 
a few important rules here heh. But I find it cool. This is not a 
proposal. I'm just thinking out loud :)


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


Re: What YAML engine do you use?

2005-01-20 Thread Jonas Galvez
Diez B. Roggisch wrote:
> I first used yaml, tried to migrate to syck. What I like about 
> syck is that it is faster and doesn't try to create objects but 
> only dicts - but it crashed if the number of yaml objects grew 
> larger. So I still use yaml.

Hmm.. I've never had any problems with syck. In fact, I'm using it in 
a small project now where I store a helluva of data in yaml files...

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


Re: check whether directory is readable

2005-08-23 Thread Jonas Geiregat
eels wrote:
> Hello,
> how can I check whether a directory is readable or not. Are there
> differences between unix and windows?

As far as I know there aren't any differences,

code:

import os
if access("/root", os.R_OK):
print "You are able to read the /root dir"

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


Re: Python and the web

2005-08-23 Thread Jonas Geiregat
Terry Hancock wrote:

> 
> Yes. If you're into killer apps, try out Zope.  But it does have a learning 
> curve.
> There are probably a dozen or so alternatives that are all "smaller and 
> quicker
> to learn".
>

Very true zope is a killer app, but different from all the other well 
know server side languages. I myself am still in the learning stage but 
if you're into web development zope is the best around.
But pay attention zope hosting can be expensive and hard to find.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: gtkmozembed in fedora core 3

2005-08-23 Thread Jonas Geiregat
Martin DeMello wrote:
> Could someone help me get gtkmozembed working under fc3? The only
> available rpms need gnome-python2 >= 2.9 and fc3 ships with 2.6. I can't
> find any fc3 rpms to upgrade gnome-python2 and I can't quite figure out
> what I'd need to compile just to install gtkmozembed and the python
> bindings (I need to deploy this at work, so I'm trying to make the
> minimal possible change to a stock fc3 install). Upgrading to fc4 is
> sadly not an option :-/
> 
> martin
> 

If you can't find any rpm's there aren't any available.
You need to compile mozilla with (I think) support for gtkmozembed but I 
guess that's done by default when you compile mozilla with 
ac_add_options --enable-default-toolkit=gtk2 in your mozconfig file.
Check /usr/lib/mozilla for libgtkembedmoz.so if it's not there you'll 
have to rebuild your mozilla/firefox rpm , again I think, these are just 
some random tips ..
Good luck!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: High Level FTP library

2005-08-23 Thread Jonas Geiregat
Paulo Pinto wrote:
> Hello,
> 
> Is there any Python library similar to NET::FTP from Perl?
> ftplib seems too lowlevel.
> 
> I already found a few, but would like to get one that is
> endorsed by the community.
> 
> Thanks,
> Paulo

libftp sucks just look at how it's written such evil code!
Not that I know of, write your own based on libftp good luck!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Email client in Pyhton

2005-08-24 Thread Jonas Geiregat
[EMAIL PROTECTED] wrote:
> Hi grp,
> I new to this grp and python too.
> i have started writing few python scripts myself.
> 
> now i am planning to write a bear minimum email client in
> pyhton. i found the smtp module of python could serve my
> pupose. I can send message using mails using the smtp lib.
> Now i'm looking for some modules which can help me in
> fetching the mails from the mailserver and managing folders.
> 
> I also look for some existing mail client, written in python 
> which wud serve my cause.
> 
> i searched google for no avail.
> 
Maybe start by reading some email related rfc's
-- 
http://mail.python.org/mailman/listinfo/python-list


questions concerning cgi.FieldStorage(keep_blank_values=1)

2005-02-20 Thread Jonas Meurer
hello,

i'm quite new to python. currently i try to write a web application with
python cgi scripts.

in this application, i need keys to be delivered with the url, some with
and some without value (for example 'script.py?key1&key2=foo'.

i've searched the internet, and already figured out that i need to give
non-empty keep_blank_values as argument to cgi.FieldStorage, to make it
not cut all the empty keywords.

anyway, this still doesn't work really good:

---snip---
form = cgi.FieldStorage(keep_blank_values=1)

print 'list keys with form.keys():'
keys = form.keys()
keys.sort()
for key in keys:
print key
---snip---

if i request the script with script.py?key1&key2=foo, it will output:
list keys with form.keys():
key2

any suggestions about how to make form.keys() contain the blank keys as
well?

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


Re: questions concerning cgi.FieldStorage(keep_blank_values=1)

2005-02-20 Thread Jonas Meurer
On 20/02/2005 Daniel Lichtenberger wrote:
> > any suggestions about how to make form.keys() contain the blank keys
> > as well?
> 
> "key1" isn't a valid parameter, to supply an empty key you would write
> script.py?key1=&key2=foo
> 
> Then cgi.FieldStorage also includes key1.

great, it works. but is there no way to use single keywords as GET
argument?

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


display VARCHAR(mysql) and special chars in html

2005-02-21 Thread Jonas Meurer
hello,

my script selects a comment saved as VARCHAR in MySQL and displays it
inside an html page.

the problem is, that the comment contains several special characters, as
mysterious utf-8 hyphens, german umlauts, etc.

i could write a function to parse the comment and substitute special
chars with the relevant html code, but maybe this already exists in some
module?

if not, it'll be hard work, as i've to consider many special chars, and
at least iso-8859-1* and utf-8 as charmaps.

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


Re: display VARCHAR(mysql) and special chars in html

2005-02-22 Thread Jonas Meurer
On 22/02/2005 Radovan Garabik wrote:
> > i could write a function to parse the comment and substitute special
> > chars with the relevant html code, but maybe this already exists in some
> > module?
> 
> just make the page in utf-8, and you'll save you a lot of troubles

ok, how do i do this? simply add a second line with this:?
# -*- encoding: utf-8 -*-

i use utf8 locales on my machine anyway.

> > if not, it'll be hard work, as i've to consider many special chars, and
> > at least iso-8859-1* and utf-8 as charmaps.
> 
> if you insist...
> a = u'\u010c'
> a.encode('ascii', 'xmlcharrefreplace')

this fails as the comment contained several chars that couldn't be
converted.

i've changed my plans, and now will transform the comments to html
before saving them in mysql. this way, the comment never contains
special chars except they weren't filtered out when safed in mysql.

do any filters exist, to transform plain text to html? otherwise i might
use third-party products, as text2html.

what do you think?

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


update images inside a mysql database

2005-02-24 Thread Jonas Meurer
hello,

i develop a project with a mysql interface. one mysql table holds all
the images for my project.

everything works quite well so far, except i'm not able to upload images
into the database. the following function does the mysql UPDATE, it
requires the image and the image ID as arguments.

additionally it dumps the image to my filesystem ('/tmp/image.gif') -
i test this with gif images.

for some reason, the file dumped to /tmp/image.gif is exactly the same
as uploaded, but in mysql the file is corrupted, far to small and not
even viewable.

here is my function:

def i_update(image, imgid):
image = "%s" % (image)
sql_exec = """UPDATE Images SET Image='%s' WHERE ImgID = '%s'
""" % (image, imgid)
o = open("/tmp/file.jpg", "w")
o.write(image)
o.close()
db_connect.cursor.execute(sql_exec)


i've the strong feeling that the substitution makes problems. if the
string 'image' conains ' or " for example, the sql_exec is broken.

what do you suggest?

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


Re: update images inside a mysql database

2005-02-24 Thread Jonas Meurer
On 24/02/2005 Gabriel Cooper wrote:
> I've never tried extensively to use images inside a database (too slow 
> for most of my uses), but I thought I'd drop in to point out that you 
> should, for security reasons, be using place holders on your sql. It 
> might just fix your image problem as well, but I don't know.

i don't know what your example changes with using placeholders, as my
version used placeholders as well. anyway, i changed my code to resemble
your version. i still get the same problem:
(cgitb output)

---SNIP-
 /home/jonas/public_html/inventaria/mods/backend.py in 
i_update(image='\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x01\x00\x00\x00\x00\x00\x00\xff\xdb\x00C\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01...#$\x82\x08f\xe5A\xc6\xe2G\xe4I\xa9\x18\x96.\xa7\x18T\x0e\x08\xe0\x92q\x9c\x9e\xa4s\xd3\xb7j(\xa0\n\xa4\x95\x00\x03\xdd\x87\xafC\
xefE\x14P\x07\xff\xd9', imgid='18')
  259 o.write(image)
  260 o.close()
  261 db_connect.cursor.execute("""UPDATE Images SET Image=%s WHERE
  262 ImgID = %s""" % (image, imgid))
  263
global db_connect = ,
db_connect.cursor = ,
db_connect.cursor.execute = >, image = 
'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x01\x00\x00\x00\x00\x00\x00\xff\xdb\x00C\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01...#$\x82\x08f\xe5A\xc6\xe2G\xe4I\xa9\x18\x96.\xa7\x18T\x0e\x08\xe0\x92q\x9c\x9e\xa4s\xd3\xb7j(\xa0\n\xa4\x95\x00\x03\xdd\x87\xafC\xefE\x14P\x07\xff\xd9',
 imgid = '18'

 /usr/lib/python2.3/site-packages/MySQLdb/cursors.py in 
execute(self=, query='UPDATE Images SET 
Image=\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x01\x00\x00\x00\x00\x00\x00\xff\xdb\x00C...\xe0\x92q\x9c\x9e\xa4s\xd3\xb7j(\xa0\
 n\xa4\x95\x00\x03\xdd\x87\xafC\xefE\x14P\x07\xff\xd9 WHERE\n\t\t\t\tImgID = 
18', args=None)
   93 """
   94 del self.messages[:]
   95 return self._execute(query, args)
   96
   97 def _execute(self, query, args):
self = , self._execute = >, query = 'UPDATE Images SET 
Image=\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x01\x00\x00\x00\x00\x00\x00\xff\xdb\x00C...\xe0\x92q\
 
x9c\x9e\xa4s\xd3\xb7j(\xa0\n\xa4\x95\x00\x03\xdd\x87\xafC\xefE\x14P\x07\xff\xd9 
WHERE\n\t\t\t\tImgID = 18', args = None

[...]

 /usr/lib/python2.3/site-packages/MySQLdb/connections.py in 
defaulterrorhandler(connection=<_mysql.connection open to 'localhost' at 
691500>, cursor=, errorclass=, 
errorvalue=<_mysql_exceptions.OperationalError instance>)
   31 else:
   32 connection.messages.append(error)
   33 raise errorclass, errorvalue
   34
   35
errorclass = , errorvalue = 
<_mysql_exceptions.OperationalError instance>

 OperationalError: (1054, "Unknown column 
'\xff\xd8\xff\xe0' in 'field list'")
 args = (1054, "Unknown column 
'\xff\xd8\xff\xe0' in 'field list'")
---SNIP-
the problem is obviously, that the 'string' Image contains characters
that make it end ealier than expected.

> converting a binary image into a string doesn't seem like it would be 
> wise, but like I said, I've never tried it. At any rate, your function 
> would look like this:

i've been told on #python that unix doesn't differ between binary and
ascii, thus storing binary data should be no problem.

i've no glue about how to solve this problem. even if i use quotation
marks of any kind for the mysql values, what sometimes circumvents the
problem above, at best some some 1000 byte big blob is stored in the
mysql database, what is neither an image nor has the size of my uploaded
image.

any suggestions?

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


Re: update images inside a mysql database

2005-02-25 Thread Jonas Meurer
On 25/02/2005 Dennis Lee Bieber wrote:
> On Thu, 24 Feb 2005 23:10:48 +0100, Jonas Meurer <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
> 
> 
> > version used placeholders as well. anyway, i changed my code to resemble
> 
>   "resemble" is the key... It is NOT the correct sample.
> 
> >   261 db_connect.cursor.execute("""UPDATE Images SET Image=%s WHERE
> >   262 ImgID = %s""" % (image, imgid))
>  262 ImgID = %s""" , (image, imgid))
> 
>   The .execute method ITSELF performs the argument conversion into
> the place holders, including applying what ever quoting is required.
> YOUR version is using the Python formatting operator, which does NOT
> handle database quoting.

oh, your correct.

sorry for the noise.

now it works quite good.

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


Re: debian python2.4

2004-12-02 Thread Jonas Galvez
km wrote:
> is there a debian binary of python2.4 ?

Not yet, I guess, but I could easily compile it from the source (I'm
no Linux expert, I simply followed the instructions: ./configure,
make, make install, and voilà). No error messages, no nothing. Only
downside is that /usr/bin/python still points to 2.3.4. Haven't
figured out how to change that, but I am also afraid it would break
mod_python so I decided to keep it unchanged for now.


--
http://jonasgalvez.com
http://codeazur.com.br
--
http://mail.python.org/mailman/listinfo/python-list


HTTP response code

2004-12-03 Thread Jonas Galvez
Hi list, here's a question about urllib. Is it possible to simply 
retrieve the HTTP responde code for a given URL? I don't want to 
download the body of the HTTP message. I simply want to check the 
response code, like, if it is 200, 301 etc. Something like:

if urllib.urlopen(the_url).response_code == 200:
# ...

Is there an easy way to do this?
Should I be using urllib2 instead?


--
http://jonasgalvez.com
http://codeazur.com.br
-- 
http://mail.python.org/mailman/listinfo/python-list


Line based graphic in canvas (vectorgraphic?) scale incorrectly on HDMI monitor.

2013-12-21 Thread jonas . thornvall
Is there a way to make linebased graphic used in canvas scale correct on any 
monitor?

I run in 1920*1080 on a Philips TV used as monitor does it matter, lines tend 
to get longer vertical then horizontal?

Strange is i really do not see it writing out recangles.







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


Re: Line based graphic in canvas (vectorgraphic?) scale incorrectly on HDMI monitor.

2013-12-21 Thread jonas . thornvall
Den lördagen den 21:e december 2013 kl. 20:03:17 UTC+1 skrev Ned Batchelder:
> On 12/21/13 1:30 PM, [email protected] wrote:
> 
> > Is there a way to make linebased graphic used in canvas scale correct on 
> > any monitor?
> 
> >
> 
> > I run in 1920*1080 on a Philips TV used as monitor does it matter, lines 
> > tend to get longer vertical then horizontal?
> 
> >
> 
> > Strange is i really do not see it writing out recangles.
> 
> 
> 
> I'm not sure how we can help without seeing any code.  There's no 
> 
> information here that we can use to make a concrete suggestion.
> 
> 
> 
> -- 
> 
> Ned Batchelder, http://nedbatchelder.com
A vertical and horisontal line of same length will be plottet out like this.
There is really no code to show yet, i just write out some lines and noted that 
writing out a verital line of length 400 is longer then a horisontal line of 
same length e.g.

line(100,100,500,100); is shorter
line(300,100,300,500); is longer

__
|
|
|
|
|
|
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Line based graphic in canvas (vectorgraphic?) scale incorrectly on HDMI monitor.

2013-12-21 Thread jonas . thornvall
Den lördagen den 21:e december 2013 kl. 20:56:54 UTC+1 skrev Ned Batchelder:
> On 12/21/13 2:12 PM, [email protected] wrote:
> 
> > Den l�rdagen den 21:e december 2013 kl. 20:03:17 UTC+1 skrev Ned 
> > Batchelder:
> 
> >> On 12/21/13 1:30 PM, [email protected] wrote:
> 
> >>
> 
> >>> Is there a way to make linebased graphic used in canvas scale correct on 
> >>> any monitor?
> 
> >>
> 
> >>>
> 
> >>
> 
> >>> I run in 1920*1080 on a Philips TV used as monitor does it matter, lines 
> >>> tend to get longer vertical then horizontal?
> 
> >>
> 
> >>>
> 
> >>
> 
> >>> Strange is i really do not see it writing out recangles.
> 
> >>
> 
> >>
> 
> >>
> 
> >> I'm not sure how we can help without seeing any code.  There's no
> 
> >>
> 
> >> information here that we can use to make a concrete suggestion.
> 
> >>
> 
> >>
> 
> >>
> 
> >> --
> 
> >>
> 
> >> Ned Batchelder, http://nedbatchelder.com
> 
> > A vertical and horisontal line of same length will be plottet out like this.
> 
> > There is really no code to show yet, i just write out some lines and noted 
> > that writing out a verital line of length 400 is longer then a horisontal 
> > line of same length e.g.
> 
> >
> 
> > line(100,100,500,100); is shorter
> 
> > line(300,100,300,500); is longer
> 
> >
> 
> > __
> 
> >  |
> 
> >  |
> 
> >  |
> 
> >  |
> 
> >  |
> 
> >  |
> 
> >
> 
> 
> 
> Sounds like you don't have square pixels.  Either use a monitor which 
> 
> does, or adjust your coordinates to take the shape of the pixel into 
> 
> account, or try different resolution settings to see if one of them does 
> 
> have square pixels.  Also, the settings on the monitor matter also, you 
> 
> may be able to adjust them to correct the shape of the pixel.
> 
> 
> 
> -- 
> 
> Ned Batchelder, http://nedbatchelder.com

It is weird because it seem to be compensated writing out rectangles, but not 
for linegraphics.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Brython (Python in the browser)

2013-12-27 Thread jonas . thornvall
Den fredagen den 27:e december 2013 kl. 07:14:35 UTC+1 skrev Pierre Quentel:
> Hi,
> 
> 
> 
> Ever wanted to use Python instead of Javascript for web client programming ? 
> Take a look at Brython, an implementation of Python 3 in the browser, with an 
> interface with DOM elements and events
> 
> 
> 
> Its use is very simple :
> 
> - load the Javascript library brython.js : 

Keen eyes

2016-01-16 Thread jonas . thornvall
This is not python just a short snippet of javascript that refuse tracing, i've 
staired blind upon it but since it does something weird with allocating memory 
i have no idea what is going on and the parrots and monkeys at 
comp.lang.javascript refuse to give a hint.

Something in those loops really wrong but it is no giant numbers.



function factor_it(i){
prime=true;
sqroot=Math.floor(Math.sqrt(i));
for (j=2;j

Re: Keen eyes

2016-01-16 Thread jonas . thornvall
Den lördag 16 januari 2016 kl. 23:30:48 UTC+1 skrev Chris Angelico:
> On Sun, Jan 17, 2016 at 9:23 AM,   wrote:
> > function factor_it(i){
> > prime=true;
> > sqroot=Math.floor(Math.sqrt(i));
> > for (j=2;j > {return prime}}
> > return prime;
> > }
> 
> A couple of potential problems here. The first thing that comes to
> mind is that floating point inaccuracy is going to bite you long
> before the numbers "seem huge" to someone who's thinking about 2**53.
> The second is an off-by-one error: a perfect square may come up as
> prime.
> 
> Check for those and see how it looks.
> 
> Also, check your double-use of the 'prime' variable, which also
> appears to be global here.
> 
> ChrisA

Thank you Chris, this is not really for factoring it is meant to create a 
composite sieve. Well all the legs just holding composites will be false.

Regarding the problem no number bigger than 100 is sent to the function, there 
is something weird with either the loop structure or the break.

What should happen...
j=1
i=j

1+10 break (because prime in leg)
j++; well j is 2 and so is i

2+10,2+20,2+30,2+40.2+50,2+60,2+70,2+80,2+90 ((condidion break loop i>100
j++ ->i=3
3+10 break (because prime in leg)
j++

And so on...
And as you can see the outer loop does this until j reaches ***base which is 
10***.
In all it is about 50 operations
So how can it allocate all memory?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Keen eyes

2016-01-16 Thread jonas . thornvall
Den lördag 16 januari 2016 kl. 23:30:48 UTC+1 skrev Chris Angelico:
> On Sun, Jan 17, 2016 at 9:23 AM,   wrote:
> > function factor_it(i){
> > prime=true;
> > sqroot=Math.floor(Math.sqrt(i));
> > for (j=2;j > {return prime}}
> > return prime;
> > }
> 
> A couple of potential problems here. The first thing that comes to
> mind is that floating point inaccuracy is going to bite you long
> before the numbers "seem huge" to someone who's thinking about 2**53.
> The second is an off-by-one error: a perfect square may come up as
> prime.
> 
> Check for those and see how it looks.
> 
> Also, check your double-use of the 'prime' variable, which also
> appears to be global here.
> 
> ChrisA

Thank you Chris your comment resolved it double use of j in two different 
functions and loops.
-- 
https://mail.python.org/mailman/listinfo/python-list


Primality sieve challenge

2016-01-17 Thread jonas . thornvall
Maybe we could have a challenge finding the base with best reducion factor upto 
base 100 00? One probably do not want to store more vectors than that in 
memory, and i guess

Reducing composites in the integer field
http://jt.node365.se/composite.html


I've made my own kind of primality sieve that work by reducing lthe number 
field into composite "legs" and prime "egs". The legs that contain just 
composites in the numberfield will be thrown away sieved?

I asked the people at sci.math if there was a known upper limit for the 
reduction using this type of counters in the integer field, they said no.

I wonder if there is a name for this type of sieve/counter within information 
theory?

My idea is to find a base with very high percentage of composite legs, remove 
all start numbers that produce only composites in their legs, and then store 
the other egs that contain prime in an array.

That array will than serve the purpose modelling the new integer field, using 
the searched base with highest composite reduction.


The script seaching the bases take a few seconds, so there could be alot of 
improvements. I have a feeling that using bignumb bases as sieves will be out 
of range for us mere mortals, but who knows maybe for computer theorists.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Primality sieve challenge

2016-01-17 Thread jonas . thornvall
Den söndag 17 januari 2016 kl. 10:44:47 UTC+1 skrev [email protected]:
> Maybe we could have a challenge finding the base with best reducion factor 
> upto base 100 00? One probably do not want to store more vectors than 
> that in memory, and i guess
> 
> Reducing composites in the integer field
> http://jt.node365.se/composite.html
> 
> 
> I've made my own kind of primality sieve that work by reducing lthe number 
> field into composite "legs" and prime "egs". The legs that contain just 
> composites in the numberfield will be thrown away sieved?
> 
> I asked the people at sci.math if there was a known upper limit for the 
> reduction using this type of counters in the integer field, they said no.
> 
> I wonder if there is a name for this type of sieve/counter within information 
> theory?
> 
> My idea is to find a base with very high percentage of composite legs, remove 
> all start numbers that produce only composites in their legs, and then store 
> the other egs that contain prime in an array.
> 
> That array will than serve the purpose modelling the new integer field, using 
> the searched base with highest composite reduction.
> 
> 
> The script seaching the bases take a few seconds, so there could be alot of 
> improvements. I have a feeling that using bignumb bases as sieves will be out 
> of range for us mere mortals, but who knows maybe for computer theorists.

At least i am impressed how well it reduce the composite integer field but of 
course you need a big array...

The math guys said just construct the base using the primes 2*3*5*7*11*13*17... 
and so on.

NEWBASE = 510510 --
BASE= 510510 Composite legs= 92.91551585669234% ===
One could say it is a bit clumsy but i think it is neat be able to peel of 
numbers that do not even need to be considered for primality test.
-- 
https://mail.python.org/mailman/listinfo/python-list


General computer language, syntax question.

2016-02-29 Thread jonas . thornvall
I have a problem programming uniform networks, "x nodes with y links" that turn 
out to be really hairy to solve for me and i feel i really lack the programming 
features 

"Actually i program in javascript" but the problem seem general for all 
programming languages including Pyhton.

For a beautiful solution it would require "If in list/array return boolean" "If 
not in list/array return boolean". 

But there is no such feature Python nor Javascript, so instead i set boolean 
value "inlist" to false and loop thru, to see if it is already in list. If not 
it is added to list. 

So if the current node i generate links for is x and i try to generate a link 
to  node z, and z's links exhausted i will add it to exhausted list.

And if there is node-x exhausted entries in list, well then script should break 
because it will lock into a cycle. The cyclic lockup is due to only a subset of 
the networks on the form (links*deep)+1=nodes is possible.

So what i need is to know howto write "if list/array ***empty*** do {something}"

I sure know howto check if an array have 1 element 2,3,4 but how do you check 
for empty.

I think it is crazy that you can not do general comparissons of the type 
If in list/array
If not in list/array

But it is even more crazy that you can not check if list/array is empty, that 
is just madness.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: General computer language, syntax question.

2016-02-29 Thread jonas . thornvall
Den måndag 29 februari 2016 kl. 14:45:37 UTC+1 skrev [email protected]:
> I have a problem programming uniform networks, "x nodes with y links" that 
> turn out to be really hairy to solve for me and i feel i really lack the 
> programming features 
> 
> "Actually i program in javascript" but the problem seem general for all 
> programming languages including Pyhton.
> 
> For a beautiful solution it would require "If in list/array return boolean" 
> "If not in list/array return boolean". 
> 
> But there is no such feature Python nor Javascript, so instead i set boolean 
> value "inlist" to false and loop thru, to see if it is already in list. If 
> not it is added to list. 
> 
> So if the current node i generate links for is x and i try to generate a link 
> to  node z, and z's links exhausted i will add it to exhausted list.
> 
> And if there is node-x exhausted entries in list, well then script should 
> break because it will lock into a cycle. The cyclic lockup is due to only a 
> subset of the networks on the form (links*deep)+1=nodes is possible.
> 
> So what i need is to know howto write "if list/array ***empty*** do 
> {something}"
> 
> I sure know howto check if an array have 1 element 2,3,4 but how do you check 
> for empty.
> 
> I think it is crazy that you can not do general comparissons of the type 
> If in list/array
> If not in list/array
> 
> But it is even more crazy that you can not check if list/array is empty, that 
> is just madness.

I mean for for example Javascript
if (typeof array[index] !== 'undefined' && array[index] !== null) {
or this one
if (array[index] != null) {

I mean how do they come up with such convoluted syntax, do they pull it out of 
ass? Well one can always say it is needed because undefined not equal to null.

But would not if (array[index]==empty) suffice and be alot clearer?



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


Re: General computer language, syntax question.

2016-02-29 Thread jonas . thornvall
Den måndag 29 februari 2016 kl. 14:57:04 UTC+1 skrev [email protected]:
> Den måndag 29 februari 2016 kl. 14:45:37 UTC+1 skrev [email protected]:
> > I have a problem programming uniform networks, "x nodes with y links" that 
> > turn out to be really hairy to solve for me and i feel i really lack the 
> > programming features 
> > 
> > "Actually i program in javascript" but the problem seem general for all 
> > programming languages including Pyhton.
> > 
> > For a beautiful solution it would require "If in list/array return boolean" 
> > "If not in list/array return boolean". 
> > 
> > But there is no such feature Python nor Javascript, so instead i set 
> > boolean value "inlist" to false and loop thru, to see if it is already in 
> > list. If not it is added to list. 
> > 
> > So if the current node i generate links for is x and i try to generate a 
> > link to  node z, and z's links exhausted i will add it to exhausted list.
> > 
> > And if there is node-x exhausted entries in list, well then script should 
> > break because it will lock into a cycle. The cyclic lockup is due to only a 
> > subset of the networks on the form (links*deep)+1=nodes is possible.
> > 
> > So what i need is to know howto write "if list/array ***empty*** do 
> > {something}"
> > 
> > I sure know howto check if an array have 1 element 2,3,4 but how do you 
> > check for empty.
> > 
> > I think it is crazy that you can not do general comparissons of the type 
> > If in list/array
> > If not in list/array
> > 
> > But it is even more crazy that you can not check if list/array is empty, 
> > that is just madness.
> 
> I mean for for example Javascript
> if (typeof array[index] !== 'undefined' && array[index] !== null) {
> or this one
> if (array[index] != null) {
> 
> I mean how do they come up with such convoluted syntax, do they pull it out 
> of ass? Well one can always say it is needed because undefined not equal to 
> null.
> 
> But would not if (array[index]==empty) suffice and be alot clearer?

Sorry but would not if (array==empty) suffice and be alot clearer?
-- 
https://mail.python.org/mailman/listinfo/python-list


Loop awareness

2016-02-29 Thread jonas . thornvall
This program creates a uniform linktree of x nodes, and it knows when it get 
stuck in a loop generating random values.

Because the networks random generated, only a subset of the permutations will 
generate a uniform network most get stuck in loops generating random values. 
But the program keep track the exhausted links and knows when no uniform 
network possible.

Is this related to the halting problem?

http://jt.node365.se/mydebug1.html
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Loop awareness

2016-02-29 Thread jonas . thornvall
Den måndag 29 februari 2016 kl. 21:32:51 UTC+1 skrev Ian:
> On Mon, Feb 29, 2016 at 1:07 PM,   wrote:
> > This program creates a uniform linktree of x nodes, and it knows when it 
> > get stuck in a loop generating random values.
> >
> > Because the networks random generated, only a subset of the permutations 
> > will generate a uniform network most get stuck in loops generating random 
> > values. But the program keep track the exhausted links and knows when no 
> > uniform network possible.
> >
> > Is this related to the halting problem?
> >
> > http://jt.node365.se/mydebug1.html
> 
> No, the halting problem is that you can't algorithmically determine
> whether an *arbitrary* program given *arbitrary* input will ever halt.
> When you narrow down the scope of the problem considerably, as you've
> done here, then it's no longer necessarily undecidable.

Here i told it to only report the unfiorm subset of working networks.



http://jt.node365.se/mydebug2.html
-- 
https://mail.python.org/mailman/listinfo/python-list


Condition fullfilled to early but only "sometimes"

2016-02-29 Thread jonas . thornvall
I've been looking at the code for two days so i am a bit crosseyed.
If anyone could help me set the condition so the loop catch the last 
pair/pairs, it is kind of weird that it succeed sometimes and break to early 
and report fail others.

I would be very greatful if anyone can see why it break to early and return 
fail. Although it is clearly a succes looking at the last remaining pair none 
connected pair.It should report fail for the network permutations that stall 
due to link exhausting, but not stall creating last pair.

It just a minor bug due to some condition that i just not get.
Have a go 5 munutes maybe someone catch the faulthy condition.

http://jt.node365.se/mydebug1.html
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Condition fullfilled to early but only "sometimes"

2016-03-01 Thread jonas . thornvall
Den tisdag 1 mars 2016 kl. 08:49:57 UTC+1 skrev Ian:
> It's not at all clear what the problem is from your description. What
> is it that you expect the code to do? What is it doing instead that
> violates your expectation? Why are you asking for Javascript help on a
> Python mailing list?
> 
> On Mon, Feb 29, 2016 at 10:40 PM,   wrote:
> > I've been looking at the code for two days so i am a bit crosseyed.
> > If anyone could help me set the condition so the loop catch the last 
> > pair/pairs, it is kind of weird that it succeed sometimes and break to 
> > early and report fail others.
> >
> > I would be very greatful if anyone can see why it break to early and return 
> > fail. Although it is clearly a succes looking at the last remaining pair 
> > none connected pair.It should report fail for the network permutations that 
> > stall due to link exhausting, but not stall creating last pair.
> >
> > It just a minor bug due to some condition that i just not get.
> > Have a go 5 munutes maybe someone catch the faulthy condition.
> >
> > http://jt.node365.se/mydebug1.html
> > --
> > https://mail.python.org/mailman/listinfo/python-list

The program creates search for uniform networks, that is x nodes each with y 
links. Only a subset of permutations possible "easiest found out with pen and 
paper". So to the left is the node and to the right the nodes it links to.

When you run new network, sometimes it is full every node have x links, you 
create a uniform network. But often ir reports fail the links was exhausted and 
you stuck into a loop, that i fortunatily have the conditions to break.

But it *sometimes* break to early when there is still one or two pairs that 
would had worked. Not it is easy to make a fix for those, but it certainly 
would be more beautiful setting the correct condition.

function createLinks()
{
   var i = 0;
   var j = 0;

   while(i < nodes)
   {
// This see so that links already generated accounted for if one link than j
  j = arr[i].nodelinks.length;
  stupid = nodes - 1;
  temparr = new Array();
  while(j < links)
  {
 dublett = false;
 // Onlygenerate random values bigger than "i" else all links  exhausted
 if(i == 0)
 {
aLink = Math.floor(Math.random() * (nodes - 1));
aLink ++ ;
 }
 else
 {
aLink = Math.floor(Math.random() * (stupid - i)) + i + 1;
 }
 if (aLink == nodes)aLink -- ;

 if (temparr[0] == null)
 {
temparr[0] = aLink;
 }
 for(k = 0; k < arr[i].nodelinks.length; k ++ )
 {
if(aLink == arr[i].nodelinks[k])
{
   dublett = true;
}
 }
 inmylist = false;
 var t = 0;
 for(var m = 0; m < temparr.length; m ++ )
 {
if(temparr[m] == aLink)
{
   inmylist = true;
}
 }
 if (inmylist == false)
 {
temparr[temparr.length] = aLink;
 
 }
 else
 {
inmylist = false
 }
 scope = (nodes - 1) - i;
 if (temparr.length >= scope)
 {
myboolean = false;
return myboolean;
 }

 if(dublett == false && arr[aLink].nroflinks < links)
 {
arr[i].nodelinks[arr[i].nodelinks.length] = aLink;
arr[aLink].nodelinks[arr[aLink].nodelinks.length] = i;
arr[i].nroflinks ++ ;
arr[aLink].nroflinks ++ ;
j ++ ;
 }
  }
  i ++ ;
   }
   myboolean = true;
   return myboolean;
}
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Condition fullfilled to early but only "sometimes"

2016-03-01 Thread jonas . thornvall
Den tisdag 1 mars 2016 kl. 08:49:57 UTC+1 skrev Ian:
> It's not at all clear what the problem is from your description. What
> is it that you expect the code to do? What is it doing instead that
> violates your expectation? Why are you asking for Javascript help on a
> Python mailing list?
> 
> On Mon, Feb 29, 2016 at 10:40 PM,   wrote:
> > I've been looking at the code for two days so i am a bit crosseyed.
> > If anyone could help me set the condition so the loop catch the last 
> > pair/pairs, it is kind of weird that it succeed sometimes and break to 
> > early and report fail others.
> >
> > I would be very greatful if anyone can see why it break to early and return 
> > fail. Although it is clearly a succes looking at the last remaining pair 
> > none connected pair.It should report fail for the network permutations that 
> > stall due to link exhausting, but not stall creating last pair.
> >
> > It just a minor bug due to some condition that i just not get.
> > Have a go 5 munutes maybe someone catch the faulthy condition.
> >
> > http://jt.node365.se/mydebug1.html
> > --
> > https://mail.python.org/mailman/listinfo/python-list

Here is example output and as you can see there is no reason to not create the 
last pair, the link is not a copy it should be created but condition somehow 
wrong *sometimes*.

Hurray failed generate network ***not quite if single pair two nodes missing 
0'st NODE Links-> 7,3,5
1'st NODE Links-> 4,6,3
2'st NODE Links-> 5,9,3
3'st NODE Links-> 0,1,2
4'st NODE Links-> 1,8,5
5'st NODE Links-> 0,2,4
6'st NODE Links-> 1,7,9
7'st NODE Links-> 0,6,8
8'st NODE Links-> 4,7
9'st NODE Links-> 2,6
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Condition fullfilled to early but only "sometimes"

2016-03-01 Thread jonas . thornvall
Den tisdag 1 mars 2016 kl. 08:49:57 UTC+1 skrev Ian:
> It's not at all clear what the problem is from your description. What
> is it that you expect the code to do? What is it doing instead that
> violates your expectation? Why are you asking for Javascript help on a
> Python mailing list?
> 
> On Mon, Feb 29, 2016 at 10:40 PM,   wrote:
> > I've been looking at the code for two days so i am a bit crosseyed.
> > If anyone could help me set the condition so the loop catch the last 
> > pair/pairs, it is kind of weird that it succeed sometimes and break to 
> > early and report fail others.
> >
> > I would be very greatful if anyone can see why it break to early and return 
> > fail. Although it is clearly a succes looking at the last remaining pair 
> > none connected pair.It should report fail for the network permutations that 
> > stall due to link exhausting, but not stall creating last pair.
> >
> > It just a minor bug due to some condition that i just not get.
> > Have a go 5 munutes maybe someone catch the faulthy condition.
> >
> > http://jt.node365.se/mydebug1.html
> > --
> > https://mail.python.org/mailman/listinfo/python-list

Here is a script to draw networks, drag and drop nodes. So the function will go 
here, right now only node deep one work.

http://jt.node365.se/nodes11.html
-- 
https://mail.python.org/mailman/listinfo/python-list


Compact connected regular graphs

2016-03-06 Thread jonas . thornvall
How come all graphs using 42 links and more then 84 nodes have compact  regular 
connected solutions?

Did turn off animation for more than a couple of thousands of  links so the 
animation is off when searching but script give message and numerical results 
on search.

http://jt.node365.se/nodes15.html

Do anyone know?


http://jt.node365.se/Compact.rtf
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compact connected regular graphs

2016-03-06 Thread jonas . thornvall
Den söndag 6 mars 2016 kl. 12:01:02 UTC+1 skrev Mark Lawrence:
> On 06/03/2016 10:39, [email protected] wrote:
> > How come all graphs using 42 links and more then 84 nodes have compact  
> > regular connected solutions?
> >
> > Did turn off animation for more than a couple of thousands of  links so the 
> > animation is off when searching but script give message and numerical 
> > results on search.
> >
> > http://jt.node365.se/nodes15.html
> >
> > Do anyone know?
> >
> >
> > http://jt.node365.se/Compact.rtf
> >
> 
> Where is the Python question here?
> 
> -- 
> My fellow Pythonistas, ask not what our language can do for you, ask
> what you can do for our language.
> 
> Mark Lawrence

It is the Python that squeeze the information out of the graphs.
-- 
https://mail.python.org/mailman/listinfo/python-list


The preferred way to implement a new transport in asyncio

2014-12-07 Thread Jonas Wielicki
Hello fellow pythoneers,

First some background: I am implementing an XMPP client library in
asyncio. XMPP uses (START-)TLS. However, the native SSL support of
Python is rather restricted: We cannot hook into the certificate
validation process (it is PKI-all-or-nothing) at all, in addition many
of the goodies arrive with Python 3.4 only, while asyncio is available
in 3.3 already (with tulip). STARTTLS is also not quite supported with
asyncio (for which I found a hack, but it is about as unpleasant as
number (3) below).


So I wondered how feasible a PyOpenSSL based transport would be. From
looking into the asyncio selector_events.py code, it should be
managealbe to implement a client-side PyOpenSSL based transport
(possibly with STARTTLS support).

The main question I have is how to interweave this transport with
asyncio itself. Is there a preferred process? My approach would have
been to provide a coroutine to the user which takes a loop and the
arguments neccessary to create a transport (socket/(hostname, port), ssl
context, protocol factory, …) and returns the newly created transport.

I’m not entirely sure yet how to create the socket though. I have three
(all more or less unpleasant) options in mind:

1. Instead of making a simple transport, I make a Protocol/Transport
   hybrid one would layer on top of the TCP transport provided by
   asyncio. This is unpleasant because OpenSSL wants direct access to
   the socket and I expect trouble with that (have not dug into that
   yet though).

2. Create a Transport using the original create_connection and
   hard-unwire it from the loop using remove_reader/writer and hostily
   take over the socket object. This is unpleasant because it depends
   on things which I would consider internal details.

3. Duplicate the whole code from the original create_connection
   implementation, minus the unneeded parts. This is unpleasant because
   of code duplication.

(3) seems like the safest approach to me, as it does not rely on any
internalities of asyncio, but it is also the most cumbersome. Ideally,
there would be a public version of create_connection which returns the
socket instead of creating a transport from it. (If there is general
agreement on this, we could take this discussion to python-ideas. )

So, does anyone have input on that?

best regards,
jwi
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: list comparison vs integer comparison, which is more efficient?

2015-01-05 Thread Jonas Wielicki
On 04.01.2015 13:17, austin aigbe wrote
> Hi Terry,
> 
> No difference between the int and list comparison in terms of the number of 
> calls(24) and time (0.004s). Main part is the repeated call to sqrt().
> 
> However, it took a shorter time (0.004s) with 24 function calls than your 
> code (0.005s) which took just 13 function calls to execute.

How often did you run your measurement? 4ms is not a whole lot and can
easily be skewed by sudden system load or other noise. You should call
the function more often and/or repeat the measurement several times
before coming to a judgement (except, possibly, that it doesn’t matter).

cheers,
jwi
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: need some guidance on Python syntax smart editor for use with speech recognition

2015-01-05 Thread Jonas Wielicki
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Dear Eric,

On 05.01.2015 08:43, Eric S. Johansson wrote:
> what's a good open editor ( preferably multiplatform) that
> actually decomposes Python code into fundamental components such as
> class, expression, etc. and, lets you operate on those components?
> this is in contrast to editors such as Emacs which give you some
> fundamental pieces you can operate on but it's really character
> oriented and all of the syntax smartness not really available for
> coupling to speech recognition environment. it would be great if it
> was in Python so I don't have to learn yet another fricking
> language.

As a first iteration, I would try with any editor written in Python.
Are you familiar with the ast[1] module? It could be worth trying to
use this module and perform some kind of pattern matching on the
results to recover the information.

In case you don’t know, the module produces a tree of objects
representing the syntactic representation of the Python code. The
example you gave should be easily recoverable from the AST
representation, assuming togglename has run through (appearantly, the
code is not valid python without the togglename transformation).

I would start small in that case. At some point, one would probably
need a XML Stylesheet-ish transformation language (not neccessarily in
XML; the main point is that you may need complex matching rules). For
the beginning, hardcoded rules might suffice, and for the cases where
it doesn’t work, you could persue Chris’ approach of falling back to
spelled-out code.

Basically, you could formalize your template language to operate on
ASTs and write a pattern matcher recognizing ASTs which have been
generated from a given template.

Hope this helps. I find that topic pretty interesting. Is there
anything I can follow to see progress on this?

regards,
jwi

   [1]: https://docs.python.org/3/library/ast.html
-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iQIcBAEBCgAGBQJUqlq8AAoJEMBiAyWXYliKrJQP/A/w8DBbgzXVPdqkwvE+/LRJ
WVuB2+QiAbj8XU84m0w1HPJ5KWMJfmHp/mSCLy/ZoP46LrE+lpuJvNMjbeiijZ1x
jERfJ2Jvi2ylGtPPh4HSaLKeVqSIoSipj0aZSyqqVmLQ6vce15B4TuviXvHgE7pi
SXDUtNdiE8K4VFM1ltvFqwDBgCF579Fk900LD4g4SNxNFVK4jlbeLgP+bCwPFZ4q
5Nf3PcEal20C5a8LqIkXbxdip68nGJV3nqQUZGmbDWboeBNN7ZdF5/1q1/Hv6f52
+AQbvtKOzO8NOse/ViR4X+TCUIfejdnl5HPRhCz7kWo/E+UyisC1UQhelawr2rJZ
ldvIjyZ58a4Uh7O1FoK3Kl6WOXoC8Dsf0F0VKSC5UtqsQwvWKhE+cm0kyLC2+dBt
0LkhSguSJHgAIl8cXtdPpP90Db1ggSkqUmLnL8XkHarwLrEwELQDri2NGL56jJiC
hhumbHVAZXiH/erW/DencIVQsYMmjMhiLI6ioaktT7TxTvSOgu54JLTepzANSJ3t
tuOgNyCRXpmhPLCho4qZT11agbcfDRVwOXjblhG6lc3eJxHmx13Evw7I4Zf0G80j
ddQtOBbGgVmIg99/8dwT6eNLwTTc+793vOV0JgEk9n41U9oU9PbYrdKOcoLgrtyN
bMAvdd71Zmys0Cq+DYZB
=V4tl
-END PGP SIGNATURE-
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python implementation of a new integer encoding algorithm.

2015-02-19 Thread Jonas Wielicki
Dear Jan-Hein,

I read through the discussion, but until you said it directly, I did not
realize that you wanted feedback on your *python* code.

In that case, let me note a few things which make it unlikely that you
will get (usable) feedback:

1. The code on your website is not formatted and highlighted properly.
This makes it hard to read. Of course, people can copy-paste it into
their favourite highlighter, but that poses a hurdle some (including me)
do not want to take, because of ...

2. ... we don’t exactly know how the algorithm is supposed to work.
Unfortunately (and I’m quite sure that this is not due to the fact that
you’re not native english, because I was able to follow your mails
without issues), your description of the algorithm on your blog is full
of typos and incomplete or ambiguous grammar. It could also use some
mathematical typesetting to make it more readable.


I propose that you reformat both your description of the algorithm and
your implementation to get a better review on it. In fact, I am quite
curious about it (having implemented a MIDI-ish format I stole from
Matroska without knowing, for my pet binary storage format, where I need
small (less than 8 bit) at a number of occasions), but currently I don’t
have the time to dig through it if it doesn’t read fluently (there are
exams over here). I assume that many other people also have much other
stuff to do.


Another idea to make it more attractive for people to review your code
(if you are not after a functional review) would be to go to, e.g.,
. I am not quite sure whether it
would be "on-topic" there -- it would probably require a concise
description of the algorithm so that people can make their own
mind-model about how the algorithm is *supposed* to work and how your
code works, to compare and see potential for optimization, code wise.

best regards,
jwi

p.s.:

On your website:
> The natural character size is 2 bits, and that will eventually become
> the standard.

What is it with that statement? That bugged me when I visited the page
for the first time. Just marketing-wise, I believe you should not
confront people with a controversial statement, taking it for granted,
on the first glance. It would be better to state that this is your
implementation of Algorithm A (link to concise description included) and
you would like to get feedback on your implementation or whatever.



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Accessible tools

2015-02-19 Thread Jonas Wielicki
Dear Bryan,

I don’t have a finished solution for you, but I would like to link you
to a previous thread on this list:


The poster seems to be researching into the direction of developing a
speech-friendly IDE. You may want to follow his work.

regards,
jwi




signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Question on asyncio

2015-02-23 Thread Jonas Wielicki
On 23.02.2015 14:27, Marko Rauhamaa wrote:
> [email protected]:
>> The corresponding call is a call to the python smbus library. It
>> includes several sleeps (even though they are only about 50ms).
>> Therefore I think it is worthwhile to encapsulate it into a coroutine.
> 
> Maybe. Then you'll probably have to rewrite smbus to work asyncio style.
> Those sleeps would then be done as "yield from" statements.
> 

The manual has a word on this [1]. So I would suggest to use
run_in_executor() instead of trashing and rewriting the whole smbus library.

regards,
jwi

   [1]:
https://docs.python.org/3/library/asyncio-dev.html#handle-blocking-functions-correctly
   [2]:
https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.BaseEventLoop.run_in_executor



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bug in timsort!?

2015-02-25 Thread Jonas Wielicki
On 25.02.2015 14:58, Sturla Molden wrote:
> On 24/02/15 22:34, Roy Smith wrote:
>> http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm-is-broken-and-how-to-fix-it/
>>
>>
> […]
>
> Oh yes, and they mention that TimSort is used on billions of devices due
> to Android mobile phones. This is clearly very relevant for mobile
> phones. Next thing you know your litte Samsung Galaxy with more than
> 4096 terabytes breaks down from a stack overflow in TimSort.

The Java version of the bug is reproducible with just 67108864 elements,
if I read the article correctly.

jwi



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bug in timsort!?

2015-02-25 Thread Jonas Wielicki
On 25.02.2015 19:41, Sturla Molden wrote:
> On 25/02/15 18:22, Mario Figueiredo wrote:
> 
>> And also presented a solution.
> 
> Which also was incorrect :-D
> 
> But now Benjamin Peterson has finally fixed it, it appears:
> 
> http://bugs.python.org/issue23515

It would be too great if anyone replying to a discussion read the mails
before posting ...

https://mail.python.org/pipermail/python-list/2015-February/699420.html

I support that view, the changes do not change behaviour and merely
cosmetic, if I understand that statement correctly

regards,
jwi



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


First day beginner to python, add to counter after nested loop

2013-10-29 Thread jonas . thornvall
I have a 25 row javascript that i try to convert to python to get into the 
language but i run into problem i do not understand howto reach outer loop 
after finnish inner loop, in fact i do not understand when finished. The 
javascript i try to conver is below. 

#!/usr/bin/python
import math
# Function definition is here
def sq(number):
   
   square=1;
   factor=2;
   exponent=2;
   print(x,"= ");
   while (number>3):
 while (square<=number):
   factor+=1;
   square=math.pow(factor,exponent);
   now i want to add conter when loop finished, no end like basic
   ??? factor--;
   ??? print(factor," ");
   ??? square=math.pow(factor,exponent);
   ??? number=number-(factor*factor);
   ??? square=1; 
   ??? factor=1;
   ---here does second loop finish
return

print("Exp=x^2");
for x in range (22,23):
  sq(x);



Here is the javascript with loop i try to convert.


TEST

function sq(number){  
   square=1;
   factor=2;
   exponent=2;
   document.write(x,"= ");
   while (number>3){
   
   while (square<=number)
 {  factor++;
square=Math.pow(factor,exponent);

   }
   factor--;
   document.write(factor," ");
   square=Math.pow(factor,exponent);
   number=number-(factor*factor);
   square=1; 
   factor=1;
  } 
  document.write("+",number,"
"); } document.write("Exp=x^2
"); for (x=1;x<100;x++){ sq(x); } -- https://mail.python.org/mailman/listinfo/python-list

Re: First day beginner to python, add to counter after nested loop

2013-10-29 Thread jonas . thornvall
Den tisdagen den 29:e oktober 2013 kl. 19:09:03 UTC+1 skrev Neil Cerutti:
> On 2013-10-29, [email protected]  wrote:
> 
> > I have a 25 row javascript that i try to convert to python to get into the 
> > language but i run into problem i do not understand howto reach outer loop 
> > after finnish inner loop, in fact i do not understand when finished. The 
> > javascript i try to conver is below. 
> 
> >
> 
> > #!/usr/bin/python
> 
> > import math
> 
> > # Function definition is here
> 
> > def sq(number):
> 
> >
> 
> >square=1;
> 
> >factor=2;
> 
> >exponent=2;
> 
> >print(x,"= ");
> 
> >while (number>3):
> 
> >  while (square<=number):
> 
> >factor+=1;
> 
> >square=math.pow(factor,exponent);
> 
> >now i want to add conter when loop finished, no end like basic
> 
> >??? factor--;  
> 
> >??? print(factor," ");
> 
> >??? square=math.pow(factor,exponent);
> 
> >??? number=number-(factor*factor);
> 
> >??? square=1; 
> 
> >??? factor=1;
> 
> >---here does second loop finish
> 
> > return
> 
> >
> 
> > print("Exp=x^2");
> 
> > for x in range (22,23):
> 
> >   sq(x);
> 
> >
> 
> >
> 
> >
> 
> > Here is the javascript with loop i try to convert.
> 
> 
> 
> Output:
> 
> 7 = 2 + 3 
> 
> number  square  factor  exponent
> 
> 7   1   2   2
> 
> 9   3
> 
> 3   1   1
> 
> 
> 
> >
> 
> >
> 
> >TEST
> 
> >
> 
> > function sq(number){  
> 
> >square=1;
> 
> >factor=2;
> 
> >exponent=2;
> 
> >document.write(x,"= ");
> 
> >while (number>3) {
> 
> >  while (square<=number) {
> 
> >factor++;
> 
> >square=Math.pow(factor,exponent);
> 
> >  }
> 
> >  factor--;  
> 
> >  document.write(factor," ");
> 
> >  square=Math.pow(factor,exponent);
> 
> >  number=number-(factor*factor);
> 
> >  square=1; 
> 
> >  factor=1;
> 
> >   }   
> 
> >   document.write("+",number,"
"); > > > } > > > document.write("Exp=x^2
"); > > > for (x=1;x<100;x++){ > > > sq(x); > > > } > > > > > > > > > > > > > > > > What on does function sq do? Squank? Squarp? Squijel? > > > > For number 7, I'm thinking I get output: > > > > 7 = 2 + 3 > > > > -- > > Neil Cerutti It write out numbers on modular? square form, just copy past the HTML embedded javascript into text, save as HTML run i brower and you see. Decimal base 1234=1000+200+30+4 i bad at terminiology but let us call modular base 10 form. The script convert to modular square form number and write out. 1234= 35 3 +0 35^2 + 3^3 = 1225 + 9 =1234 It is very basic -- https://mail.python.org/mailman/listinfo/python-list

Re: First day beginner to python, add to counter after nested loop

2013-10-29 Thread jonas . thornvall
Den tisdagen den 29:e oktober 2013 kl. 19:23:28 UTC+1 skrev 
[email protected]:
> Den tisdagen den 29:e oktober 2013 kl. 19:09:03 UTC+1 skrev Neil Cerutti:
> 
> > On 2013-10-29, [email protected]  wrote:
> 
> > 
> 
> > > I have a 25 row javascript that i try to convert to python to get into 
> > > the language but i run into problem i do not understand howto reach outer 
> > > loop after finnish inner loop, in fact i do not understand when finished. 
> > > The javascript i try to conver is below. 
> 
> > 
> 
> > >
> 
> > 
> 
> > > #!/usr/bin/python
> 
> > 
> 
> > > import math
> 
> > 
> 
> > > # Function definition is here
> 
> > 
> 
> > > def sq(number):
> 
> > 
> 
> > >
> 
> > 
> 
> > >square=1;
> 
> > 
> 
> > >factor=2;
> 
> > 
> 
> > >exponent=2;
> 
> > 
> 
> > >print(x,"= ");
> 
> > 
> 
> > >while (number>3):
> 
> > 
> 
> > >  while (square<=number):
> 
> > 
> 
> > >factor+=1;
> 
> > 
> 
> > >square=math.pow(factor,exponent);
> 
> > 
> 
> > >now i want to add conter when loop finished, no end like basic
> 
> > 
> 
> > >??? factor--;  
> 
> > 
> 
> > >??? print(factor," ");
> 
> > 
> 
> > >??? square=math.pow(factor,exponent);
> 
> > 
> 
> > >??? number=number-(factor*factor);
> 
> > 
> 
> > >??? square=1; 
> 
> > 
> 
> > >??? factor=1;
> 
> > 
> 
> > >---here does second loop finish
> 
> > 
> 
> > > return
> 
> > 
> 
> > >
> 
> > 
> 
> > > print("Exp=x^2");
> 
> > 
> 
> > > for x in range (22,23):
> 
> > 
> 
> > >   sq(x);
> 
> > 
> 
> > >
> 
> > 
> 
> > >
> 
> > 
> 
> > >
> 
> > 
> 
> > > Here is the javascript with loop i try to convert.
> 
> > 
> 
> > 
> 
> > 
> 
> > Output:
> 
> > 
> 
> > 7 = 2 + 3 
> 
> > 
> 
> > number  square  factor  exponent
> 
> > 
> 
> > 7   1   2   2
> 
> > 
> 
> > 9   3
> 
> > 
> 
> > 3   1   1
> 
> > 
> 
> > 
> 
> > 
> 
> > >
> 
> > 
> 
> > >
> 
> > 
> 
> > >TEST
> 
> > 
> 
> > >
> 
> > 
> 
> > > function sq(number){  
> 
> > 
> 
> > >square=1;
> 
> > 
> 
> > >factor=2;
> 
> > 
> 
> > >exponent=2;
> 
> > 
> 
> > >document.write(x,"= ");
> 
> > 
> 
> > >while (number>3) {
> 
> > 
> 
> > >  while (square<=number) {
> 
> > 
> 
> > >factor++;
> 
> > 
> 
> > >square=Math.pow(factor,exponent);
> 
> > 
> 
> > >  }
> 
> > 
> 
> > >  factor--;  
> 
> > 
> 
> > >  document.write(factor," ");
> 
> > 
> 
> > >  square=Math.pow(factor,exponent);
> 
> > 
> 
> > >  number=number-(factor*factor);
> 
> > 
> 
> > >  square=1; 
> 
> > 
> 
> > >  factor=1;
> 
> > 
> 
> > >   }   
> 
> > 
> 
> > >   document.write("+",number,"
"); > > > > > > > } > > > > > > > document.write("Exp=x^2
"); > > > > > > > for (x=1;x<100;x++){ > > > > > > > sq(x); > > > > > > > } > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > What on does function sq do? Squank? Squarp? Squijel? > > > > > > > > > > > > For number 7, I'm thinking I get output: > > > > > > > > > > > > 7 = 2 + 3 > > > > > > > > > > > > -- > > > > > > Neil Cerutti > > > > It write out numbers on modular? square form, just copy past the HTML > embedded javascript into text, save as HTML run i brower and you see. > > > > Decimal base > > 1234=1000+200+30+4 i bad at terminiology but let us call modular base 10 form. > > > > The script convert to modular square form number and write out. > > 1234= 35 3 +0 > > 35^2 + 3^3 = 1225 + 9 =1234 > > > > It is very basic And it work for any exponential form square, cubic etc. I want to implement in python since javascript lack bignumb, and diskread write function. Exp=x^2 77= 88191 353 26 3 +2 Exp=x^3 77= 1981 153 33 10 4 3 3 +4 Exp=x^4 77= 296 100 33 12 9 5 4 3 3 2 2 2 +12 Exp=x^5 77= 95 33 15 9 6 5 5 3 3 2 2 +9 Exp=x^6 77= 44 28 18 13 9 7 6 5 5 4 3 3 3 3 2 2 2 2 2 2 2 2 +64 Exp=x^7 77= 25 20 16 14 11 7 5 4 3 3 3 2 2 2 2 2 2 2 2 2 2 +128 Exp=x^8 77= 17 12 11 10 9 7 7 6 5 5 5 4 4 4 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 +33 Exp=x^9 77= 12 11 8 7 7 7 5 5 4 4 4 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 +510 Exp=x^10 77= 9 9 7 7 6 6 6 5 5 5 5 5 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 +502 Exp=x^11 Here is code for doing it for any exponent. TEST function sq(number,exponent){ exp=1; factor=2; multip=Math.pow(2,exponent); document.write(x,"= "); while (number>multip){ while (exp<=number) { factor++; exp=Math.pow(factor,exponent); } factor--; document.write(factor," "); exp=Math.pow(factor,exponent); number=number-Math.pow(factor,exponent); exp=1; factor=1; } document.write("+",number,"
");

Re: First day beginner to python, add to counter after nested loop

2013-10-29 Thread jonas . thornvall
Den tisdagen den 29:e oktober 2013 kl. 20:24:57 UTC+1 skrev Dave Angel:
> On 29/10/2013 14:35, [email protected] wrote:
> 
> 
> 
> (Deleting hundreds of quad-spaced garbage.  Please be more considerate
> 
> of others if you choose to use buggy googlegroups, maybe starting by
> 
> studying:
> 
> 
> 
> )
> 
> 
> 
> Please indent by 4 columns, not 1.  Since indentation is how scope is
> 
> specified in Python, it's very important to get it right.
> 
> 
> 
> > i do not understand howto reach outer loop after finnish inner loop, in 
> > fact i do not understand when finished.
> 
> 
> 
> The inner loop is finished whenever you stop indenting by 8 columns.  If
> 
> you have a fundamental problem like this, keep it simple till you
> 
> understand it:
> 
> 
> 
> 
> 
> q = 12
> 
> for x in range(10):
> 
> for y in range(3):
> 
> q = 3*q + 1
> 
> print("inner", q)
> 
> print("outer", x*q)
> 
> 
> 
> print("done")
> 
> 
> 
> Because of the detenting, the print("outer", x*q) is in the outer loop.
> 
> 
> 
> 
> 
> -- 
> 
> DaveA


Why did Python not implement end... The end is really not necessary for the 
programming language it can be excluded, but it is a courtesy to the programmer 
and could easily be transformed to indents automaticly, that is removed before 
the compiliation/interpretation of code.  

Got the script working though :D, good start. It seem though that Python 
automaticly add linebreaks after printout. Is there a way to not have print 
command change line? Or must i build up a string/strings for later printout?

#!/usr/bin/python
import math
# Function definition is here
def sq(number):
   
  square=1;
  factor=2;
  exponent=2;
  print(x,"= ");
  while (number>3):
 while (square<=number):
factor+=1;
square=math.pow(factor,exponent);
 factor-=1; 
 print(factor,"^2");
 square=math.pow(factor,exponent);
 number=number-(factor*factor);
 square=1; 
 factor=1;
  print("+",number);
  return

print("Exp=x^2");
for x in range (21,22):
  sq(x);
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: First day beginner to python, add to counter after nested loop

2013-10-29 Thread jonas . thornvall
Den tisdagen den 29:e oktober 2013 kl. 21:08:39 UTC+1 skrev 
[email protected]:
> Den tisdagen den 29:e oktober 2013 kl. 20:24:57 UTC+1 skrev Dave Angel:
> 
> > On 29/10/2013 14:35, [email protected] wrote:
> 
> > 
> 
> > 
> 
> > 
> 
> > (Deleting hundreds of quad-spaced garbage.  Please be more considerate
> 
> > 
> 
> > of others if you choose to use buggy googlegroups, maybe starting by
> 
> > 
> 
> > studying:
> 
> > 
> 
> > 
> 
> > 
> 
> > )
> 
> > 
> 
> > 
> 
> > 
> 
> > Please indent by 4 columns, not 1.  Since indentation is how scope is
> 
> > 
> 
> > specified in Python, it's very important to get it right.
> 
> > 
> 
> > 
> 
> > 
> 
> > > i do not understand howto reach outer loop after finnish inner loop, in 
> > > fact i do not understand when finished.
> 
> > 
> 
> > 
> 
> > 
> 
> > The inner loop is finished whenever you stop indenting by 8 columns.  If
> 
> > 
> 
> > you have a fundamental problem like this, keep it simple till you
> 
> > 
> 
> > understand it:
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > q = 12
> 
> > 
> 
> > for x in range(10):
> 
> > 
> 
> > for y in range(3):
> 
> > 
> 
> > q = 3*q + 1
> 
> > 
> 
> > print("inner", q)
> 
> > 
> 
> > print("outer", x*q)
> 
> > 
> 
> > 
> 
> > 
> 
> > print("done")
> 
> > 
> 
> > 
> 
> > 
> 
> > Because of the detenting, the print("outer", x*q) is in the outer loop.
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > -- 
> 
> > 
> 
> > DaveA
> 
> 
> 
> 
> 
> Why did Python not implement end... The end is really not necessary for the 
> programming language it can be excluded, but it is a courtesy to the 
> programmer and could easily be transformed to indents automaticly, that is 
> removed before the compiliation/interpretation of code.  
> 
> 
> 
> Got the script working though :D, good start. It seem though that Python 
> automaticly add linebreaks after printout. Is there a way to not have print 
> command change line? Or must i build up a string/strings for later printout?
> 
> 
> 
> #!/usr/bin/python
> 
> import math
> 
> # Function definition is here
> 
> def sq(number):
> 
>
> 
>   square=1;
> 
>   factor=2;
> 
>   exponent=2;
> 
>   print(x,"= ");
> 
>   while (number>3):
> 
>  while (square<=number):
> 
> factor+=1;
> 
> square=math.pow(factor,exponent);
> 
>  factor-=1;   
> 
>  print(factor,"^2");
> 
>  square=math.pow(factor,exponent);
> 
>  number=number-(factor*factor);
> 
>  square=1; 
> 
>  factor=1;
> 
>   print("+",number);
> 
>   return
> 
> 
> 
> print("Exp=x^2");
> 
> for x in range (21,22):
> 
>   sq(x);

They could had used print and prinln from basic? I do not want new line 
everytime i write out some terms. And i do not like it add extra space after 
each print of variable print(factor,"^2") writes out 12 ^2 and i do not think 
there is any space after the factor?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread jonas . thornvall
Den onsdagen den 30:e oktober 2013 kl. 08:07:31 UTC+1 skrev Tim Roberts:
> [email protected] wrote:
> 
> >
> 
> >Why did Python not implement end... The end is really not necessary for
> 
> >the programming language it can be excluded, but it is a courtesy to
> 
> >the programmer and could easily be transformed to indents automaticly,
> 
> >that is removed before the compiliation/interpretation of code.  
> 
> 
> 
> You only say that because your brain has been poisoned by languages that
> 
> require some kind of "end".  It's not necessary, and it's extra typing. 99%
> 
> of programmers do the indentation anyway, to make the program easy to read,
> 
> so why not just make it part of the syntax?  That way, you don't
> 
> accidentally have the indentation not match the syntax.
> 
> -- 
> 
> Tim Roberts, [email protected]
> 
> Providenza & Boekelheide, Inc.

It maybe common practice in program languages, but to me it is slightly 
confusing to have the while/for loop on the same indent level, as the regular 
statements.
Because when the while loop ends there is no other identification then that the 
indent stopped, and to me it is easy to interpret that terms that actually 
straight under the loop belongs to it.

But of course it is a matter of adjust the way i look at the code.
Thanks for help guys.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread jonas . thornvall
Den onsdagen den 30:e oktober 2013 kl. 09:52:16 UTC+1 skrev 
[email protected]:
> Den onsdagen den 30:e oktober 2013 kl. 08:07:31 UTC+1 skrev Tim Roberts:
> 
> > [email protected] wrote:
> 
> > 
> 
> > >
> 
> > 
> 
> > >Why did Python not implement end... The end is really not necessary for
> 
> > 
> 
> > >the programming language it can be excluded, but it is a courtesy to
> 
> > 
> 
> > >the programmer and could easily be transformed to indents automaticly,
> 
> > 
> 
> > >that is removed before the compiliation/interpretation of code.  
> 
> > 
> 
> > 
> 
> > 
> 
> > You only say that because your brain has been poisoned by languages that
> 
> > 
> 
> > require some kind of "end".  It's not necessary, and it's extra typing. 99%
> 
> > 
> 
> > of programmers do the indentation anyway, to make the program easy to read,
> 
> > 
> 
> > so why not just make it part of the syntax?  That way, you don't
> 
> > 
> 
> > accidentally have the indentation not match the syntax.
> 
> > 
> 
> > -- 
> 
> > 
> 
> > Tim Roberts, [email protected]
> 
> > 
> 
> > Providenza & Boekelheide, Inc.
> 
> 
> 
> It maybe common practice in program languages, but to me it is slightly 
> confusing to have the while/for loop on the same indent level, as the regular 
> statements.
> 
> Because when the while loop ends there is no other identification then that 
> the indent stopped, and to me it is easy to interpret that terms that 
> actually straight under the loop belongs to it.
> 
> 
> 
> But of course it is a matter of adjust the way i look at the code.
> 
> Thanks for help guys.

To show you guys that i am not totally uneducable i actually followed your 
sugestions ;D. 
(Is there any support similar javascript canvas for drawing, and HTML for 
interactivity, textbox, buttons in python?). 

I have been programming some PHP long time ago, basicly only remember you had 
to have a server running to interact via HTML. 

#!/usr/bin/python
import math
# Function definition is here
def sq(number):
   
  square=1
  factor=2
  multip=exponent*exponent
  print(x,"= ", end="")
  while number>=multip:
 while square<=number:
factor+=1
square=factor*factor
 factor-=1  
 print(factor,"^2+",sep="",end="")
 square=factor*factor
 number=number-(factor*factor)
 square=1
 factor=1
  print(number)

#Set exponent here  
exponent=3
print("Exp=x^",exponent,sep="")
#Set range of numbers x
for x in range (1,100):
  sq(x);
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread jonas . thornvall
Den onsdagen den 30:e oktober 2013 kl. 10:48:36 UTC+1 skrev 
[email protected]:
> Den onsdagen den 30:e oktober 2013 kl. 09:52:16 UTC+1 skrev 
> [email protected]:
> 
> > Den onsdagen den 30:e oktober 2013 kl. 08:07:31 UTC+1 skrev Tim Roberts:
> 
> > 
> 
> > > [email protected] wrote:
> 
> > 
> 
> > > 
> 
> > 
> 
> > > >
> 
> > 
> 
> > > 
> 
> > 
> 
> > > >Why did Python not implement end... The end is really not necessary for
> 
> > 
> 
> > > 
> 
> > 
> 
> > > >the programming language it can be excluded, but it is a courtesy to
> 
> > 
> 
> > > 
> 
> > 
> 
> > > >the programmer and could easily be transformed to indents automaticly,
> 
> > 
> 
> > > 
> 
> > 
> 
> > > >that is removed before the compiliation/interpretation of code.  
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > You only say that because your brain has been poisoned by languages that
> 
> > 
> 
> > > 
> 
> > 
> 
> > > require some kind of "end".  It's not necessary, and it's extra typing. 
> > > 99%
> 
> > 
> 
> > > 
> 
> > 
> 
> > > of programmers do the indentation anyway, to make the program easy to 
> > > read,
> 
> > 
> 
> > > 
> 
> > 
> 
> > > so why not just make it part of the syntax?  That way, you don't
> 
> > 
> 
> > > 
> 
> > 
> 
> > > accidentally have the indentation not match the syntax.
> 
> > 
> 
> > > 
> 
> > 
> 
> > > -- 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > Tim Roberts, [email protected]
> 
> > 
> 
> > > 
> 
> > 
> 
> > > Providenza & Boekelheide, Inc.
> 
> > 
> 
> > 
> 
> > 
> 
> > It maybe common practice in program languages, but to me it is slightly 
> > confusing to have the while/for loop on the same indent level, as the 
> > regular statements.
> 
> > 
> 
> > Because when the while loop ends there is no other identification then that 
> > the indent stopped, and to me it is easy to interpret that terms that 
> > actually straight under the loop belongs to it.
> 
> > 
> 
> > 
> 
> > 
> 
> > But of course it is a matter of adjust the way i look at the code.
> 
> > 
> 
> > Thanks for help guys.
> 
> 
> 
> To show you guys that i am not totally uneducable i actually followed your 
> sugestions ;D. 
> 
> (Is there any support similar javascript canvas for drawing, and HTML for 
> interactivity, textbox, buttons in python?). 
> 
> 
> 
> I have been programming some PHP long time ago, basicly only remember you had 
> to have a server running to interact via HTML. 
> 
> 
> 
> #!/usr/bin/python
> 
> import math
> 
> # Function definition is here
> 
> def sq(number):
> 
>
> 
>   square=1
> 
>   factor=2
> 
>   multip=exponent*exponent
> 
>   print(x,"= ", end="")
> 
>   while number>=multip:
> 
>  while square<=number:
> 
> factor+=1
> 
> square=factor*factor
> 
>  factor-=1
> 
>  print(factor,"^2+",sep="",end="")
> 
>  square=factor*factor
> 
>  number=number-(factor*factor)
> 
>  square=1
> 
>  factor=1
> 
>   print(number)
> 
> 
> 
> #Set exponent here  
> 
> exponent=3
> 
> print("Exp=x^",exponent,sep="")
> 
> #Set range of numbers x
> 
> for x in range (1,100):
> 
>   sq(x);

Forgot change the static square that was written out, i am a bit undecuable 
afterall...

#!/usr/bin/python
import math
# Function definition is here
def sq(number):
   
  square=1
  factor=2
  multip=exponent*exponent
  print(x,"= ", end="")
  while number>=multip:
 while square<=number:
factor+=1
square=factor*factor
 factor-=1  
 print(factor,"^",exponent,"+",sep="",end="")
 square=factor*factor
 number=number-(factor*factor)
 square=1
 factor=1
  print(number)

#Set exponent here  
exponent=3
print("Exp=x^",exponent,sep="")
#Set range of numbers x
for x in range (1,100):
  sq(x);
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread jonas . thornvall
Den onsdagen den 30:e oktober 2013 kl. 08:07:31 UTC+1 skrev Tim Roberts:
> [email protected] wrote:
> 
> >
> 
> >Why did Python not implement end... The end is really not necessary for
> 
> >the programming language it can be excluded, but it is a courtesy to
> 
> >the programmer and could easily be transformed to indents automaticly,
> 
> >that is removed before the compiliation/interpretation of code.  
> 
> 
> 
> You only say that because your brain has been poisoned by languages that
> 
> require some kind of "end".  It's not necessary, and it's extra typing. 99%
> 
> of programmers do the indentation anyway, to make the program easy to read,
> 
> so why not just make it part of the syntax?  That way, you don't
> 
> accidentally have the indentation not match the syntax.
> 
> -- 
> 
> Tim Roberts, [email protected]
> 
> Providenza & Boekelheide, Inc.

Well Tim ***one could argue*** why not do a (i think it is called parser) that 
react to "loop", "end" and "function". And lazy like me do not have to think 
about "what is not part of program".

I certainly do not like the old bracket style it was a catastrophe, but in 
honesty the gui editor of python should have what i propose, a parser that 
indent automaticly at loops, functions and end. I promise you it will save 
millions of hours of bug searching all over world in a month.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread jonas . thornvall
Den onsdagen den 30:e oktober 2013 kl. 11:08:11 UTC+1 skrev 
[email protected]:
> Den onsdagen den 30:e oktober 2013 kl. 08:07:31 UTC+1 skrev Tim Roberts:
> 
> > [email protected] wrote:
> 
> > 
> 
> > >
> 
> > 
> 
> > >Why did Python not implement end... The end is really not necessary for
> 
> > 
> 
> > >the programming language it can be excluded, but it is a courtesy to
> 
> > 
> 
> > >the programmer and could easily be transformed to indents automaticly,
> 
> > 
> 
> > >that is removed before the compiliation/interpretation of code.  
> 
> > 
> 
> > 
> 
> > 
> 
> > You only say that because your brain has been poisoned by languages that
> 
> > 
> 
> > require some kind of "end".  It's not necessary, and it's extra typing. 99%
> 
> > 
> 
> > of programmers do the indentation anyway, to make the program easy to read,
> 
> > 
> 
> > so why not just make it part of the syntax?  That way, you don't
> 
> > 
> 
> > accidentally have the indentation not match the syntax.
> 
> > 
> 
> > -- 
> 
> > 
> 
> > Tim Roberts, [email protected]
> 
> > 
> 
> > Providenza & Boekelheide, Inc.
> 
> 
> 
> Well Tim ***one could argue*** why not do a (i think it is called parser) 
> that react to "loop", "end" and "function". And lazy like me do not have to 
> think about "what is not part of program".
> 
> 
> 
> I certainly do not like the old bracket style it was a catastrophe, but in 
> honesty the gui editor of python should have what i propose, a parser that 
> indent automaticly at loops, functions and end. I promise you it will save 
> millions of hours of bug searching all over world in a month.

Instead of having going over indent manually, you just drop in an end it is so 
simple, no marking no meny indent unindent it is automaticly done. And that was 
the purpose of python to remove idiocies, like brackets and indents.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread jonas . thornvall
Den onsdagen den 30:e oktober 2013 kl. 11:00:30 UTC+1 skrev Mark Lawrence:
> On 30/10/2013 09:52, [email protected] wrote:
> 
> 
> 
> Please stop sending us double spaced crap.
> 
> 
> 
> -- 
> 
> Python is the second best programming language in the world.
> 
> But the best has yet to be invented.  Christian Tismer
> 
> 
> 
> Mark Lawrence
I am not sure what you want.
You want me to remove the empty line in function? I do it for it is easier to 
read for me.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread jonas . thornvall
Den onsdagen den 30:e oktober 2013 kl. 11:11:17 UTC+1 skrev 
[email protected]:
> Den onsdagen den 30:e oktober 2013 kl. 11:08:11 UTC+1 skrev 
> [email protected]:
> 
> > Den onsdagen den 30:e oktober 2013 kl. 08:07:31 UTC+1 skrev Tim Roberts:
> 
> > 
> 
> > > [email protected] wrote:
> 
> > 
> 
> > > 
> 
> > 
> 
> > > >
> 
> > 
> 
> > > 
> 
> > 
> 
> > > >Why did Python not implement end... The end is really not necessary for
> 
> > 
> 
> > > 
> 
> > 
> 
> > > >the programming language it can be excluded, but it is a courtesy to
> 
> > 
> 
> > > 
> 
> > 
> 
> > > >the programmer and could easily be transformed to indents automaticly,
> 
> > 
> 
> > > 
> 
> > 
> 
> > > >that is removed before the compiliation/interpretation of code.  
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > You only say that because your brain has been poisoned by languages that
> 
> > 
> 
> > > 
> 
> > 
> 
> > > require some kind of "end".  It's not necessary, and it's extra typing. 
> > > 99%
> 
> > 
> 
> > > 
> 
> > 
> 
> > > of programmers do the indentation anyway, to make the program easy to 
> > > read,
> 
> > 
> 
> > > 
> 
> > 
> 
> > > so why not just make it part of the syntax?  That way, you don't
> 
> > 
> 
> > > 
> 
> > 
> 
> > > accidentally have the indentation not match the syntax.
> 
> > 
> 
> > > 
> 
> > 
> 
> > > -- 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > Tim Roberts, [email protected]
> 
> > 
> 
> > > 
> 
> > 
> 
> > > Providenza & Boekelheide, Inc.
> 
> > 
> 
> > 
> 
> > 
> 
> > Well Tim ***one could argue*** why not do a (i think it is called parser) 
> > that react to "loop", "end" and "function". And lazy like me do not have to 
> > think about "what is not part of program".
> 
> > 
> 
> > 
> 
> > 
> 
> > I certainly do not like the old bracket style it was a catastrophe, but in 
> > honesty the gui editor of python should have what i propose, a parser that 
> > indent automaticly at loops, functions and end. I promise you it will save 
> > millions of hours of bug searching all over world in a month.
> 
> 
> 
> Instead of having going over indent manually, you just drop in an end it is 
> so simple, no marking no meny indent unindent it is automaticly done. And 
> that was the purpose of python to remove idiocies, like brackets and indents.

You could have it in the menu indent parser on off. If on you write out ends, 
and the text is automaticly indented, by using end or a reserved sign. It is 
quite simple i could program it in a day...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread jonas . thornvall
Den onsdagen den 30:e oktober 2013 kl. 11:00:30 UTC+1 skrev Mark Lawrence:
> On 30/10/2013 09:52, [email protected] wrote:
> 
> 
> 
> Please stop sending us double spaced crap.
> 
> 
> 
> -- 
> 
> Python is the second best programming language in the world.
> 
> But the best has yet to be invented.  Christian Tismer
> 
> 
> 
> Mark Lawrence

I think it is not me it is probably google groups, well maybe they should 
consider changing linebreak sign as stored in database.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread jonas . thornvall
Den onsdagen den 30:e oktober 2013 kl. 11:11:17 UTC+1 skrev 
[email protected]:
> Den onsdagen den 30:e oktober 2013 kl. 11:08:11 UTC+1 skrev 
> [email protected]:
> 
> > Den onsdagen den 30:e oktober 2013 kl. 08:07:31 UTC+1 skrev Tim Roberts:
> 
> > 
> 
> > > [email protected] wrote:
> 
> > 
I suddenly realised i mixed code from a plain square system with the generic 
exponential modulus system.

Here is the code, what it does is encode numbers in an exponential modulus 
base. So it is basicly a numbersystem of my own you do not need to write out + 
^ and exponent because the numbersystem create unique values for every natural 
number.

Well without the + ^ it is hard to read but so are binary, ternary and 
hexadecimal. I think the requirment for a numbersystem is that it have a 
working arithmetic, and mine have.

So here is the working code, to write out exponential modulus number for and 
exponent.

#!/usr/bin/python
import math
# Function definition is here
def sq(number):
   
  exp=1
  factor=2
  multip=math.pow(2,exponent)
  print(x,"= ", end="")
  while number>=multip:
 while exp<=number:
factor+=1
exp=math.pow(factor,exponent)
 factor-=1  
 print(factor,"^",exponent,"+",sep="",end="")
 exp=math.pow(factor,exponent)
 number=number-exp
 exp=1
 factor=1
  print(number)

#Set exponent here  
exponent=2
print("Exp=x^",exponent,sep="")
#Set range of numbers x
for x in range (1,100):
  sq(x) 

> 
> > > 
> 
> > 
> 
> > > >
> 
> > 
> 
> > > 
> 
> > 
> 
> > > >Why did Python not implement end... The end is really not necessary for
> 
> > 
> 
> > > 
> 
> > 
> 
> > > >the programming language it can be excluded, but it is a courtesy to
> 
> > 
> 
> > > 
> 
> > 
> 
> > > >the programmer and could easily be transformed to indents automaticly,
> 
> > 
> 
> > > 
> 
> > 
> 
> > > >that is removed before the compiliation/interpretation of code.  
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > You only say that because your brain has been poisoned by languages that
> 
> > 
> 
> > > 
> 
> > 
> 
> > > require some kind of "end".  It's not necessary, and it's extra typing. 
> > > 99%
> 
> > 
> 
> > > 
> 
> > 
> 
> > > of programmers do the indentation anyway, to make the program easy to 
> > > read,
> 
> > 
> 
> > > 
> 
> > 
> 
> > > so why not just make it part of the syntax?  That way, you don't
> 
> > 
> 
> > > 
> 
> > 
> 
> > > accidentally have the indentation not match the syntax.
> 
> > 
> 
> > > 
> 
> > 
> 
> > > -- 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > Tim Roberts, [email protected]
> 
> > 
> 
> > > 
> 
> > 
> 
> > > Providenza & Boekelheide, Inc.
> 
> > 
> 
> > 
> 
> > 
> 
> > Well Tim ***one could argue*** why not do a (i think it is called parser) 
> > that react to "loop", "end" and "function". And lazy like me do not have to 
> > think about "what is not part of program".
> 
> > 
> 
> > 
> 
> > 
> 
> > I certainly do not like the old bracket style it was a catastrophe, but in 
> > honesty the gui editor of python should have what i propose, a parser that 
> > indent automaticly at loops, functions and end. I promise you it will save 
> > millions of hours of bug searching all over world in a month.
> 
> 
> 
> Instead of having going over indent manually, you just drop in an end it is 
> so simple, no marking no meny indent unindent it is automaticly done. And 
> that was the purpose of python to remove idiocies, like brackets and indents.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread jonas . thornvall
Den onsdagen den 30:e oktober 2013 kl. 15:22:50 UTC+1 skrev Alister:
> On Wed, 30 Oct 2013 13:42:37 +0100, Antoon Pardon wrote:
> 
> 
> 
> > Op 30-10-13 13:17, Chris Angelico schreef:
> 
> >> On Wed, Oct 30, 2013 at 11:01 PM, Antoon Pardon
> 
> >>  wrote:
> 
> >> I broadly agree with your post (I'm of the school of thought that
> 
> >> braces are better than indentation for delimiting blocks), but I don't
> 
> >> think this argument holds water. All you need to do is be consistent
> 
> >> about tabs OR spaces (and I'd recommend tabs, since they're simpler and
> 
> >> safer), and you'll never have this trouble.
> 
> > 
> 
> > Easier said than done. First of all I can be as consistent as possible,
> 
> > I can't just take code from someone else and insert it because that
> 
> > other person may be consistenly doing it different from me.
> 
> 
> 
> I disagree it is very easy.
> 
> 
> 
> 1) make sure you editor is set to inset 4 spaces rather than tab when 
> 
> pressing the tab key. consistency in your own code is now not an issue.
> 
> 
> 
> 2) when importing code from someone else a simple search & replace of tab 
> 
> with 4 spaces will instantly correct the formatting on code using tab 
> 
> without breaking code that doesn't.
> 
> 
> 
> 
> 
> > 
> 
> > Then if you are working on different machines, the settings of your
> 
> > editor may not always be the same so that you have tabs on one machine
> 
> > and spaces on an other, which causes problem when you move the code.
> 
> > 
> 
> that is fixed by setting your environment consistantly but step 2 above 
> 
> will fix it if you forget.
> 
> 
> 
> > Also when you have an xterm, selecting a tab and pasting it into another
> 
> > it will turn the tab into spaces.
> 
> 
> 
> Read pep 11 & always use 4 spaces for indentation not tab.
> 
> 
> 
> > 
> 
> > All these things usually can be ignored, they typically only show up
> 
> > when you print something and things aren't aligned as you expect but
> 
> > with python you are forced to correct those things immediately, forcing
> 
> > you to focus on white space layout issues instead of on the logic of the
> 
> > code.
> 
> > 
> 
> >> Also, the parser should tell you if you mix tabs and spaces, so that
> 
> >> won't trip anything either.
> 
> > 
> 
> > Maybe you mean something different than I understand but a program
> 
> > throwing a syntax error because there is a tab instead of a number of
> 
> > spaces or vice versa, is something I would understand as tripping.
> 
> 
> 
> no more than failing to close a brace in a C like language
> 
> indentation is the syntax of python you will grow to love it, like most 
> 
> people I found it distracting at first even though i tended to indent 
> 
> other code (inconsistently)to make it readable.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> 
> I am what you will be; I was what you are.

Alister i do not ask for changing the actual implementation with indents that 
the compiler/interpretator work with. What i ask for is some courtesy relative 
the programmers using IDLE, to incorporate a simple automatic parser that let 
them who like to write slopy formatted with end instead to do so. And the 
parser in editor automaticly go in and autoindent *function, loops, if and 
allow end that the editor autoindent to end of loop. It can not be that hard i 
have implemented my own python using this...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread jonas . thornvall
Den onsdagen den 30:e oktober 2013 kl. 16:09:25 UTC+1 skrev Mark Lawrence:
> On 30/10/2013 14:31, [email protected] wrote:
> 
> 
> 
> Would you please be kind enough to read, digest and action this 
> 
> https://wiki.python.org/moin/GoogleGroupsPython
> 
> 
> 
> TIA.
> 
> 
> 
> -- 
> 
> Python is the second best programming language in the world.
> 
> But the best has yet to be invented.  Christian Tismer
> 
> 
> 
> Mark Lawrence

I am all for automatiation to be honest i rather go in change the code for 
google than do it manual. Maybe those who complain should adress Google? There 
must be a simple solution or?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread jonas . thornvall
Den onsdagen den 30:e oktober 2013 kl. 16:35:29 UTC+1 skrev 
[email protected]:
> Den onsdagen den 30:e oktober 2013 kl. 16:09:25 UTC+1 skrev Mark Lawrence:
> 
> > On 30/10/2013 14:31, [email protected] wrote:
> 
> > 
> 
> > 
> 
> > 
> 
> > Would you please be kind enough to read, digest and action this 
> 
> > 
> 
> > https://wiki.python.org/moin/GoogleGroupsPython
> 
> > 
> 
> > 
> 
> > 
> 
> > TIA.
> 
> > 
> 
> > 
> 
> > 
> 
> > -- 
> 
> > 
> 
> > Python is the second best programming language in the world.
> 
> > 
> 
> > But the best has yet to be invented.  Christian Tismer
> 
> > 
> 
> > 
> 
> > 
> 
> > Mark Lawrence
> 
> 
> 
> I am all for automatiation to be honest i rather go in change the code for 
> google than do it manual. Maybe those who complain should adress Google? 
> There must be a simple solution or?

Another solution would of course be use a newsreader that can do it for you?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread jonas . thornvall
Den onsdagen den 30:e oktober 2013 kl. 16:54:19 UTC+1 skrev Mark Lawrence:
> On 30/10/2013 15:35, [email protected] wrote:
> 
> > Den onsdagen den 30:e oktober 2013 kl. 16:09:25 UTC+1 skrev Mark Lawrence:
> 
> >> On 30/10/2013 14:31, [email protected] wrote:
> 
> >>
> 
> >>
> 
> >>
> 
> >> Would you please be kind enough to read, digest and action this
> 
> >>
> 
> >> https://wiki.python.org/moin/GoogleGroupsPython
> 
> >>
> 
> >>
> 
> >>
> 
> >> TIA.
> 
> >>
> 
> >>
> 
> >>
> 
> >> --
> 
> >>
> 
> >> Python is the second best programming language in the world.
> 
> >>
> 
> >> But the best has yet to be invented.  Christian Tismer
> 
> >>
> 
> >>
> 
> >>
> 
> >> Mark Lawrence
> 
> >
> 
> > I am all for automatiation to be honest i rather go in change the code for 
> > google than do it manual. Maybe those who complain should adress Google? 
> > There must be a simple solution or?
> 
> >
> 
> 
> 
> The simplest solution is that you stop posting, as you've been spewing 
> 
> this double spaced crap all day and show no inclination to do anything 
> 
> about it.  I assume that google won't fix their problem as there's not 
> 
> enough profit in it.
> 
> 
> 
> -- 
> 
> Python is the second best programming language in the world.
> 
> But the best has yet to be invented.  Christian Tismer
> 
> 
> 
> Mark Lawrence

Bug of anal monkey either solve your own problems, or implement your own 
newsreader.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread jonas . thornvall
Den onsdagen den 30:e oktober 2013 kl. 16:50:43 UTC+1 skrev Grant Edwards:
> On 2013-10-30, Antoon Pardon  wrote:
> 
> > Op 30-10-13 08:07, Tim Roberts schreef:
> 
> >> [email protected] wrote:
> 
> >>>
> 
> >>> Why did Python not implement end... The end is really not necessary for
> 
> >>> the programming language it can be excluded, but it is a courtesy to
> 
> >>> the programmer and could easily be transformed to indents automaticly,
> 
> >>> that is removed before the compiliation/interpretation of code.  
> 
> >> 
> 
> >> You only say that because your brain has been poisoned by languages that
> 
> >> require some kind of "end".  It's not necessary, and it's extra typing. 99%
> 
> >> of programmers do the indentation anyway, to make the program easy to read,
> 
> >> so why not just make it part of the syntax?  That way, you don't
> 
> >> accidentally have the indentation not match the syntax.
> 
> >
> 
> > Because it is a pain in the ass. Now suddenly my program doesn't work
> 
> > because I somehow inserted a tab instead of spaces.
> 
> 
> 
> Then don't do that.
> 
> 
> 
> I'm only half-kidding.  Inserting incorrect tokens into program source
> 
> breaks programs in all languages.  The tricky bit is that in many
> 
> editors spaces and tabs look the same.  You can pick an editor that
> 
> provides a visual difference, or you can pick an editor that always
> 
> does the right thing, or you can stick with it until your fingers
> 
> learn to do the right thing.
> 
> 
> 
> > The end would also gives extra protection against faulty
> 
> > manipulations. I have at one time accidently copied a function partly
> 
> > further below. Because python doesn't need an end, the compilor was
> 
> > unable to detect this was only part of a function which caused a bug
> 
> > which was harder to find.
> 
> >
> 
> > Python made it's choice and I can live with that, but telling people
> 
> > who prefer it had made an other choice that their brain is poisoned,
> 
> > only shows you are unable to see the disadvantages.
> 
> 
> 
> Those of us who've been using Python for more than a few days think it
> 
> is you who are unable to see the advantages. ;)
> 
> 
> 
> Whether allowing indentation via either tabs or spaces was a
> 
> fundamental design flaw has long been debated.  Personally, I think
> 
> tabs should be outlawed in all source code...
> 
> 
> 
> -- 
> 
> Grant Edwards   grant.b.edwardsYow! Uh-oh!!  I'm having
> 
>   at   TOO MUCH FUN!!
> 
>   gmail.com

I think the idea with tab indentation would been it is an easy road for 
automation. I think it is easily that project goes anal when let over to code 
monkeys, maybe that is the case.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread jonas . thornvall
Den onsdagen den 30:e oktober 2013 kl. 16:51:58 UTC+1 skrev Alister:
> On Wed, 30 Oct 2013 08:35:29 -0700, jonas.thornvall wrote:
> 
> 
> 
> > Den onsdagen den 30:e oktober 2013 kl. 16:09:25 UTC+1 skrev Mark
> 
> > Lawrence:
> 
> >> On 30/10/2013 14:31, [email protected] wrote:
> 
> >> 
> 
> >> 
> 
> >> 
> 
> >> Would you please be kind enough to read, digest and action this
> 
> >> 
> 
> >> https://wiki.python.org/moin/GoogleGroupsPython
> 
> >> 
> 
> >> 
> 
> >> 
> 
> >> TIA.
> 
> >> 
> 
> >> 
> 
> >> 
> 
> >> --
> 
> >> 
> 
> >> Python is the second best programming language in the world.
> 
> >> 
> 
> >> But the best has yet to be invented.  Christian Tismer
> 
> >> 
> 
> >> 
> 
> >> 
> 
> >> Mark Lawrence
> 
> > 
> 
> > I am all for automatiation to be honest i rather go in change the code
> 
> > for google than do it manual. Maybe those who complain should adress
> 
> > Google? There must be a simple solution or?
> 
> 
> 
> Google are unlikely to change any time soon, if you do not compensate for 
> 
> there bad behaviour many people here will start to ignore your posts.
> 
> 
> 
> I agree it is a pain, & it is not your fault but these are the basic 
> 
> facts.
> 
> 
> 
> 
> 
> 
> 
> -- 
> 
> A rolling stone gathers no moss.
> 
>   -- Publilius Syrus

Well i ain't going to change so i promise unless the spaceout rows fill some 
purpose it is Google who is going to change. 

Google groups work good for me and i certainly have no intention to change 
newsreader, but i agree Google should have done something about this years ago 
*if the empty lines fill no purpose*. And they did a mayor change a couple of 
years ago, it is a mystery they could not fix this if it serve no purpose?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread jonas . thornvall
Den onsdagen den 30:e oktober 2013 kl. 16:54:19 UTC+1 skrev Mark Lawrence:
> On 30/10/2013 15:35, [email protected] wrote:
> 
> > Den onsdagen den 30:e oktober 2013 kl. 16:09:25 UTC+1 skrev Mark Lawrence:
> 
> >> On 30/10/2013 14:31, [email protected] wrote:
> 
> >>
> 
> >>
> 
> >>
> 
> >> Would you please be kind enough to read, digest and action this
> 
> >>
> 
> >> https://wiki.python.org/moin/GoogleGroupsPython
> 
> >>
> 
> >>
> 
> >>
> 
> >> TIA.
> 
> >>
> 
> >>
> 
> >>
> 
> >> --
> 
> >>
> 
> >> Python is the second best programming language in the world.
> 
> >>
> 
> >> But the best has yet to be invented.  Christian Tismer
> 
> >>
> 
> >>
> 
> >>
> 
> >> Mark Lawrence
> 
> >
> 
> > I am all for automatiation to be honest i rather go in change the code for 
> > google than do it manual. Maybe those who complain should adress Google? 
> > There must be a simple solution or?
> 
> >
> 
> 
> 
> The simplest solution is that you stop posting, as you've been spewing 
> 
> this double spaced crap all day and show no inclination to do anything 
> 
> about it.  I assume that google won't fix their problem as there's not 
> 
> enough profit in it.
> 
> 
> 
> -- 
> 
> Python is the second best programming language in the world.
> 
> But the best has yet to be invented.  Christian Tismer
> 
> 
> 
> Mark Lawrence

For what *they* actually have done is replacing the curl paragraph slavery with 
indentation slavery. And looking at the other features of python i easily can 
tell that was not the intention of the creator, it was to remove the anal code 
monkey stuff and replace it with simplicity and automation.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread jonas . thornvall
Den onsdagen den 30:e oktober 2013 kl. 17:22:23 UTC+1 skrev Mark Lawrence:
> On 30/10/2013 15:57, [email protected] wrote:
> 
> > Den onsdagen den 30:e oktober 2013 kl. 16:54:19 UTC+1 skrev Mark Lawrence:
> 
> >> On 30/10/2013 15:35, [email protected] wrote:
> 
> >>
> 
> >>> Den onsdagen den 30:e oktober 2013 kl. 16:09:25 UTC+1 skrev Mark Lawrence:
> 
> >>
> 
>  On 30/10/2013 14:31, [email protected] wrote:
> 
> >>
> 
> 
> 
> >>
> 
> 
> 
> >>
> 
> 
> 
> >>
> 
>  Would you please be kind enough to read, digest and action this
> 
> >>
> 
> 
> 
> >>
> 
>  https://wiki.python.org/moin/GoogleGroupsPython
> 
> >>
> 
> 
> 
> >>
> 
> 
> 
> >>
> 
> 
> 
> >>
> 
>  TIA.
> 
> >>
> 
> 
> 
> >>
> 
> 
> 
> >>
> 
> 
> 
> >>
> 
>  --
> 
> >>
> 
> 
> 
> >>
> 
>  Python is the second best programming language in the world.
> 
> >>
> 
> 
> 
> >>
> 
>  But the best has yet to be invented.  Christian Tismer
> 
> >>
> 
> 
> 
> >>
> 
> 
> 
> >>
> 
> 
> 
> >>
> 
>  Mark Lawrence
> 
> >>
> 
> >>>
> 
> >>
> 
> >>> I am all for automatiation to be honest i rather go in change the code 
> >>> for google than do it manual. Maybe those who complain should adress 
> >>> Google? There must be a simple solution or?
> 
> >>
> 
> >>>
> 
> >>
> 
> >>
> 
> >>
> 
> >> The simplest solution is that you stop posting, as you've been spewing
> 
> >>
> 
> >> this double spaced crap all day and show no inclination to do anything
> 
> >>
> 
> >> about it.  I assume that google won't fix their problem as there's not
> 
> >>
> 
> >> enough profit in it.
> 
> >>
> 
> >>
> 
> >>
> 
> >> --
> 
> >>
> 
> >> Python is the second best programming language in the world.
> 
> >>
> 
> >> But the best has yet to be invented.  Christian Tismer
> 
> >>
> 
> >>
> 
> >>
> 
> >> Mark Lawrence
> 
> >
> 
> > Bug of anal monkey either solve your own problems, or implement your own 
> > newsreader.
> 
> >
> 
> 
> 
> I have no need to implement a newsreader as I can quite happily send and 
> 
> receive data using Thunderbird.  There are several other similar email 
> 
> options available.  An alternative is for you to show others some 
> 
> courtesy and follow the instructions that would show just a few lines up 
> 
> from here, except that your insistence on using bug ridden technology 
> 
> means it's actually light years away.
> 
> 
> 
> -- 
> 
> Python is the second best programming language in the world.
> 
> But the best has yet to be invented.  Christian Tismer
> 
> 
> 
> Mark Lawrence

No that is not my problem, apparently so it is that the newsreader constructors 
do not like the competition of Google groups otherwise they would had written 
the five lines of codes necessary to remove the empty linebreaks.
I like web based features, and i will use them until "they get it right, 
understood?"
End of story
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread jonas . thornvall
Den onsdagen den 30:e oktober 2013 kl. 18:44:20 UTC+1 skrev MRAB:
> On 30/10/2013 16:31, [email protected] wrote:
> 
> > Den onsdagen den 30:e oktober 2013 kl. 17:22:23 UTC+1 skrev Mark Lawrence:
> 
> > No that is not my problem, apparently so it is that the newsreader 
> > constructors do not like the competition of Google groups otherwise they 
> > would had written the five lines of codes necessary to remove the empty 
> > linebreaks.
> 
> > I like web based features, and i will use them until "they get it right, 
> > understood?"
> 
> > End of story
> 
> >
> 
> Google Groups aren't following the standard. Everybody else is. Why
> 
> should everybody else have to add a fix to correct what Google Groups
> 
> keeps getting wrong?

Honestly i do not understand why you direct this question to me.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread jonas . thornvall
Den onsdagen den 30:e oktober 2013 kl. 18:44:20 UTC+1 skrev MRAB:
> On 30/10/2013 16:31, [email protected] wrote:
> 
> > Den onsdagen den 30:e oktober 2013 kl. 17:22:23 UTC+1 skrev Mark Lawrence:
> 
> > No that is not my problem, apparently so it is that the newsreader 
> > constructors do not like the competition of Google groups otherwise they 
> > would had written the five lines of codes necessary to remove the empty 
> > linebreaks.
> 
> > I like web based features, and i will use them until "they get it right, 
> > understood?"
> 
> > End of story
> 
> >
> 
> Google Groups aren't following the standard. Everybody else is. Why
> 
> should everybody else have to add a fix to correct what Google Groups
> 
> keeps getting wrong?

I do see though this have to be something related to their database, nothing 
they do by purpose. So unless the database storing messages change, it probably 
would need an ugly fix like a script.

So probably you should direct your question to either the creators of googles 
database or beg the creators of google groups to do a fix...

I think the later is the way to go although i suspect this has something todo 
with the database storing the messages.
-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   3   >