Just compilation

2014-02-04 Thread Igor Korot
Hi, ALL,
I'm trying to incorporate the path in
http://sourceforge.net/p/mysql-python/bugs/325/.
I already modified the source code and now what I need is to produce
the pyc code.

Running "python --help" I don't see an option to just compile the
source into the bytecode.

So how do I produce the compiled version of the changed source?
What I'm thinking is to compile the file update the archive and reinstall.

Please help.

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


Re: [newbie] copying identical list for a function argument

2014-02-04 Thread Jean Dupont
Op maandag 3 februari 2014 23:19:39 UTC+1 schreef Steven D'Aprano:
> On Mon, 03 Feb 2014 13:36:24 -0800, Jean Dupont wrote:
> > I have a list like this:
> > [1,2,3]
> > 
> > The argument of my function should be a repeated version e.g.
> > [1,2,3],[1,2,3],[1,2,3],[1,2,3] (could be a different number of times
> > repeated also)
> > 
> > what is the prefered method to realize this in Python?
>
> I don't really understand your question. It could mean any of various 
> things, so I'm going to try to guess what you mean. If my guesses are 
> wrong, please ask again, giving more detail, and possibly an example of 
> what you want to do and the result you expect.
> I think you mean that you have some function that needs to take (say) 
> five arguments, and you want to avoid writing:
> result = function([1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 23], [1, 2, 3])
> because it's too easy to make a mistake (as I did, deliberately, above -- 
> can you see it?).
> If my guess is correct, try this:
> mylist = [1, 2, 3]
> result = function(mylist, mylist, mylist, mylist, mylist)
>
> That's perfectly reasonable for two or three arguments, but not so much 
> for five. Instead, here's a trick: first we make five identical 
> references to the same list:
> [mylist]*5  # same as [mylist, mylist, mylist, mylist, mylist]
> then expand them as arguments to the function:
> mylist = [1, 2, 3]
> list_of_lists = [mylist]*5
> result = function(*list_of_lists)
> (The * operator means multiplication when used between two arguments, and 
> inside a function call a leading * also does argument expansion.)
>
> But wait... there's something slightly weird here. Even though there are 
> five distinct references to mylist, they're all the same list! Change 
> one, change all. This may be what you want, or it may be a problem. Hard 
> to tell from your question.
> Think about references as being a little bit like names. A *single* 
> person could be known as "son", "Dad", "Mr Obama", "Barack", "Mr 
> President", "POTUS", and more. In this case, we have a single list, [1, 
> 2, 3], which is known by six references: the name "mylist", and five 
> additional references list_of_lists index 0, list_of_lists index 1, and 
> so on up to list_of_lists index 4.
> We can prove that they all refer to the same list by running a bit of 
> code in the interactive interpreter:
>
> py> mylist = [1, 2, 3]
> py> list_of_lists = [mylist]*5
> py> list_of_lists
> [[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]]
> py> mylist.append(99)
> py> list_of_lists
> [[1, 2, 3, 99], [1, 2, 3, 99], [1, 2, 3, 99], [1, 2, 3, 99], [1, 2, 3, 
> 99]]
>
> So rather than having five references to the same, identical, list, you 
> might want five *copies*. You can copy a list using slicing:
> mylist = [1, 2, 3]
> copy = mylist[:]
> Instead of using list multiplication to repeat five identical lists, we 
> make five copies using a list comprehension:
> list_of_lists = [mylist[:] for i in range(5)]
> then expand it in the function call as before:
> result = function(*list_of_lists)
>
> Hope this helps,
Yes it does, thanks a lot to you and all the others who responded, "the
missing link" which until now I wasn't aware of but which was essential
for the solution was the "*" in
result = function(*list_of_lists)

kind regards,
jean
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [newbie] making rows of table with discrete values for different number systems

2014-02-04 Thread Jean Dupont
Op maandag 3 februari 2014 20:50:04 UTC+1 schreef Asaf Las:
> On Monday, February 3, 2014 9:37:36 PM UTC+2, Jean Dupont wrote:
> > Op maandag 3 februari 2014 16:34:18 UTC+1 schreef Asaf Las:
> > 
> > Of course you don't have to, but I'm curious and learn well by examples
> > :-(
>
> Hi Jean 
>
> Don't get me wrong i did not mean to be rude (was joking) - i 
> think if you will do it yourself that will be very good for 
> you - you can learn a lot from that as i did not very long time ago. 
> My apologies for inconvenience.
no hard feelings, anyway I am programming it myself using normal functions, 
when I have finished it I'll post it, then maybe you can do it with 
lamba-notation, it could be interesting to compare execution times for the two 
approaches

kind regards,
jean

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


Re: Just compilation

2014-02-04 Thread Cameron Simpson
On 04Feb2014 00:58, Igor Korot  wrote:
> I'm trying to incorporate the path in
> http://sourceforge.net/p/mysql-python/bugs/325/.
> I already modified the source code and now what I need is to produce
> the pyc code.
> 
> Running "python --help" I don't see an option to just compile the
> source into the bytecode.
> 
> So how do I produce the compiled version of the changed source?
> What I'm thinking is to compile the file update the archive and reinstall.

You want the py_compile module, parse of the stdlib.

Example:

  python -m py_compile path/to/foo.py

I use this in my personal test suite as a syntax check.

See the python docs for this module for further details.

Cheers,
-- 
Cameron Simpson 

A friend of mine in a compiler writing class produced a compiler with one error
message "you lied to me when you told me this was a program".
- Pete Fenelon 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Postfix conditionals

2014-02-04 Thread BartC

"GöktuğKayaalp"  wrote in message
news:mailman.6377.1391490975.18130.python-l...@python.org...

"BartC"  writes:


"Göktuğ Kayaalp"  wrote in message
news:mailman.4966.1388953508.18130.python-l...@python.org...


AFAIK, we do not have "postfix conditionals" in Python, i.e. a condition
appended to a
statement, which determines whether the statement runs or not:

  py> for i in [False]:
  ... break if not i



What are your thoughts on this?


I develop my own language (not Python, but also dynamic and interpreted).


(First, some apologies; I thought the OP was dated February not January!)


Would love to see that, if possible!


(If you're into Python, then I doubt it because I don't have classes or any
of those other Pythonic things that people like. However my language is a
lot less dynamic and therefore can be much faster. I have a few interesting
variations on statements as well; syntax is cheap and I don't know why many
languages, Python included, have such a paucity of control and selection
statements.

I also have a project that translates my syntax into Python; the intention
there was to be able to make use of some of its libraries because I don't
have many of my own!)


I have this feature, and it's OK, but not indispensible.  I varied it a
bit
by allowing 'if', 'when' and 'unless' as the conditionals, just to break
it
up a little. However, it just maps internally to a regular if-statement.

In Python though, the normal way of writing 'break if not i' is about the
same length (in my language it's somewhat longer), so I can't see it
getting
much support.


I do not really think that string length is not of much significance.
The actual fact that disallows my proposal from being favoured/implemented
is that in Python, `break', `return' and `continue' are statements and the
community encourages having one statement per line, so that the source
code
is easily understandable.  With my proposal implemented, the language
would
would be encouraging having multiple statements in one line, that looks
like a single statement, but is indeed a composition of two.


But, Python already allows you to combine two statements on a line, as in:

if a: s
while b: t

So your:

s if a

is little different (although s will need to be restricted; 'if b if a' will
look a bit odd). And someone mentioned the ternary expression which looks
similar to your proposal.

I suppose you can also argue that the if-part is not a statement at all,
just an expression that is part of the statement (you'd have to redefine
break and other statements to have an optional condition). If written as:

break(not i)

then it certainly won't look like two statements! Your proposal has the 
advantage in that it gives more dominance to the statement, making the code 
somewhat clearer, comparing with burying it inside an if-statement.



I rather dislike the statement-orientedness of Python, but still, it is
a good device of easening for the language developers and beginners when
the fact that we use indentation to denote blocks is considered.


(I used to have a syntax where statements and expressions were
interchangeable. Now I have them distinct, which makes many things much
easier, it picks up more errors (and makes it simpler to translate to
translate into languages which aren't quite as expressive!))

--
Bartc 


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


Finding size of Variable

2014-02-04 Thread Ayushi Dalmia
Hello,

I have 10 files and I need to merge them (using K way merging). The size of 
each file is around 200 MB. Now suppose I am keeping the merged data in a 
variable named mergedData, I had thought of checking the size of mergedData 
using sys.getsizeof() but it somehow doesn't gives the actual value of the 
memory occupied. 

For example, if a file in my file system occupies 4 KB of data, if I read all 
the lines in a list, the size of the list is around 2100 bytes only.

Where am I going wrong? What are the alternatives I can try?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Finding size of Variable

2014-02-04 Thread Peter Otten
Ayushi Dalmia wrote:

> I have 10 files and I need to merge them (using K way merging). The size
> of each file is around 200 MB. Now suppose I am keeping the merged data in
> a variable named mergedData, I had thought of checking the size of
> mergedData using sys.getsizeof() but it somehow doesn't gives the actual
> value of the memory occupied.
> 
> For example, if a file in my file system occupies 4 KB of data, if I read
> all the lines in a list, the size of the list is around 2100 bytes only.
> 
> Where am I going wrong? What are the alternatives I can try?

getsizeof() gives you the size of the list only; to complete the picture you 
have to add the sizes of the lines.

However, why do you want to keep track of the actual memory used by 
variables in your script? You should instead concentrate on the algorithm, 
and as long as either the size of the dataset is manageable or you can limit 
the amount of data accessed at a given time you are golden.

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


Re: fseek In Compressed Files

2014-02-04 Thread Ayushi Dalmia
On Tuesday, February 4, 2014 2:27:38 AM UTC+5:30, Dave Angel wrote:
> Ayushi Dalmia  Wrote in message:
> 
> > On Thursday, January 30, 2014 4:20:26 PM UTC+5:30, Ayushi Dalmia wrote:
> 
> >> Hello,
> 
> >> 
> 
> >> 
> 
> >> 
> 
> >> I need to randomly access a bzip2 or gzip file. How can I set the offset 
> >> for a line and later retreive the line from the file using the offset. 
> >> Pointers in this direction will help.
> 
> > 
> 
> > This is what I have done:
> 
> > 
> 
> > import bz2
> 
> > import sys
> 
> > from random import randint
> 
> > 
> 
> > index={}
> 
> > 
> 
> > data=[]
> 
> > f=open('temp.txt','r')
> 
> > for line in f:
> 
> > data.append(line)
> 
> > 
> 
> > filename='temp1.txt.bz2'
> 
> > with bz2.BZ2File(filename, 'wb', compresslevel=9) as f:
> 
> > f.writelines(data)
> 
> > 
> 
> > prevsize=0
> 
> > list1=[]
> 
> > offset={}
> 
> > with bz2.BZ2File(filename, 'rb') as f:
> 
> > for line in f:
> 
> > words=line.strip().split(' ')
> 
> > list1.append(words[0])
> 
> > offset[words[0]]= prevsize
> 
> > prevsize = sys.getsizeof(line)+prevsize
> 
> 
> 
> sys.getsizeof looks at internal size of a python object, and is
> 
>  totally unrelated to a size on disk of a text line. len () might
> 
>  come closer, unless you're on Windows. You really should be using
> 
>  tell to define the offsets for later seek. In text mode any other
> 
>  calculation is not legal,  ie undefined. 
> 
> 
> 
> > 
> 
> > 
> 
> > data=[]
> 
> > count=0
> 
> > 
> 
> > with bz2.BZ2File(filename, 'rb') as f:
> 
> > while count<20:
> 
> > y=randint(1,25)
> 
> > print y
> 
> > print offset[str(y)]
> 
> > count+=1
> 
> > f.seek(int(offset[str(y)]))
> 
> > x= f.readline()
> 
> > data.append(x)
> 
> > 
> 
> > f=open('b.txt','w')
> 
> > f.write(''.join(data))
> 
> > f.close()
> 
> > 
> 
> > where temp.txt is the posting list file which is first written in a 
> > compressed format and then read  later. 
> 
> 
> 
> I thought you were starting with a compressed file.  If you're
> 
>  being given an uncompressed file, just deal with it directly.
> 
>  
> 
> 
> 
> >I am trying to build the index for the entire wikipedia dump which needs to 
> >be done in a space and time optimised way. The temp.txt is as follows:
> 
> > 
> 
> > 1 456 t0b3c0i0e0:784 t0b2c0i0e0:801 t0b2c0i0e0
> 
> > 2 221 t0b1c0i0e0:774 t0b1c0i0e0:801 t0b2c0i0e0
> 
> > 3 455 t0b7c0i0e0:456 t0b1c0i0e0:459 t0b2c0i0e0:669 t0b10c11i3e0:673 
> > t0b1c0i0e0:678 t0b2c0i1e0:854 t0b1c0i0e0
> 
> > 4 410 t0b4c0i0e0:553 t0b1c0i0e0:609 t0b1c0i0e0
> 
> > 5 90 t0b1c0i0e0
> 
> 
> 
> So every line begins with its line number in ascii form?  If true,
> 
>  the dict above called offsets should just be a list.
> 
>  
> 
> 
> 
> Maybe you should just quote the entire assignment.  You're
> 
>  probably adding way too much complication to it.
> 
> 
> 
> -- 
> 
> DaveA

Hey! I am new here. Sorry about the incorrect posts. Didn't understand the 
protocol then.

Although, I have the uncompressed text, I cannot start right away with them 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Finding size of Variable

2014-02-04 Thread Ayushi Dalmia
On Tuesday, February 4, 2014 5:10:25 PM UTC+5:30, Peter Otten wrote:
> Ayushi Dalmia wrote:
> 
> 
> 
> > I have 10 files and I need to merge them (using K way merging). The size
> 
> > of each file is around 200 MB. Now suppose I am keeping the merged data in
> 
> > a variable named mergedData, I had thought of checking the size of
> 
> > mergedData using sys.getsizeof() but it somehow doesn't gives the actual
> 
> > value of the memory occupied.
> 
> > 
> 
> > For example, if a file in my file system occupies 4 KB of data, if I read
> 
> > all the lines in a list, the size of the list is around 2100 bytes only.
> 
> > 
> 
> > Where am I going wrong? What are the alternatives I can try?
> 
> 
> 
> getsizeof() gives you the size of the list only; to complete the picture you 
> 
> have to add the sizes of the lines.
> 
> 
> 
> However, why do you want to keep track of the actual memory used by 
> 
> variables in your script? You should instead concentrate on the algorithm, 
> 
> and as long as either the size of the dataset is manageable or you can limit 
> 
> the amount of data accessed at a given time you are golden.

As I said, I need to merge large files and I cannot afford more I/O operations. 
So in order to minimise the I/O operation I am writing in chunks. Also, I need 
to use the merged files as indexes later which should be loaded in the memory 
for fast access. Hence the concern.

Can you please elaborate on the point of taking lines into consideration?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Finding size of Variable

2014-02-04 Thread Asaf Las
On Tuesday, February 4, 2014 2:43:21 PM UTC+2, Ayushi Dalmia wrote:
> 
> As I said, I need to merge large files and I cannot afford more I/O 
> operations. So in order to minimise the I/O operation I am writing in 
> chunks. Also, I need to use the merged files as indexes later which 
> should be loaded in the memory for fast access. Hence the concern.
> Can you please elaborate on the point of taking lines into consideration?

have you tried os.sendfile()? 

http://docs.python.org/dev/library/os.html#os.sendfile
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Finding size of Variable

2014-02-04 Thread Dave Angel
 Ayushi Dalmia  Wrote in message:
 
>> getsizeof() gives you the size of the list only; to complete the picture you 
>> 
>> have to add the sizes of the lines.
>> 
>> 
>> 
>> However, why do you want to keep track of the actual memory used by 
>> 
>> variables in your script? You should instead concentrate on the algorithm, 
>> 
>> and as long as either the size of the dataset is manageable or you can limit 
>> 
>> the amount of data accessed at a given time you are golden.
> 
> As I said, I need to merge large files and I cannot afford more I/O 
> operations. So in order to minimise the I/O operation I am writing in chunks. 
> Also, I need to use the merged files as indexes later which should be loaded 
> in the memory for fast access. Hence the concern.
> 
> Can you please elaborate on the point of taking lines into consideration?
> 

Please don't doublespace your quotes.  If you must use
 googlegroups,  fix its bugs before posting. 

There's usually no net gain in trying to 'chunk' your output to a
 text file. The python file system already knows how to do that
 for a sequential file.

For list of strings just add the getsizeof for the list to the sum
 of the getsizeof of all the list items. 

-- 
DaveA

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


Re: Finding size of Variable

2014-02-04 Thread Ayushi Dalmia
On Tuesday, February 4, 2014 6:39:00 PM UTC+5:30, Dave Angel wrote:
> Ayushi Dalmia  Wrote in message:
> 
>  
> 
> >> getsizeof() gives you the size of the list only; to complete the picture 
> >> you 
> 
> >> 
> 
> >> have to add the sizes of the lines.
> 
> >> 
> 
> >> 
> 
> >> 
> 
> >> However, why do you want to keep track of the actual memory used by 
> 
> >> 
> 
> >> variables in your script? You should instead concentrate on the algorithm, 
> 
> >> 
> 
> >> and as long as either the size of the dataset is manageable or you can 
> >> limit 
> 
> >> 
> 
> >> the amount of data accessed at a given time you are golden.
> 
> > 
> 
> > As I said, I need to merge large files and I cannot afford more I/O 
> > operations. So in order to minimise the I/O operation I am writing in 
> > chunks. Also, I need to use the merged files as indexes later which should 
> > be loaded in the memory for fast access. Hence the concern.
> 
> > 
> 
> > Can you please elaborate on the point of taking lines into consideration?
> 
> > 
> 
> 
> 
> Please don't doublespace your quotes.  If you must use
> 
>  googlegroups,  fix its bugs before posting. 
> 
> 
> 
> There's usually no net gain in trying to 'chunk' your output to a
> 
>  text file. The python file system already knows how to do that
> 
>  for a sequential file.
> 
> 
> 
> For list of strings just add the getsizeof for the list to the sum
> 
>  of the getsizeof of all the list items. 
> 
> 
> 
> -- 
> 
> DaveA

Hey! 

I need to chunk out the outputs otherwise it will give Memory Error. I need to 
do some postprocessing on the data read from the file too. If I donot stop 
before memory error, I won't be able to perform any more operations on it.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Finding size of Variable

2014-02-04 Thread Ayushi Dalmia
On Tuesday, February 4, 2014 6:23:19 PM UTC+5:30, Asaf Las wrote:
> On Tuesday, February 4, 2014 2:43:21 PM UTC+2, Ayushi Dalmia wrote:
> 
> > 
> 
> > As I said, I need to merge large files and I cannot afford more I/O 
> 
> > operations. So in order to minimise the I/O operation I am writing in 
> 
> > chunks. Also, I need to use the merged files as indexes later which 
> 
> > should be loaded in the memory for fast access. Hence the concern.
> 
> > Can you please elaborate on the point of taking lines into consideration?
> 
> 
> 
> have you tried os.sendfile()? 
> 
> 
> 
> http://docs.python.org/dev/library/os.html#os.sendfile

os.sendfile will not serve my purpose. I not only need to merge files, but do 
it in a sorted way. Thus some postprocessing is needed. 
-- 
https://mail.python.org/mailman/listinfo/python-list


RapydBox

2014-02-04 Thread Salvatore DI DIO
Hello,

For those of you who are interested by tools like NodeBox or Processing.
you can give a try to RapydScript here :

https://github.com/artyprog/RapydBox

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


Re: Logging data from Arduino using PySerial

2014-02-04 Thread MRAB

On 2014-02-04 04:07, Thomas wrote:

I've written a script to log data from my Arduino to a csv file. The script 
works well enough but it's very, very slow. I'm quite new to Python and I just 
wanted to put this out there to see if any Python experts could help optimise 
my code. Here it is:


[snip]

 # Cleaning the data_log and storing it in data.csv
 with open('data.csv','wb') as csvfile:
 for line in data_log:
 line_data = re.findall('\d*\.\d*',line) # Find all digits
 line_data = filter(None,line_data)# Filter out empty strings
 line_data = [float(x) for x in line_data] # Convert Strings to 
float

 for i in range(1,len(line_data)):
 line_data[i]=map(line_data[i],0,1023,0,5)


You're doing this for every in line the log:


 csvwrite = csv.writer(csvfile)

[snip]

Try moving before the 'for' loop so it's done only once.

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


Re: [OT] Usage of U+00B6 PILCROW SIGN (was: generator slides review and Python doc (+/- text bug))

2014-02-04 Thread Jerry Hill
On Tue, Feb 4, 2014 at 1:51 AM,   wrote:
> I got it. If I'm visiting a page like this:
>
> http://docs.python.org/3/tutorial/index.html#the-python-tutorial
>
> 1) To read the page, I'm scrolling down.
> 2) When I have finished to read the page, I scroll up
> (or scroll back/up) to the top of the page until I see
> this "feature" and the title.
> 3) I click on this "feature".
> 4) The title, already visible, moves, let's say, "2cm" higher.
>
> ...?

Those links aren't for navigation.

They're so you can discover anchor links in the page and pass them to
someone else.  For instance, if I want to point someone to the section
of the tutorial that talks about reading and writing files, I could
just give them this link:
http://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files,
instead of pointing them to the main page and instructing them to
scroll down until they see Section 7.2

I was able to discover that link by opening the page, highlighting the
section header with my mouse, then clicking the pilcrow.  That gives
me the anchor link to that section header.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Advice needed for Python packaging - can't find required library during installation

2014-02-04 Thread thebiggestbangtheory
Thank you very much! :-)

On Monday, February 3, 2014 11:30:00 PM UTC-8, dieter wrote:
> thebiggestbangthe...@gmail.com writes:
> 
> 
> 
> > I am trying to package up a very simple python app. In my setup.py file I 
> > have a couple of lines that include the following:
> 
> >
> 
> > from setuptools import setup
> 
> >
> 
> > setup(
> 
> > name='ban',
> 
> > version='0.1',
> 
> > packages=['ban',],
> 
> > description='Python Distribution Utilities',
> 
> > author='Ban',
> 
> > author_email='b...@tbbt.com',
> 
> > package_data={'ban': ['data/*.dat']},
> 
> > long_description=open('README.txt').read(),
> 
> > install_requires=['Google-Safe-Browsing-v2-Lookup'],
> 
> > )
> 
> > ...
> 
> > Processing dependencies for ban==0.1
> 
> > Searching for Google-Safe-Browsing-v2-Lookup
> 
> > Reading http://pypi.python.org/simple/Google-Safe-Browsing-v2-Lookup/
> 
> > No local packages or download links found for Google-Safe-Browsing-v2-Lookup
> 
> > error: Could not find suitable distribution for 
> > Requirement.parse('Google-Safe-Browsing-v2-Lookup')
> 
> > **
> 
> >
> 
> > Issue #1
> 
> >
> 
> > Apparently the setup script cannot find the package - 
> > Google-Safe-Browsing-v2-Lookup . However, I can install this package via 
> > pip. 
> 
> >
> 
> > What should I specify in the setup.py file instead of 
> > install_requires=['Google-Safe-Browsing-v2-Lookup'] so that the library is 
> > properly installed ?
> 
> 
> 
> I suppose that "setuptools" is confused by the "-" in the package
> 
> names together with these "-" being omitted in the uploaded file
> 
> (https://pypi.python.org/packages/source/G/Google-Safe-Browsing-v2-Lookup/Google%20Safe%20Browsing%20v2%20Lookup-0.1.0.tar.gz5";).
> 
> 
> 
> If this supposition is correct, then you would either need to
> 
> contact the "setuptools" author (to get "setuptools" handle this case)
> 
> or the "Google Safe Browsing" author to get a filename more
> 
> in line with the package name.

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


Re: [OT] Usage of U+00B6 PILCROW SIGN (was: generator slides review and Python doc (+/- text bug))

2014-02-04 Thread wxjmfauth
Le mardi 4 février 2014 15:39:54 UTC+1, Jerry Hill a écrit :
> On Tue, Feb 4, 2014 at 1:51 AM,   wrote:
> 
> > I got it. If I'm visiting a page like this:
> 
> >
> 
> > http://docs.python.org/3/tutorial/index.html#the-python-tutorial
> 
> >
> 
> > 1) To read the page, I'm scrolling down.
> 
> > 2) When I have finished to read the page, I scroll up
> 
> > (or scroll back/up) to the top of the page until I see
> 
> > this "feature" and the title.
> 
> > 3) I click on this "feature".
> 
> > 4) The title, already visible, moves, let's say, "2cm" higher.
> 
> >
> 
> > ...?
> 
> 
> 
> Those links aren't for navigation.
> 
> 
> 
> They're so you can discover anchor links in the page and pass them to
> 
> someone else.  For instance, if I want to point someone to the section
> 
> of the tutorial that talks about reading and writing files, I could
> 
> just give them this link:
> 
> http://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files,
> 
> instead of pointing them to the main page and instructing them to
> 
> scroll down until they see Section 7.2
> 
> 
> 
> I was able to discover that link by opening the page, highlighting the
> 
> section header with my mouse, then clicking the pilcrow.  That gives
> 
> me the anchor link to that section header.

Useless and really ugly.

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


Re: [OT] Usage of U+00B6 PILCROW SIGN

2014-02-04 Thread Michael Torrie
On 02/04/2014 08:21 AM, wxjmfa...@gmail.com wrote:
> 
> Useless and really ugly.

How do you recommend we discover the anchor links for linking to?

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


Re: Calculator Problem

2014-02-04 Thread David Hutto
On Sunday, February 2, 2014 4:16:44 PM UTC-5, Charlie Winn wrote:
> Hey Guys i Need Help , When i run this program i get the 'None' Under the 
> program, see what i mean by just running it , can someone help me fix this
> 
> 
> 
> def Addition():
> 
> print('Addition: What are two your numbers?')
> 
> 1 = float(input('First Number:'))
> 
> 2 = float(input('Second Number:'))
> 
> print('Your Final Result is:', 1 + 2)
> 
> 
> 
> 
> 
> def Subtraction():
> 
> print('Subtraction: What are two your numbers?')
> 
> 3 = float(input('First Number:'))
> 
> 4 = float(input('Second Number:'))
> 
> print('Your Final Result is:', 3 - 4)
> 
> 
> 
> 
> 
> def Multiplication():
> 
> print('Multiplication: What are two your numbers?')
> 
> 5 = float(input('First Number:'))
> 
> 6 = float(input('Second Number:'))
> 
> print('Your Final Result is:', 5 * 6)
> 
> 
> 
> 
> 
> def Division():
> 
> print('Division: What are your two numbers?')
> 
> 7 = float(input('First Number:'))
> 
> 8 = float(input('Second Number:'))
> 
> print('Your Final Result is:', 7 / 8)
> 
> 
> 
> 
> 
> 
> 
> print('What type of calculation would you like to do?')
> 
> Question = input('(Add, Subtract, Divide or Multiply)')
> 
> if Question.lower().startswith('a'):
> 
> print(Addition())
> 
> elif Question.lower().startswith('s'):
> 
> print(Subtraction())
> 
> elif Question.lower().startswith('d'):
> 
> print(Division())
> 
> elif Question.lower().startswith('m'):
> 
> print(Multiplication())
> 
> else:
> 
> print('Please Enter The First Letter Of The Type Of Calculation You 
> Would Like To Use')
> 
> 
> 
> while Question == 'test':
> 
> Question()

Can anyone point out how using an int as a var is possible, unless it's 
something I miss that changed in 3.3 from 3.2:

david@david:~$ python3.2
Python 3.2.3 (default, Sep 25 2013, 18:25:56) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 7 = float(input('First Number:'))
  File "", line 1
SyntaxError: can't assign to literal
>>> 

david@david:~$ python
Python 2.7.3 (default, Sep 26 2013, 20:08:41) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 7 = float(input('First Number:'))
  File "", line 1
SyntaxError: can't assign to literal
>>> 

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


Re: Calculator Problem

2014-02-04 Thread David Hutto
Missed that it's already pointed out, was looking at the google groups
combined email.



On Tue, Feb 4, 2014 at 10:43 AM, David Hutto  wrote:

> On Sunday, February 2, 2014 4:16:44 PM UTC-5, Charlie Winn wrote:
> > Hey Guys i Need Help , When i run this program i get the 'None' Under
> the program, see what i mean by just running it , can someone help me fix
> this
> >
> >
> >
> > def Addition():
> >
> > print('Addition: What are two your numbers?')
> >
> > 1 = float(input('First Number:'))
> >
> > 2 = float(input('Second Number:'))
> >
> > print('Your Final Result is:', 1 + 2)
> >
> >
> >
> >
> >
> > def Subtraction():
> >
> > print('Subtraction: What are two your numbers?')
> >
> > 3 = float(input('First Number:'))
> >
> > 4 = float(input('Second Number:'))
> >
> > print('Your Final Result is:', 3 - 4)
> >
> >
> >
> >
> >
> > def Multiplication():
> >
> > print('Multiplication: What are two your numbers?')
> >
> > 5 = float(input('First Number:'))
> >
> > 6 = float(input('Second Number:'))
> >
> > print('Your Final Result is:', 5 * 6)
> >
> >
> >
> >
> >
> > def Division():
> >
> > print('Division: What are your two numbers?')
> >
> > 7 = float(input('First Number:'))
> >
> > 8 = float(input('Second Number:'))
> >
> > print('Your Final Result is:', 7 / 8)
> >
> >
> >
> >
> >
> >
> >
> > print('What type of calculation would you like to do?')
> >
> > Question = input('(Add, Subtract, Divide or Multiply)')
> >
> > if Question.lower().startswith('a'):
> >
> > print(Addition())
> >
> > elif Question.lower().startswith('s'):
> >
> > print(Subtraction())
> >
> > elif Question.lower().startswith('d'):
> >
> > print(Division())
> >
> > elif Question.lower().startswith('m'):
> >
> > print(Multiplication())
> >
> > else:
> >
> > print('Please Enter The First Letter Of The Type Of Calculation
> You Would Like To Use')
> >
> >
> >
> > while Question == 'test':
> >
> > Question()
>
> Can anyone point out how using an int as a var is possible, unless it's
> something I miss that changed in 3.3 from 3.2:
>
> david@david:~$ python3.2
> Python 3.2.3 (default, Sep 25 2013, 18:25:56)
> [GCC 4.6.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> 7 = float(input('First Number:'))
>   File "", line 1
> SyntaxError: can't assign to literal
> >>>
>
> david@david:~$ python
> Python 2.7.3 (default, Sep 26 2013, 20:08:41)
> [GCC 4.6.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> 7 = float(input('First Number:'))
>   File "", line 1
> SyntaxError: can't assign to literal
> >>>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
Best Regards,
David Hutto
*CEO:* *http://www.hitwebdevelopment.com *
-- 
https://mail.python.org/mailman/listinfo/python-list


Latest Python 3.4 in the source repo is broken?

2014-02-04 Thread Steven D'Aprano
Before I bother Python-Dev with this, can anyone else confirm that 
building Python 3.4 from source using the latest version in the source 
repository fails?

# Get the source code
hg clone http://hg.python.org/cpython

# Build Python (on Unix, sorry Windows and Mac people, you're on your own)
./configure --with-pydebug && make -j2



I get the following errors:

libpython3.4dm.a(pythonrun.o): In function `_Py_InitializeEx_Private':
/home/steve/python/cpython/Python/pythonrun.c:459: undefined reference to 
`_PyTraceMalloc_Init'
libpython3.4dm.a(pythonrun.o): In function `Py_Finalize':
/home/steve/python/cpython/Python/pythonrun.c:648: undefined reference to 
`_PyTraceMalloc_Fini'
collect2: ld returned 1 exit status
make: *** [Modules/_testembed] Error 1



Thanks in advance,



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


Re: Latest Python 3.4 in the source repo is broken?

2014-02-04 Thread Zachary Ware
On Tue, Feb 4, 2014 at 9:45 AM, Steven D'Aprano
 wrote:
> Before I bother Python-Dev with this, can anyone else confirm that
> building Python 3.4 from source using the latest version in the source
> repository fails?
>
> # Get the source code
> hg clone http://hg.python.org/cpython
>
> # Build Python (on Unix, sorry Windows and Mac people, you're on your own)
> ./configure --with-pydebug && make -j2
>
>
>
> I get the following errors:
>
> libpython3.4dm.a(pythonrun.o): In function `_Py_InitializeEx_Private':
> /home/steve/python/cpython/Python/pythonrun.c:459: undefined reference to
> `_PyTraceMalloc_Init'
> libpython3.4dm.a(pythonrun.o): In function `Py_Finalize':
> /home/steve/python/cpython/Python/pythonrun.c:648: undefined reference to
> `_PyTraceMalloc_Fini'
> collect2: ld returned 1 exit status
> make: *** [Modules/_testembed] Error 1

The buildbots[1] don't seem to agree, and it builds fine for me on
Windows.  In order of destructiveness, try these:

   make
  Without -j2, see if there's a race somewhere.
   make distclean
  Clear out nearly all generated files.
   hg purge --all
  Clear out everything that's not checked in (this
  includes untracked and ignored files). You may
  need to enable the purge extension,
  `hg --config extensions.purge= purge --all`
  And I would suggest checking the output of
  `hg purge --all -p` before you do it to make sure
  you're not obliterating anything you want to keep.
   hg up null && hg purge --all && hg up default
  Rebuild the repository from scratch (without a full clone).

[1] http://buildbot.python.org/all/waterfall?category=3.x.stable

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


Re: [OT] Usage of U+00B6 PILCROW SIGN

2014-02-04 Thread Chris Angelico
On Wed, Feb 5, 2014 at 2:31 AM, Michael Torrie  wrote:
> On 02/04/2014 08:21 AM, wxjmfa...@gmail.com wrote:
>>
>> Useless and really ugly.
>
> How do you recommend we discover the anchor links for linking to?

Same way you usually do! By right clicking, hitting "View Source", and
poking around until you find the right place!

I've done exactly that with innumerable web sites. It's a massive
luxury to have them explicitly published like that; as well as the
convenience, it gives an impression (whether that's true or false)
that the hash links are deemed important and will therefore be
maintained in the future (unlike, say, a system that has
"http:///#s4"; for the fourth (or fifth) section - inserting a
section above this one will break my link)

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


Re: Latest Python 3.4 in the source repo is broken?

2014-02-04 Thread Johannes Findeisen
On 04 Feb 2014 15:45:46 GMT
Steven D'Aprano wrote:

> Before I bother Python-Dev with this, can anyone else confirm that 
> building Python 3.4 from source using the latest version in the source 
> repository fails?

I can not confirm an error. I checked out the latest sources
and ./configure and make executed without any error using exactly your
parameters.



> Thanks in advance,

You are welcome... ;)

Regards,
Johannes
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Latest Python 3.4 in the source repo is broken?

2014-02-04 Thread Chris Angelico
On Wed, Feb 5, 2014 at 3:02 AM, Zachary Ware
 wrote:
> On Tue, Feb 4, 2014 at 9:45 AM, Steven D'Aprano
>  wrote:
>> Before I bother Python-Dev with this, can anyone else confirm that
>> building Python 3.4 from source using the latest version in the source
>> repository fails?
>>
>> # Build Python (on Unix, sorry Windows and Mac people, you're on your own)
>> ./configure --with-pydebug && make -j2
>>
> The buildbots[1] don't seem to agree, and it builds fine for me on
> Windows.  In order of destructiveness, try these:
>
> [1] http://buildbot.python.org/all/waterfall?category=3.x.stable

Are there any buildbots that configure --with-pydebug? This could be a
debug-only issue.

That said, though, I just did a build without -j2 (on Linux - Debian
Wheezy amd64) and it worked fine. Doing another one with -j2 didn't
show up any errors either, but if it is a -j problem, then as Zachary
says, it could be a race.

What commit hash were you building from? It might have been broken and
then fixed shortly, and you got into that tiny window.

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


Re: Latest Python 3.4 in the source repo is broken?

2014-02-04 Thread Zachary Ware
On Tue, Feb 4, 2014 at 10:49 AM, Chris Angelico  wrote:
> Are there any buildbots that configure --with-pydebug? This could be a
> debug-only issue.

Only all of them :).  As far as I know, the only 'bot that does a
non-debug build is the "x86 Gentoo Non-Debug" bot.

> That said, though, I just did a build without -j2 (on Linux - Debian
> Wheezy amd64) and it worked fine. Doing another one with -j2 didn't
> show up any errors either, but if it is a -j problem, then as Zachary
> says, it could be a race.
>
> What commit hash were you building from? It might have been broken and
> then fixed shortly, and you got into that tiny window.

There was a brief issue this morning, but it was in typeobject.c, not
_testembed.  See http://hg.python.org/cpython/rev/655d7a55c165

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


Re: Latest Python 3.4 in the source repo is broken?

2014-02-04 Thread Chris Angelico
On Wed, Feb 5, 2014 at 3:58 AM, Zachary Ware
 wrote:
> On Tue, Feb 4, 2014 at 10:49 AM, Chris Angelico  wrote:
>> Are there any buildbots that configure --with-pydebug? This could be a
>> debug-only issue.
>
> Only all of them :).  As far as I know, the only 'bot that does a
> non-debug build is the "x86 Gentoo Non-Debug" bot.

LOL! Okay. Yeah, I think that settles that part of the question!

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


Re: Latest Python 3.4 in the source repo is broken?

2014-02-04 Thread Ethan Furman

On 02/04/2014 07:45 AM, Steven D'Aprano wrote:

Before I bother Python-Dev with this, can anyone else confirm that
building Python 3.4 from source using the latest version in the source
repository fails?


This is the check-out I'm using:

ethan@media:~/source/python/cpython$ hg parent

rev:88961:7d0a4f89c6ce
branch: default
tag:tip
user:   Vinay Sajip 
date:   2014-02-04 16:42 +
desc:   Closes #20509: Merged documentation update from 3.3.


These are the settings I always use to make sure I have no weird problems 
between check-outs:

ethan@media:~/source/python/cpython$ make distclean && ./configure --with-pydebug 
&& make -j3
..
..
..
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_gdbm _lzma
To find the necessary bits, look in setup.py in detect_modules() for the 
module's name.

running build_scripts
creating build/scripts-3.4
copying and adjusting /home/ethan/source/python/cpython/Tools/scripts/pydoc3 -> 
build/scripts-3.4
copying and adjusting /home/ethan/source/python/cpython/Tools/scripts/idle3 -> 
build/scripts-3.4
copying and adjusting /home/ethan/source/python/cpython/Tools/scripts/2to3 -> 
build/scripts-3.4
copying and adjusting /home/ethan/source/python/cpython/Tools/scripts/pyvenv -> 
build/scripts-3.4
changing mode of build/scripts-3.4/pydoc3 from 664 to 775
changing mode of build/scripts-3.4/idle3 from 664 to 775
changing mode of build/scripts-3.4/2to3 from 664 to 775
changing mode of build/scripts-3.4/pyvenv from 664 to 775
renaming build/scripts-3.4/pydoc3 to build/scripts-3.4/pydoc3.4
renaming build/scripts-3.4/idle3 to build/scripts-3.4/idle3.4
renaming build/scripts-3.4/2to3 to build/scripts-3.4/2to3-3.4
renaming build/scripts-3.4/pyvenv to build/scripts-3.4/pyvenv-3.4


Hope this helps.

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


Re: [OT] Usage of U+00B6 PILCROW SIGN

2014-02-04 Thread Ned Batchelder

On 2/4/14 10:21 AM, wxjmfa...@gmail.com wrote:

>
>I was able to discover that link by opening the page, highlighting the
>section header with my mouse, then clicking the pilcrow.  That gives
>me the anchor link to that section header.

>

Useless and really ugly.


I'm not sure why you would describe it as useless?  It's incredibly 
useful to have a way to link to a particular section.


And ugly? It's a UI that is invisible and unobtrusive, but then elegant 
once you hover over the element you are interested in.


I guess tastes differ...  Lots of sites use this technique, it is not 
particular to the Python docs.


--
Ned Batchelder, http://nedbatchelder.com

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


Re: [OT] Usage of U+00B6 PILCROW SIGN

2014-02-04 Thread Jim Gibson
In article ,
Michael Torrie  wrote:

> On 02/04/2014 08:21 AM, wxjmfa...@gmail.com wrote:
> > 
> > Useless and really ugly.
> 
> How do you recommend we discover the anchor links for linking to?

Use the Table Of Contents panel on the left?

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


Re: [OT] Usage of U+00B6 PILCROW SIGN

2014-02-04 Thread Peter Otten
Michael Torrie wrote:

> On 02/04/2014 08:21 AM, wxjmfa...@gmail.com wrote:
>> 
>> Useless and really ugly.
> 
> How do you recommend we discover the anchor links for linking to?

Why not the whole header? Click anywhere on 

7.2.1. Regular Expression Syntax

instead of the tiny ¶ symbol beside it.

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


Re: [OT] Usage of U+00B6 PILCROW SIGN (was: generator slides review and Python doc (+/- text bug))

2014-02-04 Thread andrea crotti
2014-02-04  :
> Le mardi 4 février 2014 15:39:54 UTC+1, Jerry Hill a écrit :

>
> Useless and really ugly.
>

I think this whole discussion is rather useless instead, why do you
care since you're not going to use this tool anyway?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re:Finding size of Variable

2014-02-04 Thread Dave Angel
 Ayushi Dalmia  Wrote in message:

> 
> Where am I going wrong? What are the alternatives I can try?

You've rejected all the alternatives so far without showing your
 code, or even properly specifying your problem.

To get the "total" size of a list of strings,  try (untested):

a = sys.getsizeof (mylist )
for item in mylist:
a += sys.getsizeof (item)

This can be high if some of the strings are interned and get
 counted twice. But you're not likely to get closer without some
 knowledge of the data objects and where they come
 from.

-- 
DaveA

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


Re: Finding size of Variable

2014-02-04 Thread Tim Chase
On 2014-02-04 14:21, Dave Angel wrote:
> To get the "total" size of a list of strings,  try (untested):
> 
> a = sys.getsizeof (mylist )
> for item in mylist:
> a += sys.getsizeof (item)

I always find this sort of accumulation weird (well, at least in
Python; it's the *only* way in many other languages) and would write
it as

  a = getsizeof(mylist) + sum(getsizeof(item) for item in mylist)

-tkc



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


Re: Finding size of Variable

2014-02-04 Thread Tim Golden

On 04/02/2014 19:21, Dave Angel wrote:

  Ayushi Dalmia  Wrote in message:



Where am I going wrong? What are the alternatives I can try?


You've rejected all the alternatives so far without showing your
  code, or even properly specifying your problem.

To get the "total" size of a list of strings,  try (untested):

a = sys.getsizeof (mylist )
for item in mylist:
 a += sys.getsizeof (item)


The documentation for sys.getsizeof:

  http://docs.python.org/dev/library/sys#sys.getsizeof

warns about the limitations of this function when applied to a 
container, and even points to a recipe by Raymond Hettinger which 
attempts to do a more complete job.


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


kivy

2014-02-04 Thread bharath
i installed python 2.7 before and installed suitable kivy.. i have also 
included the .bat file in the send to option.. but my programs are not at all 
runnning and giving me error when i run it normally or with the .bat file.. it 
says that there's no module named kivy when i import it.. please help im just 
frustrated after writing a long code and seeing that it isn't working.. if 
anyone has suggestions on how to develop android 2d games with python their 
reply would be greatly appreciated. thank you
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: kivy

2014-02-04 Thread MRAB

On 2014-02-04 19:55, bharath wrote:

i installed python 2.7 before and installed suitable kivy.. i have
also included the .bat file in the send to option.. but my programs
are not at all runnning and giving me error when i run it normally or
with the .bat file.. it says that there's no module named kivy when i
import it.. please help im just frustrated after writing a long code
and seeing that it isn't working.. if anyone has suggestions on how
to develop android 2d games with python their reply would be greatly
appreciated. thank you


Is kivy listed in the Python search paths (sys.path)?
--
https://mail.python.org/mailman/listinfo/python-list


Re: kivy

2014-02-04 Thread bharath
On Wednesday, February 5, 2014 1:51:31 AM UTC+5:30, MRAB wrote:
> On 2014-02-04 19:55, bharath wrote:
> 
> > i installed python 2.7 before and installed suitable kivy.. i have
> 
> > also included the .bat file in the send to option.. but my programs
> 
> > are not at all runnning and giving me error when i run it normally or
> 
> > with the .bat file.. it says that there's no module named kivy when i
> 
> > import it.. please help im just frustrated after writing a long code
> 
> > and seeing that it isn't working.. if anyone has suggestions on how
> 
> > to develop android 2d games with python their reply would be greatly
> 
> > appreciated. thank you
> 
> >
> 
> Is kivy listed in the Python search paths (sys.path)?

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


Re: kivy

2014-02-04 Thread bharath
On Wednesday, February 5, 2014 1:51:31 AM UTC+5:30, MRAB wrote:
> On 2014-02-04 19:55, bharath wrote:
> 
> > i installed python 2.7 before and installed suitable kivy.. i have
> 
> > also included the .bat file in the send to option.. but my programs
> 
> > are not at all runnning and giving me error when i run it normally or
> 
> > with the .bat file.. it says that there's no module named kivy when i
> 
> > import it.. please help im just frustrated after writing a long code
> 
> > and seeing that it isn't working.. if anyone has suggestions on how
> 
> > to develop android 2d games with python their reply would be greatly
> 
> > appreciated. thank you
> 
> >
> 
> Is kivy listed in the Python search paths (sys.path)?

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


Re: kivy

2014-02-04 Thread Gary Herron

On 02/04/2014 11:55 AM, bharath wrote:

i installed python 2.7 before and installed suitable kivy.. i have also 
included the .bat file in the send to option.. but my programs are not at all 
runnning and giving me error when i run it normally or with the .bat file.. it 
says that there's no module named kivy when i import it.. please help im just 
frustrated after writing a long code and seeing that it isn't working.. if 
anyone has suggestions on how to develop android 2d games with python their 
reply would be greatly appreciated. thank you


This is a Python newsgroup.  You might find an answer here, but I think 
you'd have much better luck if you found a kivy specific newsgroup.


Good luck,

Gary Herron

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


RE: kivy

2014-02-04 Thread Nick Cash
>> Is kivy listed in the Python search paths (sys.path)?

>yes

To be extra sure, you can start a python interpreter with the commandline 
argument -vv, and when you try to import kivy (or any module) it will show you 
every file/path it checks when trying to find it. This might help you narrow 
down where the problem lies.

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


Re: kivy

2014-02-04 Thread bharath
On Wednesday, February 5, 2014 2:03:58 AM UTC+5:30, Nick Cash wrote:
> >> Is kivy listed in the Python search paths (sys.path)?
> 
> 
> 
> >yes
> 
> 
> 
> To be extra sure, you can start a python interpreter with the commandline 
> argument -vv, and when you try to import kivy (or any module) it will show 
> you every file/path it checks when trying to find it. This might help you 
> narrow down where the problem lies.
> 
> 
> 
> -Nick Cash

thanks nick that helped. i actually cant express this feeling of gratitude.. 
thank you very much.this is a wonderful group..
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Calculator Problem

2014-02-04 Thread Mario R. Osorio
On Sunday, February 2, 2014 4:16:44 PM UTC-5, Charlie Winn wrote:
> Hey Guys i Need Help , When i run this program i get the 'None' Under the 
> program, see what i mean by just running it , can someone help me fix this
> 
> 
> 
> def Addition():
> 
> print('Addition: What are two your numbers?')
> 
> 1 = float(input('First Number:'))
> 
> 2 = float(input('Second Number:'))
> 
> print('Your Final Result is:', 1 + 2)
> 
> 
> 
> 
> 
> def Subtraction():
> 
> print('Subtraction: What are two your numbers?')
> 
> 3 = float(input('First Number:'))
> 
> 4 = float(input('Second Number:'))
> 
> print('Your Final Result is:', 3 - 4)
> 
> 
> 
> 
> 
> def Multiplication():
> 
> print('Multiplication: What are two your numbers?')
> 
> 5 = float(input('First Number:'))
> 
> 6 = float(input('Second Number:'))
> 
> print('Your Final Result is:', 5 * 6)
> 
> 
> 
> 
> 
> def Division():
> 
> print('Division: What are your two numbers?')
> 
> 7 = float(input('First Number:'))
> 
> 8 = float(input('Second Number:'))
> 
> print('Your Final Result is:', 7 / 8)
> 
> 
> 
> 
> 
> 
> 
> print('What type of calculation would you like to do?')
> 
> Question = input('(Add, Subtract, Divide or Multiply)')
> 
> if Question.lower().startswith('a'):
> 
> print(Addition())
> 
> elif Question.lower().startswith('s'):
> 
> print(Subtraction())
> 
> elif Question.lower().startswith('d'):
> 
> print(Division())
> 
> elif Question.lower().startswith('m'):
> 
> print(Multiplication())
> 
> else:
> 
> print('Please Enter The First Letter Of The Type Of Calculation You 
> Would Like To Use')
> 
> 
> 
> while Question == 'test':
> 
> Question()

I don't know why people bother trying to help you, when it is YOU that has a 
*** rude attitude.

You are asking the wrong question to begin with because the posted code could 
have NEVER given you the stated output.

Most of us here are noobs and those that are not, were noobs once; so we all 
can deal with noobs, but none should have to deal with a***holes.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [OT] Usage of U+00B6 PILCROW SIGN

2014-02-04 Thread Terry Reedy

On 2/4/2014 1:20 PM, Ned Batchelder wrote:

On 2/4/14 10:21 AM, wxjmfa...@gmail.com wrote:

>
>I was able to discover that link by opening the page, highlighting the
>section header with my mouse, then clicking the pilcrow.  That gives
>me the anchor link to that section header.

 >

Useless and really ugly.


I'm not sure why you would describe it as useless?


Because, as we should all know by now, when Jim says 'useless', he means 
'useless to me, according to my unusual notions of personal usefulness'. 
He, apparently, does not intend to ever use the pilcrow to get a section 
link, nor does he care about being able to click on such links presented 
by others.



It's incredibly useful to have a way to link to a particular section.


For many people, but not for Jim. Either he does not care about 
usefulness to others, or he is completely oblivious to how idiosyncratic 
his personal idea of usefulness is. In either case, it is useless to 
argue against his personal opinion. He should, however, add 'to me' 
since most people take 'useless' in the collective sense.



And ugly? It's a UI that is invisible and unobtrusive, but then elegant
once you hover over the element you are interested in.


Having it pop up and disappear when one does not want it and will not 
use it is not pretty. When scrolling with a mouse wheel, that does happen.



I guess tastes differ...  Lots of sites use this technique, it is not
particular to the Python docs.


Irrelevant to Jim.

--
Terry Jan Reedy

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


Re: [OT] Usage of U+00B6 PILCROW SIGN

2014-02-04 Thread Terry Reedy

On 2/4/2014 10:21 AM, wxjmfa...@gmail.com wrote:


I was able to discover that link by opening the page, highlighting the
section header with my mouse, then clicking the pilcrow.  That gives
me the anchor link to that section header.


Useless and really ugly.


Jim, when you say 'useless', please qualify as 'useless to me'. 
Otherwise, people may think that you mean 'useless to eveyone', and it 
is disrespectful to mislead people that way. I hope you are aware that 
your personal ideas of usefulness to yourself are quite different from 
other peoples' ideas of usefulness to themselves.


I now understand that you consider the FSR useless *to you* because you 
do not care about the bugginess of narrow builds or about the spacious 
of wide builds. You do care about uniformity of character size across 
all strings, and FSR lacks that. You are entitled to make that judgment 
for yourself. You are not entitled to sabotage others by projecting you 
personal judgments onto others. The FSR and pilcrow are definitely 
useful to other people as they judge personal usefulness for themselves.


PS. I agree that the pilcrow appearing and disappearing is not pretty 
when I am not looking to use it. I happen to think that is it tolerable 
because it is sometimes useful.


--
Terry Jan Reedy

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


Re: [OT] Usage of U+00B6 PILCROW SIGN

2014-02-04 Thread Terry Reedy

On 2/4/2014 2:19 PM, andrea crotti wrote:

2014-02-04  :

Useless and really ugly.



I think this whole discussion is rather useless.


I agree that responding to Jim's generalized statements such as 
'useless' are either sincere personal opinions that are true with 
respect to himself, delusional statements that are false with respect to 
the community at large, or intentionally false trolls. I really cannot 
tell. In any case, I agree that response is pretty useless.


--
Terry Jan Reedy

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


Re: [OT] Usage of U+00B6 PILCROW SIGN

2014-02-04 Thread Terry Reedy

On 2/4/2014 6:24 PM, Terry Reedy wrote:

On 2/4/2014 2:19 PM, andrea crotti wrote:

2014-02-04  :

Useless and really ugly.



I think this whole discussion is rather useless.


I agree that responding to Jim's generalized statements such as
'useless' are either sincere personal opinions that are true with
respect to himself, delusional statements that are false with respect to
the community at large, or intentionally false trolls. I really cannot
tell. In any case, I agree that response is pretty useless.


Please ignore garbled post as I hit send in mid composition while revising.

--
Terry Jan Reedy

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


Re: [OT] Usage of U+00B6 PILCROW SIGN

2014-02-04 Thread Chris Angelico
On Wed, Feb 5, 2014 at 10:18 AM, Terry Reedy  wrote:
> PS. I agree that the pilcrow appearing and disappearing is not pretty when I
> am not looking to use it. I happen to think that is it tolerable because it
> is sometimes useful.

Yes, it's not perfect. But neither are the obvious alternatives:

* Keeping the symbol there permanently looks weird, and also raises
the question of whether or not it should be copied to the clipboard if
you select a whole pile of content. (If it is, you get an ugly bit of
junk in your text, something that now (being unclickable) has no
meaning. If it isn't, why isn't it? It's clearly part of the text!)

* Making the whole heading clickable is a bit weird in terms of UI. It
makes this text a link to itself, where it looks like it could be a
link to somewhere else. I've seen other sites where headings are all
links back to their ToC entries (ie the top of the page, or close to),
which is also weird, and the fact that it could be either means that
people won't know they can click on the heading to get a link to that
section.

* Having nothing on the section itself does work, but it means that
finding a section link requires you to go back up to the top of the
page, figure out which Contents entry is the section you want, and
click on it. That's how I get section links from a MediaWiki site (eg
Wikipedia); yes, it's workable, but it would be nicer to have the link
down at the section I'm reading.

* Putting a fixed-position piece of text showing the current section
is way too intrusive. I've seen sites with that, and I'm sure it's
useful, but I'd really prefer something a lot more subtle.

All of the above are plausible, but none is perfect. So what do you
do? You go with something imperfect and cope with a few issues.

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


Re: Concepts and Applications of Finite Element Analysis (4th Ed., Cook, Malkus, Plesha & Witt)

2014-02-04 Thread Ned Batchelder

On 2/4/14 6:24 PM, yamas wrote:

On Sun, 02 Feb 2014 17:59:29 -0600, kalvinmanual3 wrote:


I have solutions manuals to all problems and exercises in these
textbooks.
To get one in an electronic format contact me at


fuck off retard



No matter what you think of the inappropriate post about manuals, this 
kind of response is completely unacceptable.  Please don't do it again.


Please read this: http://www.python.org/psf/codeofconduct

--
Ned Batchelder, http://nedbatchelder.com

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


Re: Calculator Problem

2014-02-04 Thread Roy Smith
In article ,
 David Hutto  wrote:

> Can anyone point out how using an int as a var is possible

one = 42

(ducking and running)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Calculator Problem

2014-02-04 Thread Chris Angelico
On Wed, Feb 5, 2014 at 11:53 AM, Roy Smith  wrote:
> In article ,
>  David Hutto  wrote:
>
>> Can anyone point out how using an int as a var is possible
>
> one = 42
>
> (ducking and running)

In theory, there might be a Unicode character that's valid as an
identifier, but gets converted into U+0031 for ASCIIfication prior to
being sent by email. However, I can't find one :)

And of course, that assumes that the OP's mail client mangles its
input in that way. ASCIIfication shouldn't be necessary.

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


Re: Concepts and Applications of Finite Element Analysis (4th Ed., Cook, Malkus, Plesha & Witt)

2014-02-04 Thread Terry Reedy

On 2/4/2014 6:36 PM, Ned Batchelder wrote:


On 2/4/14 6:24 PM, yamas wrote:

On Sun, 02 Feb 2014 17:59:29 -0600, kalvinmanual3 wrote:




Python-list (and gmane) readers do not see and hence never notice the 
spam that gets blocked -- about 90%. Since essentially identical 
messages have appeared before, probably from the same sender, I tweaked 
the settings a bit.



 


The few spam messages that do make it to the list should almost always 
be ignored and not kept alive by responses.


One would have to be ignorant and/or foolish to think that spammers read 
responses on any of the many lists they spam. So any response is 
directed at the non-spammer readers. Obnoxious responses like that above 
constitute trolling.



No matter what you think of the inappropriate post about manuals, this
kind of response is completely unacceptable.  Please don't do it again.

Please read this: http://www.python.org/psf/codeofconduct


Please do, and follow it.

--
Terry Jan Reedy

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


Re: Calculator Problem

2014-02-04 Thread Dan Sommers
On Tue, 04 Feb 2014 19:53:52 -0500, Roy Smith wrote:

> In article ,
>  David Hutto  wrote:
> 
>> Can anyone point out how using an int as a var is possible
> 
> one = 42
> 
> (ducking and running)

int = 42

(ducking lower and running faster)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: kivy

2014-02-04 Thread Rustom Mody
On Wednesday, February 5, 2014 1:25:43 AM UTC+5:30, bharath wrote:
> please help im just frustrated after writing a long code and seeing that it 
> isn't working.. 

Prior to Kernighan and Ritchie people did tend to write 'a long code'
and then check that its working (or not).  After 'The C programming
language' -- which is about 40 years -- starting any programming
enterprise without writing AND CHECKING the equivalent of "Hello
World" is just never done.

IOW you underestimate how many niggling details both of the system and
of your understanding are checked by that approach



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


Re: Finding size of Variable

2014-02-04 Thread Ayushi Dalmia
On Tuesday, February 4, 2014 7:36:48 PM UTC+5:30, Dennis Lee Bieber wrote:
> On Tue, 4 Feb 2014 05:19:48 -0800 (PST), Ayushi Dalmia
> 
>  declaimed the following:
> 
> 
> 
> 
> 
> >I need to chunk out the outputs otherwise it will give Memory Error. I need 
> >to do some postprocessing on the data read from the file too. If I donot 
> >stop before memory error, I won't be able to perform any more operations on 
> >it.
> 
> 
> 
>   10 200MB files is only 2GB... Most any 64-bit processor these days can
> 
> handle that. Even some 32-bit systems could handle it (WinXP booted with
> 
> the server option gives 3GB to user processes -- if the 4GB was installed
> 
> in the machine).
> 
> 
> 
>   However, you speak of an n-way merge. The traditional merge operation
> 
> only reads one record from each file at a time, examines them for "first",
> 
> writes that "first", reads next record from the file "first" came from, and
> 
> then reassesses the set.
> 
> 
> 
>   You mention needed to chunk the data -- that implies performing a merge
> 
> sort in which you read a few records from each file into memory, sort them,
> 
> and right them out to newFile1; then read the same number of records from
> 
> each file, sort, and write them to newFile2, up to however many files you
> 
> intend to work with -- at that point you go back and append the next chunk
> 
> to newFile1. When done, each file contains chunks of n*r records. You now
> 
> make newFilex the inputs, read/merge the records from those chunks
> 
> outputting to another file1, when you reach the end of the first chunk in
> 
> the files you then read/merge the second chunk into another file2. You
> 
> repeat this process until you end up with only one chunk in one file.
> 
> -- 
> 
>   Wulfraed Dennis Lee Bieber AF6VN
> 
> wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/

The way you mentioned for merging the file is an option but that will involve a 
lot of I/O operation. Also, I do not want the size of the file to increase 
beyond a certain point. When I reach the file size upto a certain limit, I want 
to start writing in a new file. This is because I want to store them in memory 
again later.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Finding size of Variable

2014-02-04 Thread Ayushi Dalmia
On Wednesday, February 5, 2014 12:51:31 AM UTC+5:30, Dave Angel wrote:
> Ayushi Dalmia  Wrote in message:
> 
> 
> 
> > 
> 
> > Where am I going wrong? What are the alternatives I can try?
> 
> 
> 
> You've rejected all the alternatives so far without showing your
> 
>  code, or even properly specifying your problem.
> 
> 
> 
> To get the "total" size of a list of strings,  try (untested):
> 
> 
> 
> a = sys.getsizeof (mylist )
> 
> for item in mylist:
> 
> a += sys.getsizeof (item)
> 
> 
> 
> This can be high if some of the strings are interned and get
> 
>  counted twice. But you're not likely to get closer without some
> 
>  knowledge of the data objects and where they come
> 
>  from.
> 
> 
> 
> -- 
> 
> DaveA

Hello Dave, 

I just thought that saving others time is better and hence I explained only the 
subset of my problem. Here is what I am trying to do:

I am trying to index the current wikipedia dump without using databases and 
create a search engine for Wikipedia documents. Note, I CANNOT USE DATABASES.
My approach:

I am parsing the wikipedia pages using SAX Parser, and then, I am dumping the 
words along with the posting list (a list of doc ids in which the word is 
present) into different files after reading 'X' number of pages. Now these 
files may have the same word and hence I need to merge them and write the final 
index again. Now these final indexes must be of limited size as I need to be of 
limited size. This is where I am stuck. I need to know how to determine the 
size of content in a variable before I write into the file.

Here is the code for my merging:

def mergeFiles(pathOfFolder, countFile):
listOfWords={}
indexFile={}
topOfFile={}
flag=[0]*countFile
data=defaultdict(list)
heap=[]
countFinalFile=0
for i in xrange(countFile):
fileName = pathOfFolder+'\index'+str(i)+'.txt.bz2'
indexFile[i]= bz2.BZ2File(fileName, 'rb')
flag[i]=1
topOfFile[i]=indexFile[i].readline().strip()
listOfWords[i] = topOfFile[i].split(' ')
if listOfWords[i][0] not in heap:
heapq.heappush(heap, listOfWords[i][0])

while any(flag)==1:
temp = heapq.heappop(heap)
for i in xrange(countFile):
if flag[i]==1:
if listOfWords[i][0]==temp:

//This is where I am stuck. I cannot wait until memory 
//error, as I need to do some postprocessing too.
try:
data[temp].extend(listOfWords[i][1:])
except MemoryError:
writeFinalIndex(data, countFinalFile, pathOfFolder)
data=defaultdict(list)
countFinalFile+=1

topOfFile[i]=indexFile[i].readline().strip()   
if topOfFile[i]=='':
flag[i]=0
indexFile[i].close()
os.remove(pathOfFolder+'\index'+str(i)+'.txt.bz2')
else:
listOfWords[i] = topOfFile[i].split(' ')
if listOfWords[i][0] not in heap:
heapq.heappush(heap, listOfWords[i][0])
writeFinalIndex(data, countFinalFile, pathOfFolder)

countFile is the number of files and writeFileIndex method writes into the file.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Finding size of Variable

2014-02-04 Thread Ayushi Dalmia
On Wednesday, February 5, 2014 12:59:46 AM UTC+5:30, Tim Chase wrote:
> On 2014-02-04 14:21, Dave Angel wrote:
> 
> > To get the "total" size of a list of strings,  try (untested):
> 
> > 
> 
> > a = sys.getsizeof (mylist )
> 
> > for item in mylist:
> 
> > a += sys.getsizeof (item)
> 
> 
> 
> I always find this sort of accumulation weird (well, at least in
> 
> Python; it's the *only* way in many other languages) and would write
> 
> it as
> 
> 
> 
>   a = getsizeof(mylist) + sum(getsizeof(item) for item in mylist)
> 
> 
> 
> -tkc

This also doesn't gives the true size. I did the following:

import sys
data=[]
f=open('stopWords.txt','r')

for line in f:
line=line.split()
data.extend(line)

print sys.getsizeof(data)

where stopWords.txt is a file of size 4KB
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Finding size of Variable

2014-02-04 Thread Rustom Mody
On Wednesday, February 5, 2014 11:05:05 AM UTC+5:30, Ayushi Dalmia wrote:
> This also doesn't gives the true size. I did the following:

> import sys
> data=[]
> f=open('stopWords.txt','r')

> for line in f:
> line=line.split()
> data.extend(line)

> print sys.getsizeof(data)

> where stopWords.txt is a file of size 4KB

Try getsizeof("".join(data))

General advice:
- You have been recommended (by Chris??) that you should use a database
- You say you cant use a database (for whatever reason)

Now the fact is you NEED database (functionality)
How to escape this catch-22 situation?
In computer science its called somewhat sardonically "Greenspun's 10th rule"

And the best way out is to 

1 isolate those aspects of database functionality you need 
2 temporarily forget about your original problem and implement the dbms
(subset of) DBMS functionality you need
3 Use 2 above to implement 1
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Finding size of Variable

2014-02-04 Thread Ayushi Dalmia
On Wednesday, February 5, 2014 11:15:09 AM UTC+5:30, Rustom Mody wrote:
> On Wednesday, February 5, 2014 11:05:05 AM UTC+5:30, Ayushi Dalmia wrote:
> 
> > This also doesn't gives the true size. I did the following:
> 
> 
> 
> > import sys
> 
> > data=[]
> 
> > f=open('stopWords.txt','r')
> 
> 
> 
> > for line in f:
> 
> > line=line.split()
> 
> > data.extend(line)
> 
> 
> 
> > print sys.getsizeof(data)
> 
> 
> 
> > where stopWords.txt is a file of size 4KB
> 
> 
> 
> Try getsizeof("".join(data))
> 
> 
> 
> General advice:
> 
> - You have been recommended (by Chris??) that you should use a database
> 
> - You say you cant use a database (for whatever reason)
> 
> 
> 
> Now the fact is you NEED database (functionality)
> 
> How to escape this catch-22 situation?
> 
> In computer science its called somewhat sardonically "Greenspun's 10th rule"
> 
> 
> 
> And the best way out is to 
> 
> 
> 
> 1 isolate those aspects of database functionality you need 
> 
> 2 temporarily forget about your original problem and implement the dbms
> 
> (subset of) DBMS functionality you need
> 
> 3 Use 2 above to implement 1

Hello Rustum,

Thanks for the enlightenment. I did not know about the Greenspun's Tenth rule. 
It is interesting to know that. However, it is an academic project and not a 
research one. Hence I donot have the liberty to choose what to work with. Life 
is easier with databases though, but I am not allowed to use them. Thanks for 
the tip. I will try to replicate those functionality.
-- 
https://mail.python.org/mailman/listinfo/python-list