473,387 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Documentation/Info on this sign

Could someone point me to documentation on this (and similar) signs used
in Python:

+=

Usage would be:

x = += len(y)

Literally, that's "variable x equals
'funky-symbol-that-I-want-to-learn-about' the length of variable y"

Thank you,

Bart
Jul 18 '05 #1
14 1417
Bart Nessux wrote:
Could someone point me to documentation on this (and similar) signs used
in Python:

+=

Usage would be:

x = += len(y)

Literally, that's "variable x equals
'funky-symbol-that-I-want-to-learn-about' the length of variable y"

Thank you,

Bart


Bart, see http://docs.python.org/ref/augassign.html
wes

Jul 18 '05 #2
wes weston wrote:
Bart Nessux wrote:
Could someone point me to documentation on this (and similar) signs
used in Python:

+=

Usage would be:

x = += len(y)

Literally, that's "variable x equals
'funky-symbol-that-I-want-to-learn-about' the length of variable y"

Thank you,

Bart

Bart, see http://docs.python.org/ref/augassign.html
wes


Thanks Wes!
Jul 18 '05 #3
Bart Nessux wrote:
Could someone point me to documentation on this (and similar) signs used
in Python:

+=
http://docs.python.org/ref/augassign.html
Usage would be:

x = += len(y)
What do you mean by this? "Usage would be"... ?
Literally, that's "variable x equals
'funky-symbol-that-I-want-to-learn-about' the length of variable y"


Huh? This doesn't have meaning... both = and += are assignment
statements, so you can't put one right after the other.

What are you trying to do?

-Peter
Jul 18 '05 #4
On Thu, 20 May 2004 11:26:20 -0400, Bart Nessux
<ba*********@hotmail.com> declaimed the following in comp.lang.python:
Could someone point me to documentation on this (and similar) signs used
in Python:

+=
Python Reference Manual: section 6.3.1 "Augmented Assignment
Statements"

Literally, that's "variable x equals
'funky-symbol-that-I-want-to-learn-about' the length of variable y"
Literally? That's a syntax error...

x += len(y)

is correct usage.

{var} {operator}= {expr}

is basically a short-cut for

{var} = {var} {operator} {expr}

-- ================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.netcom.com/> <

Jul 18 '05 #5
Bart Nessux wrote:
Could someone point me to documentation on this (and similar)
signs used in Python:

+=
http://www.python.org/doc/current/ref/augassign.html
Usage would be:

x = += len(y)


No, it would be:

x = len(y)

or:

x += len(y)

You can't combine them.

-- David Goodger
Jul 18 '05 #6
Peter Hansen wrote:
Bart Nessux wrote:
Could someone point me to documentation on this (and similar) signs
used in Python:

+=

http://docs.python.org/ref/augassign.html
Usage would be:

x = += len(y)

What do you mean by this? "Usage would be"... ?
Literally, that's "variable x equals
'funky-symbol-that-I-want-to-learn-about' the length of variable y"

Huh? This doesn't have meaning... both = and += are assignment
statements, so you can't put one right after the other.

What are you trying to do?

-Peter


I'm trying to count files and dirs on a Win XP system... I'm trying to
do so with a great degree of accuracy. Here's what I've tried:

def fs_object_count():
file_count = 0
dir_count = 0
for root, dirs, files in os.walk(/):
file_count += len(files)
dir_count += len(dirs)
print "Number of Files Examined: ", file_count
print "Number of Folders Examined: ", dir_count
print "Total number of FS Objects is:", file_count + dir_count

I've also tried this:

def fs_object_count():
fs_list = []
for root, dirs, files in os.walk('/'):
for d in dirs:
fs_list.append(d)
for f in files:
fs_list.append(f)
print len(fs_list)

Both functions produce the same results (33,000 files)... the problem:
the filesystem has twice as many files (66,000) than the actual sums of
these two counts when doing a virus scan or an adaware scan. To make
matters more confusing... the IBM Tivoli backup software that I use
confirms the Python counts when it does a backup. I don't know of a way
to see what the OS has to say what it thinks is correct. Any ideas on
how to do this?
Jul 18 '05 #7
Bart Nessux wrote:
confirms the Python counts when it does a backup. I don't know of a way
to see what the OS has to say what it thinks is correct. Any ideas on
how to do this?


Yes, just open your C: drive (or whatever file system you have)
in an Explorer window, then select all files and folders by
doing Ctrl-A (or Select All from the Edit menu), then right-click
and select Properties. Along with the total storage space
used, etc, the dialog will show "Contains: xx,xxx files".

-Peter
Jul 18 '05 #8
Bart Nessux wrote:
Both functions produce the same results (33,000 files)... the problem:
the filesystem has twice as many files (66,000) than the actual sums of
these two counts when doing a virus scan or an adaware scan. To make
matters more confusing... the IBM Tivoli backup software that I use
confirms the Python counts when it does a backup.


Just an idea... maybe virus scanners and adaware open and scan archives
(zip, rar, tar, ...) and include the files in the archives in their counts?

--
"Codito ergo sum"
Roel Schroeven
Jul 18 '05 #9
Bart Nessux wrote:
Both functions produce the same results (33,000 files)... the problem:
the filesystem has twice as many files (66,000) than the actual sums of
these two counts when doing a virus scan or an adaware scan. To make
matters more confusing... the IBM Tivoli backup software that I use
confirms the Python counts when it does a backup. I don't know of a way
to see what the OS has to say what it thinks is correct. Any ideas on
how to do this?


Maybe you have a symlink (how are they called in windows?) in the root
folder. The number of files would vary depending on whether the software
follows symlinks or not. That could explain the factor 2.

Peter
Jul 18 '05 #10
Peter Otten wrote:
Bart Nessux wrote:
Both functions produce the same results (33,000 files)... the problem:
the filesystem has twice as many files (66,000) than the actual sums of
these two counts when doing a virus scan or an adaware scan. To make
matters more confusing... the IBM Tivoli backup software that I use
confirms the Python counts when it does a backup. I don't know of a way
to see what the OS has to say what it thinks is correct. Any ideas on
how to do this?


Maybe you have a symlink (how are they called in windows?) in the root
folder. The number of files would vary depending on whether the software
follows symlinks or not. That could explain the factor 2.


While the NTFS does support symbolic link, it doesn't even appear
to include a utility to create them, and most people, I suspect
don't even know they exist. (I had to check with Google to even
find this out.) There is a utility called "junction" which can
be had from http://www.sysinternals.com/ntw2k/so...shtml#junction
perhaps among other places. Very unlikely the OP has used this...

-Peter
Jul 18 '05 #11
Peter Hansen wrote:
Peter Otten wrote:
Bart Nessux wrote:
Both functions produce the same results (33,000 files)... the problem:
the filesystem has twice as many files (66,000) than the actual sums of
these two counts when doing a virus scan or an adaware scan. To make
matters more confusing... the IBM Tivoli backup software that I use
confirms the Python counts when it does a backup. I don't know of a way
to see what the OS has to say what it thinks is correct. Any ideas on
how to do this?


Maybe you have a symlink (how are they called in windows?) in the root
folder. The number of files would vary depending on whether the software
follows symlinks or not. That could explain the factor 2.


While the NTFS does support symbolic link, it doesn't even appear
to include a utility to create them, and most people, I suspect
don't even know they exist. (I had to check with Google to even
find this out.) There is a utility called "junction" which can
be had from http://www.sysinternals.com/ntw2k/so...shtml#junction
perhaps among other places. Very unlikely the OP has used this...


Oops, I meant plain old shortcuts (the german term used by windows,
"Verknüpfung", translates smoothly to link, shortcut would rather be
"Abkürzung"). The meaning got lost in translation.
Upon reflection it seems unlikely that an antivirus tool would resolve
shortcuts, but the basic idea that twice as many files being seen is an
indication of files being seen twice _somehow_ still seems compelling.

Peter

Jul 18 '05 #12
Peter Otten wrote:
Oops, I meant plain old shortcuts (the german term used by windows,
"Verknüpfung", translates smoothly to link, shortcut would rather be
"Abkürzung"). The meaning got lost in translation.
I've yet to see *anything* other than Windows itself which
bothers to resolve shortcuts.
Upon reflection it seems unlikely that an antivirus tool would resolve
shortcuts, but the basic idea that twice as many files being seen is an
indication of files being seen twice _somehow_ still seems compelling.


True. I didn't take the numbers given by the OP as being
exact, mind you, but perhaps they were.

-Peter
Jul 18 '05 #13

"Peter Otten" <__*******@web.de> wrote in message
news:c8*************@news.t-online.com...
Upon reflection it seems unlikely that an antivirus tool would resolve
shortcuts, but the basic idea that twice as many files being seen is an
indication of files being seen twice _somehow_ still seems compelling.


I have a memory (about a year ago) of (McAfee?) AV scanning every file
twice. Not sure why or settings used, but I think it applied two separate
algorithms in separate passes. Don't remember if doubled number. More
concerned by nasty infection it found;-)

tjr


Jul 18 '05 #14
eTrust antivirus can scan twice because it uses two different engines. Maybe
this is what you are remembering ?

"Terry Reedy" <tj*****@udel.edu> a écrit dans le message de
news:ma*************************************@pytho n.org...

"Peter Otten" <__*******@web.de> wrote in message
news:c8*************@news.t-online.com...
Upon reflection it seems unlikely that an antivirus tool would resolve
shortcuts, but the basic idea that twice as many files being seen is an
indication of files being seen twice _somehow_ still seems compelling.


I have a memory (about a year ago) of (McAfee?) AV scanning every file
twice. Not sure why or settings used, but I think it applied two separate
algorithms in separate passes. Don't remember if doubled number. More
concerned by nasty infection it found;-)

tjr

Jul 18 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Steven Bethard | last post by:
In trying to work out what's different between the start, stop and step of slice.indices() and the start, stop and step of sequence slicing I found that some of the list slicing documentation is...
2
by: Lynn.Tilby | last post by:
Are there hypertext pages available in 7.3 or 7.4 for SQL Key Words, like there are in SQL Commands, so a person can just click on the word and get documentation and usage information? I have...
0
by: harshas | last post by:
Are you responsible for developing or maintaining documentation for applications that you develop in your company or corporation? Have you thought about out-sourcing this time-consuming necessity...
1
by: Dejan Vesic | last post by:
I found nasty "documentation" bug; ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfsystemglobalizationcultureinfoclasstopic.htm claims that proper culture info name for Serbian (Cyrillic) - Serbia...
2
by: Andrea Williams | last post by:
I have a form where the user chooses reporting options and when submit is clicked, I need to present them with dynamically created excel file. In Classic ASP I would just change the viewing...
97
by: Cameron Laird | last post by:
QOTW: "Python makes it easy to implement algorithms." - casevh "Most of the discussion of immutables here seems to be caused by newcomers wanting to copy an idiom from another language which...
0
by: innovasys | last post by:
TORQUAY, DEVON, UK - Innovasys announced the release of Document! X 5, the fifth version of the documentation solution of choice for developers using Microsoft Visual Studio or the .NET Framework....
34
by: nicolasfr | last post by:
Hi, I am a bit disapointed with the current Python online documentation. I have read many messages of people complaining about the documentation, it's lack of examples and the use of complicated...
5
by: John Browning | last post by:
Hi there, I've frequently noticed quite a few .NET functions with the following MSDN caveat: "This method supports the .NET Framework infrastructure and is not intended to be used directly...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.